Esempio n. 1
0
 def test_set_max_width_chars(self):
     with visible(Entry()) as e:
         e.set_max_width_chars(4)
         nat1 = e.get_preferred_width()[1]
         e.set_max_width_chars(40)
         nat2 = e.get_preferred_width()[1]
         self.assertTrue(nat1 < nat2)
Esempio n. 2
0
 def test_set_max_width_chars(self):
     with visible(Entry()) as e:
         e.set_max_width_chars(4)
         nat1 = e.get_preferred_width()[1]
         e.set_max_width_chars(40)
         nat2 = e.get_preferred_width()[1]
         self.assertTrue(nat1 < nat2)
Esempio n. 3
0
 def test_visible_pre_setup_children(self):
     p = self.Kind()
     p.pack1(Gtk.Button())
     p.pack2(Gtk.Button())
     p.set_relative(0.75)
     self.failUnlessEqual(p.get_relative(), 0.75)
     with visible(p, width=200, height=200) as p:
         self.failUnlessAlmostEqual(p.get_relative(), 0.75, 2)
Esempio n. 4
0
 def test_visible_pre_setup_children(self):
     p = self.Kind()
     p.pack1(Gtk.Button())
     p.pack2(Gtk.Button())
     p.set_relative(0.75)
     self.failUnlessEqual(p.get_relative(), 0.75)
     with visible(p, width=200, height=200) as p:
         self.failUnlessAlmostEqual(p.get_relative(), 0.75, 2)
Esempio n. 5
0
    def test_create_drag_icon(self):
        model = self.c.get_model()
        all_paths = [row.path for row in model]

        self.assertFalse(self.c.create_multi_row_drag_icon(all_paths, 1))
        with visible(self.c):
            self.assertTrue(self.c.create_multi_row_drag_icon(all_paths, 1))
            self.assertFalse(self.c.create_multi_row_drag_icon([], 1))
            self.assertTrue(
                self.c.create_multi_row_drag_icon([all_paths[0]], 10))
Esempio n. 6
0
    def test_create_drag_icon(self):
        model = self.c.get_model()
        all_paths = [row.path for row in model]

        self.assertFalse(self.c.create_multi_row_drag_icon(all_paths, 1))
        with visible(self.c):
            self.assertTrue(self.c.create_multi_row_drag_icon(all_paths, 1))
            self.assertFalse(self.c.create_multi_row_drag_icon([], 1))
            self.assertTrue(
                self.c.create_multi_row_drag_icon([all_paths[0]], 10))
Esempio n. 7
0
    def test_popup(self):
        menu = Gtk.Menu()
        selection = self.c.get_selection()
        selection.set_mode(Gtk.SelectionMode.MULTIPLE)

        with visible(self.c):
            # the popup only shows if the underlying row is selected,
            # so select all first
            selection.select_all()
            self.assertTrue(self.c.popup_menu(menu, Gdk.BUTTON_SECONDARY, 0))
Esempio n. 8
0
    def test_popup(self):
        menu = Gtk.Menu()
        selection = self.c.get_selection()
        selection.set_mode(Gtk.SelectionMode.MULTIPLE)

        with visible(self.c):
            # the popup only shows if the underlying row is selected,
            # so select all first
            selection.select_all()
            self.assertTrue(self.c.popup_menu(menu, Gdk.BUTTON_SECONDARY, 0))
    def _render_column(self, column, **kwargs):
        view = Gtk.TreeView()
        model = ObjectStore()
        view.set_model(model)
        song = AudioFile({"~filename": "/dev/null"})
        song.update(kwargs)
        model.append(row=[song])
        view.append_column(column)
        if column.get_resizable():
            column.set_expand(True)

        with visible(view):
            view.columns_autosize()
