class TToggledPlayOrderMenu(TestCase):

    def setUp(self):
        self.orders = Orders([OrderShuffle, OrderWeighted, FakeOrder])
        self.tpom = ToggledPlayOrderMenu(Icons.AUDIO_X_GENERIC,
                                         orders=self.orders,
                                         current_order=OrderShuffle,
                                         enabled=True)

    def tearDown(self):
        self.tpom.destroy()

    def test_enabled_initially(self):
        self.failUnless(self.tpom.enabled)

    def test_setting_enabled(self):
        self.tpom.enabled = False
        self.failIf(self.tpom.enabled)
        self.tpom.enabled = True
        self.failUnless(self.tpom.enabled)

    def test_initial(self):
        self.failUnlessEqual(self.tpom.current, OrderShuffle)

    def test_unknown_name(self):
        self.assertRaises(ValueError, self.tpom.set_active_by_name, "foobar")

    def test_set_by_name(self):
        self.tpom.set_active_by_name("fake")
        self.failUnlessEqual(self.tpom.current.name, "fake")

    def test_get_name(self):
        for order in self.orders:
            self.tpom.current = order
            self.failUnlessEqual(self.tpom.current, order)

    def test_set_orders(self):
        self.tpom.set_orders([])
        self.failIf(self.tpom.current)
Example #2
0
class TToggledPlayOrderMenu(TestCase):
    def setUp(self):
        self.orders = Orders([OrderShuffle, OrderWeighted, FakeOrder])
        self.tpom = ToggledPlayOrderMenu(Icons.AUDIO_X_GENERIC,
                                         orders=self.orders,
                                         current_order=OrderShuffle,
                                         enabled=True)

    def tearDown(self):
        self.tpom.destroy()

    def test_enabled_initially(self):
        self.failUnless(self.tpom.enabled)

    def test_setting_enabled(self):
        self.tpom.enabled = False
        self.failIf(self.tpom.enabled)
        self.tpom.enabled = True
        self.failUnless(self.tpom.enabled)

    def test_initial(self):
        self.failUnlessEqual(self.tpom.current, OrderShuffle)

    def test_unknown_name(self):
        self.assertRaises(ValueError, self.tpom.set_active_by_name, "foobar")

    def test_set_by_name(self):
        self.tpom.set_active_by_name("fake")
        self.failUnlessEqual(self.tpom.current.name, "fake")

    def test_get_name(self):
        for order in self.orders:
            self.tpom.current = order
            self.failUnlessEqual(self.tpom.current, order)

    def test_set_orders(self):
        self.tpom.set_orders([])
        self.failIf(self.tpom.current)
Example #3
0
 def setUp(self):
     self.orders = Orders([OrderShuffle, OrderWeighted, FakeOrder])
     self.tpom = ToggledPlayOrderMenu(Icons.AUDIO_X_GENERIC,
                                      orders=self.orders,
                                      current_order=OrderShuffle,
                                      enabled=True)
 def setUp(self):
     self.orders = Orders([OrderShuffle, OrderWeighted, FakeOrder])
     self.tpom = ToggledPlayOrderMenu(Icons.AUDIO_X_GENERIC,
                                      orders=self.orders,
                                      current_order=OrderShuffle,
                                      enabled=True)