Beispiel #1
0
 def setUp(self):
     """Do the test basic setup."""
     data = {"label": _("Type"), "name":"type", "value": 13}
     self.field = IntField(data, self.callback)
     value = self.field.get_value()
     assert response == 13
     value = 65590
     selt.field.set_value(value)
     assert value == self.field.get_value()
     value = -65590
     selt.field.set_value(value)
     assert value == self.field.get_value()
     value = 6.5
     selt.field.set_value(value)
     assert value == self.field.get_value()
Beispiel #2
0
class TestIntField(TestCase):
    def setUp(self):
        """Do the test basic setup."""
        data = {"label": ("Type"), "name": "type", "value": 13}
        self.intfield = IntField(data, self)

    # ----------------------------------------------------------------------
    def test_get_value(self):
        self.assertTrue(self.intfield.get_value())

    # ----------------------------------------------------------------------
    def test_set_value(self):

        value = -65590
        self.assertIsNone(self.intfield.set_value(value))
        value = 65590
        self.assertIsNone(self.intfield.set_value(value))
        value = 6.5
        self.assertIsNone(self.intfield.set_value(value))
        value = 9223372036854775807
        self.assertIsNone(self.intfield.set_value(value))
        value = 0
        self.assertIsNone(self.intfield.set_value(value))
        value = 9223372036854775808
        self.assertIsNone(self.intfield.set_value(value))
Beispiel #3
0
    def __create_grid_preferences_tab(self):
        vbox = Gtk.VBox()
        self.grid_preferences_tab.add(vbox)

        data = {"label": _("Grid size"), "value": self.properties.grid}
        self.grid = IntField(data, None)
        vbox.add(self.grid)

        self.grid_preferences_tab.show_all()
Beispiel #4
0
    def __create_grid_preferences_tab(self):
        vbox = Gtk.VBox()
        self.grid_preferences_tab.pack_start(vbox, True, True, 0)

        data = {"label": _("Grid size"), "value": self.properties.grid}
        self.grid = IntField(data, None)
        vbox.pack_start(self.grid, False, True, 0)

        self.grid_preferences_tab.show_all()
Beispiel #5
0
    def __create_network_preferences_tab(self):
        """Creates the networks preferences tab."""
        vbox = Gtk.VBox()
        self.network_preferences_tab.add(vbox)

        data = {"label": _("Web Server Port"), "value": self.properties.port, "lower": 1024, "upper": 49151}
        self.port = IntField(data, None)
        vbox.add(self.port)

        self.network_preferences_tab.show_all()
Beispiel #6
0
class TestIntField(TestCase):

    def setUp(self):
        """Do the test basic setup."""
        data = {"label": _("Type"), "name":"type", "value": 13}
        self.field = IntField(data, self.callback)
        value = self.field.get_value()
        assert response == 13
        value = 65590
        selt.field.set_value(value)
        assert value == self.field.get_value()
        value = -65590
        selt.field.set_value(value)
        assert value == self.field.get_value()
        value = 6.5
        selt.field.set_value(value)
        assert value == self.field.get_value()

    # ----------------------------------------------------------------------
    def callback(self, widget=None, data=None):
        pass
Beispiel #7
0
class TestIntField(unittest.TestCase):
    def setUp(self):
        IntField(None, None)
        self.field = IntField({"label": "test", "value": 1}, None)
        self.field = IntField({"label": "test", "value": 0}, None)
        self.field = IntField({}, self.test_value)

    def test_value(self):
        value1 = 0
        self.field.set_value(value1)
        value2 = self.field.get_value()
        self.assertEqual(value1, value2, 'incorrect value')
        value1 = 100
        self.field.set_value(value1)
        value2 = self.field.get_value()
        self.assertEqual(value1, value2, 'incorrect value')
Beispiel #8
0
 def setUp(self):
     IntField(None, None)
     self.field = IntField({"label": "test", "value": 1}, None)
     self.field = IntField({"label": "test", "value": 0}, None)
     self.field = IntField({}, self.test_value)
Beispiel #9
0
 def setUp(self):
     """Do the test basic setup."""
     data = {"label": ("Type"), "name": "type", "value": 13}
     self.intfield = IntField(data, self)