Example #1
0
 def testTomorrow(self):
     midnight = date.Tomorrow().startOfDay()
     self.task.addEffort(
         effort.Effort(self.task,
                       start=midnight,
                       stop=midnight + date.TWO_HOURS))
     self.expectNotInCSV('Tomorrow')
Example #2
0
 def testTaskWithFutureActualStartDateTime(self):
     tomorrow = date.Tomorrow()
     self.task1.setActualStartDateTime(tomorrow)
     self.markActive([self.task1])
     self.assertDoUndoRedo(
         lambda: self.assertAlmostEqual(date.Now().toordinal(), self.task1.actualStartDateTime().toordinal(), places=2),
         lambda: self.assertEqual(tomorrow, self.task1.actualStartDateTime()))
Example #3
0
 def testTaskWithFutureActualStartDateTime(self):
     tomorrow = date.Tomorrow()
     self.task1.setActualStartDateTime(tomorrow)
     self.markInactive([self.task1])
     self.assertDoUndoRedo(
         lambda: self.assertEqual(date.DateTime(), self.task1.actualStartDateTime()),
         lambda: self.assertEqual(tomorrow, self.task1.actualStartDateTime()))
Example #4
0
 def testMakeInactive(self):
     task2 = task.Task(subject='task2',
                       plannedStartDateTime=date.Now() - date.ONE_SECOND)
     self.taskList.extend([self.task, task2])
     self.assertItems(self.task, task2)
     self.task.setPlannedStartDateTime(date.Tomorrow())
     self.assertItems(task2, self.task)
Example #5
0
 def testUnschedule(self):
     futureDate = date.Tomorrow()
     self.scheduler.schedule(self.callback, futureDate)
     self.scheduler.unschedule(self.callback)
     self.failIf(self.scheduler.is_scheduled(self.callback))
     self.scheduler._process_jobs(futureDate)
     wx.Yield()
Example #6
0
 def testPlannedStartDateTimeTomorrow(self):
     tomorrow = date.Tomorrow()
     self.task.setPlannedStartDateTime(tomorrow)
     self.taskList.append(self.task)
     self.showColumn('plannedStartDateTime')
     self.assertEqual(
         _('Tomorrow %s') % render.time(tomorrow.time()),
         self.getItemText(0, 1))
Example #7
0
 def testCompletionDateTimeTomorrow(self):
     tomorrow = date.Tomorrow()
     self.task.setCompletionDateTime(tomorrow)
     self.taskList.append(self.task)
     self.showColumn('completionDateTime')
     self.assertEqual(
         _('Tomorrow %s') % render.time(tomorrow.time()),
         self.getItemText(0, 3))
Example #8
0
 def testCreateWithDate(self):
     tomorrow = date.Tomorrow()
     dateTimeEntry = entry.DateTimeEntry(self.frame,
                                         config.Settings(load=False),
                                         tomorrow)
     self.assertAlmostEqual(tomorrow.toordinal(),
                            dateTimeEntry.GetValue().toordinal(),
                            places=2)
Example #9
0
 def testMarkRecurringTaskCompleted_DueDateIsIncreased(self):
     self.task1.setRecurrence(date.Recurrence('weekly'))
     tomorrow = date.Tomorrow()
     self.task1.setDueDateTime(tomorrow)
     newDueDate = tomorrow + date.ONE_WEEK
     self.markCompleted([self.task1])
     self.assertDoUndoRedo(
         lambda: self.assertEqual(newDueDate, self.task1.dueDateTime()),
         lambda: self.assertEqual(tomorrow, self.task1.dueDateTime()))
Example #10
0
def dateFunc(dt=None, humanReadable=False):
    if humanReadable:
        theDate = dt.date()
        if theDate == datemodule.Now().date():
            return _('Today')
        elif theDate == datemodule.Yesterday().date():
            return _('Yesterday')
        elif theDate == datemodule.Tomorrow().date():
            return _('Tomorrow')
    return rawDateFunc(dt)
Example #11
0
 def fillContainers(self):
     # pylint: disable=W0201
     self.description = 'Description\nLine 2'
     self.task = task.Task(
         subject='Subject',
         description=self.description,
         plannedStartDateTime=date.Yesterday(),
         dueDateTime=date.Tomorrow(),
         actualStartDateTime=date.Now() - date.TimeDelta(hours=4),
         completionDateTime=date.Yesterday(),
         budget=date.ONE_HOUR,
         priority=4,
         hourlyFee=100.5,
         fixedFee=1000,
         recurrence=date.Recurrence('weekly',
                                    maximum=10,
                                    count=5,
                                    amount=2,
                                    stop_datetime=date.Now()),
         reminder=date.DateTime(2004, 1, 1),
         fgColor=wx.BLUE,
         bgColor=wx.RED,
         font=wx.NORMAL_FONT,
         expandedContexts=['viewer1'],
         icon='icon',
         selectedIcon='selectedIcon',
         percentageComplete=67,
         shouldMarkCompletedWhenAllChildrenCompleted=True)
     self.child = task.Task()
     self.task.addChild(self.child)
     self.grandChild = task.Task()
     self.child.addChild(self.grandChild)
     self.task.addEffort(
         effort.Effort(self.task,
                       start=date.DateTime(2004, 1, 1),
                       stop=date.DateTime(2004, 1, 2),
                       description=self.description))
     self.category = category.Category('test', [self.task],
                                       filtered=True,
                                       description='Description',
                                       exclusiveSubcategories=True)
     self.categories.append(self.category)
     # pylint: disable=E1101
     self.task.addAttachments(
         attachment.FileAttachment('/home/frank/whatever.txt'))
     self.task.addNote(note.Note(subject='Task note'))
     self.task2 = task.Task('Task 2', priority=-1954)
     self.taskList.extend([self.task, self.task2])
     self.note = note.Note(subject='Note',
                           description='Description',
                           children=[note.Note(subject='Child')])
     self.notes.append(self.note)
     self.category.addCategorizable(self.note)
     self.task.setModificationDateTime(date.DateTime(2012, 1, 1, 10, 9, 8))
