Ejemplo n.º 1
0
class TMultiPane(TestCase):

    def setUp(self):
        config.init()

        lib = SongLibrary()
        self.p2 = Pane(lib, "artist", self)
        self.p1 = Pane(lib, "genre", self.p2)
        self.last = None
        self.count = 0

    def fill(self, songs):
        # this class is the final pane
        self.last = songs
        self.count += 1

    def test_inhibit(self):
        self.p2.inhibit()
        self.p1.fill(SONGS)
        self.p2.uninhibit()
        self.assertEqual(self.count, 0)

    def test_pipe_through(self):
        self.p1.fill(SONGS)
        self.assertEqual(self.last, set(SONGS))
        self.assertEqual(self.count, 1)

    def test_filter_first(self):
        VALUE = "J-Pop"
        self.p1.fill(SONGS)
        keys = self.p1.list("genre")
        self.assertTrue(VALUE in keys)
        self.p1.set_selected([VALUE], force_any=False)
        self.assertTrue(self.last)
        for song in self.last:
            self.assertEqual(song("genre"), VALUE)
        self.assertEqual(self.count, 2)

    def tearDown(self):
        self.p1.destroy()
        self.p2.destroy()
        del self.p1
        del self.p2
        config.quit()
Ejemplo n.º 2
0
class TMultiPane(TestCase):

    def setUp(self):
        config.init()

        lib = SongLibrary()
        self.p2 = Pane(lib, "artist", self)
        self.p1 = Pane(lib, "genre", self.p2)
        self.last = None
        self.count = 0

    def fill(self, songs):
        # this class is the final pane
        self.last = songs
        self.count += 1

    def test_inhibit(self):
        self.p2.inhibit()
        self.p1.fill(SONGS)
        self.p2.uninhibit()
        self.assertEqual(self.count, 0)

    def test_pipe_through(self):
        self.p1.fill(SONGS)
        self.assertEqual(self.last, set(SONGS))
        self.assertEqual(self.count, 1)

    def test_filter_first(self):
        VALUE = "J-Pop"
        self.p1.fill(SONGS)
        keys = self.p1.list("genre")
        self.assertTrue(VALUE in keys)
        self.p1.set_selected([VALUE], force_any=False)
        self.assertTrue(self.last)
        for song in self.last:
            self.assertEqual(song("genre"), VALUE)
        self.assertEqual(self.count, 2)

    def tearDown(self):
        self.p1.destroy()
        self.p2.destroy()
        del self.p1
        del self.p2
        config.quit()