Exemple #1
0
 def testCloseDoesNotTriggerAutoSave(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.tasks().append(task.Task())
     self.autoSaver.on_idle(dummy.Event())
     self.taskFile.close()
     self.assertEqual(1, self.taskFile.saveCalled)
Exemple #2
0
 def testAddOneTaskWhenAutoSaveIsOn(self):
     self.settings.set('file', 'autoexport', '["Todo.txt"]')
     self.settings.set('file', 'autosave', 'True')
     autosaver = persistence.AutoSaver(self.settings)
     self.taskFile.tasks().append(task.Task(subject='Some task'))
     autosaver.on_idle(dummy.Event())
     self.assertEqual('Some task\n', file(self.txtFilename, 'r').read())
Exemple #3
0
 def testImportOneTaskWhenAutoSaving(self):
     self.settings.set('file', 'autoimport', '["Todo.txt"]')
     self.settings.set('file', 'autosave', 'True')
     autosaver = persistence.AutoSaver(self.settings)
     with file(self.txtFilename, 'w') as todoTxtFile:
         todoTxtFile.write('Imported task\n')
     self.taskFile.tasks().append(task.Task(subject='Some task'))
     autosaver.on_idle(dummy.Event())
     self.assertEqual(2, len(self.taskFile.tasks()))
Exemple #4
0
 def testLoadWithExceptionDoesNotTriggerAutoSave(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     try:
         self.taskFile.load(throw=True)
     except IOError:
         pass
     self.autoSaver.on_idle(dummy.Event())
     self.failIf(self.taskFile.saveCalled)
Exemple #5
0
 def testSetHourlyFee(self):
     self.editor._interior[5]._hourlyFeeEntry.SetValue(100)
     self.editor._interior[5]._hourlyFeeSync.onAttributeEdited(dummy.Event())
     self.assertEqual(100, self.task.hourlyFee())
Exemple #6
0
 def testSetNegativePriority(self):
     self.editor._interior[0]._priorityEntry.SetValue(-1)
     self.editor._interior[0]._prioritySync.onAttributeEdited(dummy.Event())
     self.assertEqual(-1, self.task.priority())
Exemple #7
0
 def testThatPickingAFontChangesTheItemFont(self):
     font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
     font.SetPointSize(font.GetPointSize() + 1)
     self.appearance._fontEntry.SetValue(font)
     self.appearance._fontSync.onAttributeEdited(dummy.Event())
     self.assertEqual(font, self.item.font())
Exemple #8
0
 def testThatPickingABackgroundColorChangesTheItemBackgroundColor(self):
     self.appearance._backgroundColorEntry.SetValue(wx.RED)
     self.appearance._backgroundColorSync.onAttributeEdited(dummy.Event())
     self.assertEqual(wx.RED, self.item.backgroundColor())
Exemple #9
0
 def testThatPickingAnIconChangesTheItemIcon(self):
     self.appearance._iconEntry.SetValue('bomb_icon')
     self.appearance._iconSync.onAttributeEdited(dummy.Event())
     self.assertEqual('bomb_icon', self.item.icon())
Exemple #10
0
 def testThatPickingAColorChangesTheFontButtonColor(self):
     self.appearance._foregroundColorEntry.SetValue(wx.RED)
     self.appearance._foregroundColorSync.onAttributeEdited(dummy.Event())
     self.assertEqual(wx.RED, self.appearance._fontEntry.GetColor())
Exemple #11
0
 def testLoadDoesNotTriggerAutoSave(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.load()
     self.autoSaver.on_idle(dummy.Event())
     self.failIf(self.taskFile.saveCalled)
Exemple #12
0
 def testChangeTask(self):
     self.editor._interior._taskEntry.SetValue(self.task2)
     self.editor._interior._taskSync.onAttributeEdited(dummy.Event())
     self.assertEqual(self.task2, self.effort.task())
     self.failIf(self.effort in self.task.efforts())
Exemple #13
0
 def setDescription(self, newDescription):
     page = super(TaskEditorBySettingFocusMixin, self).setDescription(newDescription)
     if operating_system.isGTK(): 
         page._descriptionSync.onAttributeEdited(dummy.Event())  # pragma: no cover
     else:
         page._subjectEntry.SetFocus()  # pragma: no cover
Exemple #14
0
 def testFileChanged_ButNoFilename(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.tasks().append(task.Task())
     self.autoSaver.on_idle(dummy.Event())
     self.failIf(self.taskFile.saveCalled)
Exemple #15
0
 def testFileChanged_ButAutoSaveOff(self):
     self.settings.set('file', 'autosave', 'False')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.tasks().append(task.Task())
     self.autoSaver.on_idle(dummy.Event())
     self.failIf(self.taskFile.saveCalled)
Exemple #16
0
 def testFileChanged_ButNoFilenameAndAutoSaveOff(self):
     self.taskFile.tasks().append(task.Task())
     self.autoSaver.on_idle(dummy.Event())
     self.failIf(self.taskFile.saveCalled)
Exemple #17
0
 def testMergeDoesTriggerAutoSave(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.merge('another-non-existing-file.tsk')
     self.autoSaver.on_idle(dummy.Event())
     self.assertEqual(1, self.taskFile.saveCalled)
Exemple #18
0
 def testSetFixedFee(self):
     self.editor._interior[5]._fixedFeeEntry.SetValue(100.5)
     self.editor._interior[5]._fixedFeeSync.onAttributeEdited(dummy.Event())
     self.assertEqual(100.5, self.task.fixedFee())
Exemple #19
0
 def testFileChanged(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.tasks().append(task.Task())
     self.autoSaver.on_idle(dummy.Event())
     self.assertEqual(1, self.taskFile.saveCalled)
Exemple #20
0
 def testBehaviorMarkCompleted(self):
     page = self.editor._interior[3]
     page._shouldMarkCompletedEntry.SetStringSelection('Yes')
     page._shouldMarkCompletedSync.onAttributeEdited(dummy.Event())
     self.assertEqual(True, 
                      self.task.shouldMarkCompletedWhenAllChildrenCompleted())
Exemple #21
0
 def testSaveAsDoesNotTriggerAutoSave(self):
     self.settings.set('file', 'autosave', 'True')
     self.taskFile.setFilename('whatever.tsk')
     self.taskFile.saveas('newfilename.tsk')
     self.autoSaver.on_idle(dummy.Event())
     self.assertEqual(1, self.taskFile.saveCalled)
Exemple #22
0
 def testInvalidEffort(self):    
     self.editor._interior._stopDateTimeEntry.SetValue(date.DateTime(1900, 1, 1))
     self.editor._interior.onDateTimeChanged(dummy.Event())
     self.failUnless(self.editor._interior._invalidPeriodMessage.GetLabel())
Exemple #23
0
 def testThatPickingAColoredFontChangesTheItemColor(self):
     self.appearance._fontEntry.SetColor(wx.RED)
     self.appearance._fontColorSync.onAttributeEdited(dummy.Event())
     self.assertEqual(wx.RED, self.item.foregroundColor())
Exemple #24
0
 def testChangeTaskDoesNotCloseEditor(self):
     self.editor._interior._taskEntry.SetValue(self.task2)
     self.editor._interior._taskSync.onAttributeEdited(dummy.Event())
     self.failIf(self.editor.editorClosed)
Exemple #25
0
 def testDontShowSameMessageTwice(self):
     dialog = self.checker.run(show=False)
     self.assertEqual('Message', dialog.current_message())
     dialog.on_close(dummy.Event())
     self.assertEqual(None, self.checker.run(show=False))