Example #12
0
 def testStartTrackingInactiveTaskWithFutureActualStartDate(self):
     futureStartDateTime = date.Tomorrow()
     self.task2.setActualStartDateTime(futureStartDateTime)
     start = command.StartEffortCommand(self.taskList, [self.task2])
     start.do()
     now = date.Now()
     self.assertDoUndoRedo(
         lambda: self.
         failUnless(now - date.ONE_SECOND < self.task2.actualStartDateTime(
         ) < now + date.ONE_SECOND), lambda: self.assertEqual(
             futureStartDateTime, self.task2.actualStartDateTime()))
Example #13
0
 def testFilterInactiveTask_WhenPlannedStartDateTimePasses(self):
     plannedStart = date.Tomorrow()
     self.task.setPlannedStartDateTime(plannedStart)
     self.list.append(self.task)
     self.filter.hideTaskStatus(task.status.inactive)
     oldNow = date.Now
     now = plannedStart + date.ONE_SECOND
     date.Now = lambda: now
     self.task.onTimeToStart()
     self.assertFilterShows(self.task)
     date.Now = oldNow
Example #14
0
 def setUp(self):
     task.Task.settings = config.Settings(load=False)
     self.list = task.TaskList()
     self.filter = task.filter.ViewFilter(self.list, treeMode=self.treeMode)  # pylint: disable=E1101
     self.task = task.Task(subject='task')
     self.dueToday = task.Task(subject='due today',
                               dueDateTime=date.Now().endOfDay())
     self.dueTomorrow = task.Task(subject='due tomorrow',
                                  dueDateTime=date.Tomorrow().endOfDay())
     self.dueYesterday = task.Task(subject='due yesterday',
                                   dueDateTime=date.Yesterday().endOfDay())
     self.child = task.Task(subject='child')
Example #15
0
 def testSubstractTwoDates_MinusOneDifference(self):
     self.assertEqual(date.TimeDelta(days=-1),
                      date.Today() - date.Tomorrow())
Example #16
0
 def testTomorrow(self):
     self.assertEqual(date.Today() + date.oneDay, date.Tomorrow())
Example #17
0
 def testSortByPlannedStartDateTime(self):
     self.sorter.sortBy('plannedStartDateTime')
     self.task2.setPlannedStartDateTime(date.Tomorrow())
     self.task1.setPlannedStartDateTime(date.Now() + date.ONE_WEEK)
     self.assertEqual([self.task2, self.task1], list(self.sorter))
Example #18
0
 def testActualStartDateTimeTomorrow(self):
     tomorrow = date.Tomorrow()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Example #19
0
 def testAddDay(self):
     tomorrow = date.Today() + date.oneDay
     self.assertEqual(date.Tomorrow(), tomorrow)
     self.failUnless(isinstance(tomorrow, date.date.RealDate))
Example #20
0
 def testHideInactiveTasks_AffectsPresentation(self):
     self.viewer.presentation().append(
         task.Task(plannedStartDateTime=date.Tomorrow()))
     self.viewer.hideTaskStatus(task.status.inactive)
     self.failIf(self.viewer.presentation())
Example #21
0
 def testFilterInactiveTask_ChangePlannedStartDateTime(self):
     self.task.setPlannedStartDateTime(date.Tomorrow())
     self.list.append(self.task)
     self.filter.hideTaskStatus(task.status.inactive)
     self.task.setPlannedStartDateTime(date.Now() - date.ONE_SECOND)
     self.assertFilterShows(self.task)
Example #22
0
 def testInactiveTask(self):
     self.task.setPlannedStartDateTime(date.Tomorrow())
     fragment = '<tr class="inactive">' if self.filename else '<font color="#C0C0C0">Task subject</font>'
     self.expectInHTML(fragment)
Example #23
0
 def testCompletionDateTomorrow(self):
     tomorrow = date.Tomorrow().startOfDay()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Example #24
0
 def testChangeCompletionDateOfAlreadyCompletedTask(self):
     self.filter.hideTaskStatus(task.status.completed)
     self.task.setCompletionDateTime()
     self.list.append(self.task)
     self.task.setCompletionDateTime(date.Tomorrow())
     self.assertFilterIsEmpty()
Example #25
0
 def testDueDateTomorrow(self):
     tomorrow = date.Tomorrow().startOfDay()
     self.task.setDueDateTime(tomorrow)
     self.taskList.append(self.task)
     self.showColumn('dueDateTime')
     self.assertEqual(_('Tomorrow'), self.getItemText(0, 2))
Example #26
0
 def testUnhideInactiveTasks(self):
     self.viewer.presentation().append(
         task.Task(plannedStartDateTime=date.Tomorrow()))
     self.viewer.hideTaskStatus(task.status.inactive)
     self.viewer.hideTaskStatus(task.status.inactive, False)
     self.failUnless(self.viewer.presentation())
Example #27
0
 def testFilterInactiveTask(self):
     self.task.setPlannedStartDateTime(date.Tomorrow())
     self.list.append(self.task)
     self.filter.hideTaskStatus(task.status.inactive)
     self.assertFilterIsEmpty()