def test_paste(self): event = get_event('ctrl-c', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) # focus out event for widget[2,1] event = get_event('Right', 'entrygrid', 2, 1, '10') self.ui.entrygrid.widgets[2][1].highlight(event) # move right and focus in event for widget[4,1] event = get_event('Right', 'entrygrid', 1, 4) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[1][4].highlight(event) # focus out event for widget[4,1] self.ui.entrygrid.widgets[1][4].focus_set() self._focus_force(self.ui.entrygrid.widgets[1][4]) event = get_event('ctrl-v', 'entrygrid', 1, 4, '2') self.ui.entrygrid.modeset(event) compare_list = [(1, 1), (1, 4)], [(2, 1), (2, 4)], [(1, 2), (1, 5)], [(2, 2), (2, 5)] self.ui.update() for compare in compare_list: ox, oy = compare[0] tx, ty = compare[1] self.assertEquals(self.ui.entrygrid.widgets[ox][oy].sv.get(), self.ui.entrygrid.widgets[tx][ty].sv.get())
def test_clear(self): event = get_event('ctrl-c', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) compare_list = [[(1, 1), (1, 2), (2, 1), (2, 2)]] self.assertEquals(self.ui.entrygrid.clipboard, compare_list) event = get_event('ctrl-R', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) self.assertEquals(self.ui.entrygrid.clipboard, [])
def test_copy(self): event = get_event('ctrl-c', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) self.assertListEqual(self.ui.entrygrid.clipboard, [[(1, 1), (1, 2), (2, 1), (2, 2)]])
def test_rightarrow_moveright(self): # move right and focus in event for widget[1,2] event = get_event('Right', 'entrygrid', 1, 1) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[1][2].highlight(event) self._focus_force(self.ui.entrygrid.widgets[1][2]) _, new_x, new_y = str(self.parent_widget.focus_get()).split(",") self.assertEqual(new_x, '1') self.assertEqual(new_y, '2')
def test_clear(self): compare_list = [(1, 1), (1, 2), (2, 1), (2, 2)] for x, y in compare_list: self.assertTrue(self.ui.entrygrid.widgets[x][y].copy_state) event = get_event('ctrl-r', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) for x, y in compare_list: self.assertEquals(self.ui.entrygrid.widgets[x][y]['style'], 'OutOfFocus.Invalid.TCombobox') self.assertFalse(self.ui.entrygrid.widgets[x][y].copy_state)
def setUp(self): Test_Base.setUp(self, 'test_sswizard_grid', 'test_quadref') self.ui.load(2) # initial focus set on widget[1,1] self.ui.entrygrid.widgets[1][1].focus_set() # set select mode event = get_event('ctrl-s', 'entrygrid', 1, 1) self.ui.entrygrid.modeset(event) # focus out event for widget[1,1] event = get_event('Right', 'entrygrid', 1, 1, '10') self.ui.entrygrid.widgets[1][1].highlight(event) # move right and focus in event for widget[1,2] event = get_event('Right', 'entrygrid', 1, 1) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[1][2].highlight(event) # focus out event for widget[1,2] event = get_event('Down', 'entrygrid', 1, 2, '10') self.ui.entrygrid.widgets[1][2].highlight(event) # focus in event for widget[2,2] event = get_event('Down', 'entrygrid', 1, 2) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[2][2].highlight(event) # focus out event for widget[2,2] event = get_event('Left', 'entrygrid', 2, 2, '10') self.ui.entrygrid.widgets[2][2].highlight(event) # focus in event for widget[2,1] event = get_event('Left', 'entrygrid', 2, 2) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[2][1].highlight(event) # focus out event for widget[2,1] # note that im not sure why this focus out event is required for the test # to work as it does not seem to behave that way at normal runtime event = get_event('Left', 'entrygrid', 2, 1, '10') self.ui.entrygrid.widgets[2][1].highlight(event) self.ui.update()
def setUp(self): Test_Base.setUp(self, 'test_sswizard_grid', 'test_quadref') self.ui.load(2) # initial focus set on widget[1,1] self.ui.entrygrid.widgets[1][1].focus_set() # set select mode event = get_event('ctrl-s', 'entrygrid', 1, 1) self.ui.entrygrid.modeset(event) # focus out event for widget[1,1] event = get_event('Down', 'entrygrid', 1, 1, '10') self.ui.entrygrid.widgets[1][1].highlight(event) # move right and focus in event for widget[2,1] event = get_event('Down', 'entrygrid', 1, 1) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[2][1].highlight(event) event = get_event('ctrl-c', 'entrygrid', 2, 1, '2') self.ui.entrygrid.modeset(event) # initial focus set on widget[1,2] self.ui.entrygrid.widgets[1][2].focus_set() event = get_event('ctrl-s', 'entrygrid', 1, 2) self.ui.entrygrid.modeset(event) # focus out event for widget[1,1] event = get_event('Down', 'entrygrid', 1, 2, '10') self.ui.entrygrid.widgets[1][1].highlight(event) # move right and focus in event for widget[2,1] event = get_event('Down', 'entrygrid', 1, 2) self.ui.entrygrid.refocus(event) self.ui.entrygrid.widgets[2][2].highlight(event) event = get_event('ctrl-c', 'entrygrid', 2, 2, '2') self.ui.entrygrid.modeset(event)