Esempio n. 10
0
    def test_basic(self):
        self.failUnless(config.get("memory", "foobar", None) is None)

        p = x.ConfigRVPaned("memory", "foobar", 0.75)
        p.pack1(Gtk.Button())
        p.pack2(Gtk.Button())

        with visible(p, width=200, height=200) as p:
            self.failUnlessAlmostEqual(p.get_relative(), 0.75, 2)
            p.props.position = 20
            self.failUnlessAlmostEqual(p.get_relative(), 0.10, 2)

        config_value = config.getfloat("memory", "foobar")
        self.failUnlessAlmostEqual(config_value, 0.10, 2)
Esempio n. 11
0
    def test_basic(self):
        self.failUnless(config.get("memory", "foobar", None) is None)

        p = x.ConfigRVPaned("memory", "foobar", 0.75)
        p.pack1(Gtk.Button())
        p.pack2(Gtk.Button())

        with visible(p, width=200, height=200) as p:
            self.failUnlessAlmostEqual(p.get_relative(), 0.75, 2)
            p.props.position = 20
            self.failUnlessAlmostEqual(p.get_relative(), 0.10, 2)

        config_value = config.getfloat("memory", "foobar")
        self.failUnlessAlmostEqual(config_value, 0.10, 2)
Esempio n. 12
0
    def _render_column(self, column, **kwargs):
        view = Gtk.TreeView()
        model = PlaylistModel()
        view.set_model(model)
        song = AudioFile({"~filename": "/dev/null", "~#rating": 0.6666})
        song.update(kwargs)
        model.append(row=[song])
        view.append_column(column)
        if column.get_resizable():
            column.set_expand(True)

        with visible(view):
            view.columns_autosize()

        text = column.get_cells()[0].get_property("text")
        self.assertIsNot(text, None)
        return text
Esempio n. 13
0
 def test_visible_pre_setup_empty(self):
     p = self.Kind()
     p.set_relative(0.75)
     self.failUnlessEqual(p.get_relative(), 0.75)
     with visible(p) as p:
         self.failUnlessEqual(p.get_relative(), 0.75)
Esempio n. 14
0
 def test_right_click(self):
     with visible(self.c):
         send_button_click(self.c, Gdk.BUTTON_SECONDARY)
         send_button_click(self.c, Gdk.BUTTON_SECONDARY, primary=True)
Esempio n. 15
0
 def test_click(self):
     with visible(self.c):
         send_button_click(self.c, Gdk.BUTTON_PRIMARY)
         send_button_click(self.c, Gdk.BUTTON_PRIMARY, primary=True)
Esempio n. 16
0
 def test_click(self):
     with visible(self.c):
         send_button_click(self.c, Gdk.BUTTON_PRIMARY)
         send_button_click(self.c, Gdk.BUTTON_PRIMARY, ctrl=True)
Esempio n. 17
0
 def test_visible_pre_setup_empty(self):
     p = self.Kind()
     p.set_relative(0.75)
     self.failUnlessEqual(p.get_relative(), 0.75)
     with visible(p) as p:
         self.failUnlessEqual(p.get_relative(), 0.75)
Esempio n. 18
0
 def test_right_click(self):
     with visible(self.c):
         send_button_click(self.c, Gdk.BUTTON_SECONDARY)
         send_button_click(self.c, Gdk.BUTTON_SECONDARY, ctrl=True)
Esempio n. 19
0
 def test_visible_no_setup(self):
     p = self.Kind()
     with visible(p):
         pass
Esempio n. 20
0
 def test_key_events(self):
     with visible(self.c):
         send_key_click(self.c, "<ctrl>Right")
         send_key_click(self.c, "<ctrl>Left")
Esempio n. 21
0
 def test_visible_no_setup(self):
     p = self.Kind()
     with visible(p):
         pass
Esempio n. 22
0
 def test_key_events(self):
     with visible(self.c):
         send_key_click(self.c, "<Primary>Right")
         send_key_click(self.c, "<Primary>Left")
Esempio n. 23
0
 def test_key_events(self):
     with visible(self.c):
         send_key_click(self.c, "<ctrl>Right")
         send_key_click(self.c, "<ctrl>Left")