class KittyTabWidgetTestCase(unittest.TestCase): def setUp(self): self.app = QApplication([]) self.tab_widget = KittyTabWidget() self.app.setMainWidget(self.tab_widget) self.tab_widget.show() #1 self.board1 = Board("1","1","1") self.tab_widget._display(self.board1, [], True) self.tab_widget._reduce_queue() #2 self.board2 = Board("2","2","2") self.tab_widget._display(self.board2, [], True) self.tab_widget._reduce_queue() def tearDown(self): self.app.exit()
class TopicListWidgetTestCase(unittest.TestCase): def setUp(self): self.app = QApplication([]) self.topic_list_widget = TopicListWidget() self.app.setMainWidget(self.topic_list_widget) self.topic_list_widget.show() #1 self.board1 = Board("1","1","1") self.topic_list_widget.display(self.board1, [], True) self.topic_list_widget._tab_widget._reduce_queue() #2 self.board2 = Board("2","2","2") self.topic_list_widget.display(self.board2, [], True) self.topic_list_widget._tab_widget._reduce_queue() def tearDown(self): self.app.mainWidget().close() self.app.exit() def test_current_board(self): self.assertEqual(self.topic_list_widget.current_board(), self.board2) def test_has_model_true(self): has_model = self.topic_list_widget._tab_widget.has_model self.failUnless(has_model(self.board2)) def test_has_model_false(self): board3 = Board("3","3","3") has_model = self.topic_list_widget._tab_widget.has_model self.failIf(has_model(board3)) def test_view(self): b = self.board2 tabwidget = self.topic_list_widget._tab_widget self.assertEqual(tabwidget._model_view_registry.view(b), tabwidget.view(b))