Exemple #1
0
    def test_checkbutton_state(self):
        """Test a checkbutton that controls another widgets."""

        TOOLTIP = "Disabled"
        manager = gui.StateManager()
        checkbutton = CheckButtonStub()
        widget = WidgetStub()
        self.assertTrue(widget.sensitive)
        self.assertEqual(widget.tooltip, "")
        manager.add_checkbutton_active(checkbutton, TOOLTIP, widget)
        self.assertFalse(widget.sensitive)
        self.assertEqual(widget.tooltip, TOOLTIP)
Exemple #2
0
    def test_checkbutton_nonactive(self):
        """Enable a widget if the checkbutton is not active."""

        TOOLTIP = "Disabled"
        manager = gui.StateManager()
        checkbutton = CheckButtonStub()
        widget = WidgetStub()
        self.assertTrue(widget.sensitive)
        self.assertEqual(widget.tooltip, "")
        manager.add_checkbutton_not_active(checkbutton, TOOLTIP, widget)
        self.assertTrue(widget.sensitive)
        self.assertEqual(widget.tooltip, "")
        checkbutton.set_active(True)
        self.assertFalse(widget.sensitive)
        self.assertEqual(widget.tooltip, TOOLTIP)