rind: Fix up add library button test

I was having some problems with this test, so hopefully it's more
reliable this way.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2019-04-01 14:04:22 -04:00
parent a3fa8f1526
commit 71c77d0d09
1 changed files with 12 additions and 10 deletions

View File

@ -167,28 +167,30 @@ class TestManager(unittest.TestCase):
self.assertFalse(manager.LibraryPopover.is_visible())
manager.LibraryAdd.clicked()
time.sleep(0.2)
while Gtk.events_pending(): Gtk.main_iteration_do(True)
Gtk.main_iteration_do(True)
self.assertTrue(manager.LibraryPopover.is_visible())
self.assertEqual(len(plist_mgr["Library"]), 0)
manager.LibraryCancel.clicked()
time.sleep(0.2)
while Gtk.events_pending(): Gtk.main_iteration_do(True)
while Gtk.events_pending():
time.sleep(0.05)
Gtk.main_iteration_do(True)
self.assertFalse(manager.LibraryPopover.is_visible())
self.assertEqual(len(plist_mgr["Library"]), 0)
manager.LibraryAdd.clicked()
time.sleep(0.2)
while Gtk.events_pending(): Gtk.main_iteration_do(True)
self.assertTrue(manager.LibraryPopover.is_visible())
Gtk.main_iteration_do(True)
self.assertEqual(manager.LibraryChooser.get_filename(), music_dir)
self.assertTrue(manager.LibraryPopover.is_visible())
self.assertEqual(len(plist_mgr["Library"]), 0)
manager.LibraryChooser.set_filename(test_album1)
while Gtk.events_pending(): Gtk.main_iteration_do(True)
self.assertEqual(manager.LibraryChooser.get_filename(), test_album1)
manager.LibraryOk.clicked()
time.sleep(0.2)
while Gtk.events_pending(): Gtk.main_iteration_do(True)
self.assertFalse(manager.LibraryPopover.is_visible())
while Gtk.events_pending():
time.sleep(0.05)
Gtk.main_iteration_do(True)
self.assertEqual(len(plist_mgr["Library"]), 1)
self.assertFalse(manager.LibraryPopover.is_visible())