def test_search_button_created(self, patch_tk): with self.movie_context() as movie_gui: button = movie_gui.parent.children[0].children[1].children[0] assert button == TtkButton(parent=TtkFrame( parent=TtkFrame(parent=DummyTk()), padding=(5, 5, 10, 10)), text='Search', command=movie_gui.search)
def test_delete_button_created(self, patch_tk, class_fixtures): with self.movie_context() as movie_gui: button = movie_gui.parent.children[0].children[1].children[1] assert button == TtkButton(parent=TtkFrame( parent=TtkFrame(parent=DummyTk()), padding=(5, 5, 10, 10)), text='Delete', command=movie_gui.delete)
def test_create_entry_creates_ttk_entry(self, patch_tk): with self.movie_context() as movie_gui: assert movie_gui.entry_fields['title'].widget == TtkEntry( parent=TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), textvariable=TkStringVar(), width=36)
def test_min_max_body_item_frame_created(self, patch_tk): with self.movie_context() as movie_gui: outerframe = movie_gui.parent.children[0] body_frame = outerframe.children[0] year_max_min_frame = body_frame.children[3] assert year_max_min_frame == TtkFrame(parent=TtkFrame( parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), padding=(2, 0))
def test_min_max_body_item_ttk_label_called(self, patch_tk): with self.movie_context() as movie_gui: outerframe = movie_gui.parent.children[0] body_frame = outerframe.children[0] year_label = body_frame.children[2] assert year_label == TtkLabel(parent=TtkFrame( parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), text='Year (min, max)', padding='')
def test_body_item_ttk_label_called(self, patch_tk): with self.movie_context() as movie_gui: outerframe = movie_gui.parent.children[0] body_frame = outerframe.children[0] first_label = body_frame.children[0] assert first_label == TtkLabel(parent=TtkFrame( parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), text='Title', padding='')
def test_treeview_called(self, patch_tk): with self.select_movie_context() as movie_gui: outerframe = movie_gui.parent.children[0] bodyframe = outerframe.children[0] treeview = bodyframe.children[0] assert treeview == TtkTreeview( parent=TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), columns=('year', 'director', 'minutes', 'notes'), height=25, selectmode='browse')
def test_create_tag_treeview_called(self, patch_tk, patch_movie_treeview): with self.movie_context(): assert treeview_call[0][1] == guiwidgets.TAG_TREEVIEW_INTERNAL_NAME assert treeview_call[0][2] == TtkFrame(parent=TtkFrame( parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)) assert treeview_call[0][3] == 5 assert treeview_call[0][4] == 0 assert treeview_call[0][5] == 'Select tags' assert treeview_call[0][6] == ('test tag 1', 'test tag 2') assert treeview_call[0][7]('test signal') == 'test signal'
def test_focus_set_on_title_field(self, patch_tk, monkeypatch): calls = [] monkeypatch.setattr(guiwidgets, 'focus_set', lambda *args: calls.append(args)) with self.movie_context(): assert calls == [ (TtkEntry(parent=TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), textvariable=TkStringVar(), width=36), ) ]
def test_create_min_max_body_item_called(self, patch_tk, monkeypatch): calls = [] monkeypatch.setattr(guiwidgets.SearchMovieGUI, 'create_min_max_body_item', lambda *args: calls.append(args)) with self.movie_context() as movie_gui: assert calls == [ (movie_gui, TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), 'year', 'Year', 1), (movie_gui, TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), 'minutes', 'Length (minutes)', 3), ]
def test_create_simple_body_item_called(self, patch_tk, monkeypatch): calls = [] monkeypatch.setattr(guiwidgets.SearchMovieGUI, 'create_body_item', lambda *args: calls.append(args)) monkeypatch.setattr(guiwidgets, 'focus_set', lambda *args: None) with self.movie_context() as movie_gui: assert calls == [ (movie_gui, TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), 'title', 'Title', 0), (movie_gui, TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), 'director', 'Director', 2), (movie_gui, TtkFrame(parent=TtkFrame(parent=DummyTk(), padding=''), padding=(10, 25, 10, 0)), 'notes', 'Notes', 4), ]
def test_buttonbox_created(self, patch_tk): with self.select_movie_context() as movie_gui: outerframe = movie_gui.parent.children[0] buttonbox = outerframe.children[1] assert buttonbox == TtkFrame(parent=outerframe, padding=(5, 5, 10, 10))