def test_disables_move_handler_when_event_ends_today(self): event = an_event_with(ends_today=True) time = human_time_to_py("1 Jan 2011") self.given_time_at_x_is(10, time) self.given_event_with_rect_at(10, 10, event, wx.Rect(0, 0, 20, 20)) self.given_event_selected(event) self.handler.left_mouse_down(10, 10, False, False) self.assertEquals(0, self.drawing_area.change_input_handler_to_move_by_drag.call_count)
def test_disables_mouse_cursor_when_event_ends_today(self): event = an_event_with(ends_today=True) time = human_time_to_py("1 Jan 2011") self.given_time_at_x_is(10, time) self.given_event_with_rect_at(10, 10, event, wx.Rect(0, 0, 20, 20)) self.given_event_selected(event) self.handler.mouse_moved(10, 10) self.assertEquals(0, self.view.set_move_cursor.call_count)
def test_time_cant_change_when_event_is_locked(self): self.when_editor_opened_with_event(an_event_with(time="1 Jan 2010")) self.simulate_user_enters_start_time("2 Jan 2011 12:00") self.simulate_user_enters_end_time("1 Jan 2011 12:00") self.view.get_locked.return_value = True self.simulate_user_clicks_ok() self.view.display_invalid_start.assert_called_with( _("You can't change time when the Event is locked")) self.assert_no_event_saved()
def test_disables_move_handler_when_event_ends_today(self): event = an_event_with(ends_today=True) time = human_time_to_py("1 Jan 2011") self.given_time_at_x_is(10, time) self.given_event_with_rect_at(10, 10, event, wx.Rect(0, 0, 20, 20)) self.given_event_selected(event) self.handler.left_mouse_down(10, 10, False, False) self.assertEquals( 0, self.drawing_area.change_input_handler_to_move_by_drag.call_count)
def a_point_event(self, time): event = an_event_with(time=time) self.selected_events.append(event) return event
def test_clears_status_message_if_resize_is_valid(self): self.given_time_at_x_is(50, "2 Jan 2000") self.when_resizing(an_event_with(time="1 Jan 2000"), wx.RIGHT) self.and_moving_mouse_to_x(50) self.status_bar.set_text.assert_called_with("")
def test_indicates_a_too_long_event_in_status_bar(self): self.given_time_at_x_is(50, "1 Jan 5000") self.when_resizing(an_event_with(time="1 Jan 2000"), wx.RIGHT) self.and_moving_mouse_to_x(50) self.assertEquals(1, self.status_bar.set_text.call_count)
def test_updates_period_on_event(self): self.given_time_at_x_is(50, "31 Aug 2010") self.when_resizing(an_event_with(time="1 Jan 2010"), wx.RIGHT) self.and_moving_mouse_to_x(50) self.then_event_gets_period("1 Jan 2010", "31 Aug 2010")
def a_period_event(self, start, end): event = an_event_with(start=start, end=end) self.selected_events.append(event) return event
def setUp(self): EventEditorTestCase.setUp(self) self.when_editor_opened_with_event(an_event_with(time="1 Jan 2010"))
def test_is_hidden_when_editing_existing_event(self): self.when_editor_opened_with_event(an_event_with(time="1 Jan 2010")) self.view.set_show_add_more.assert_called_with(False)