Exemple #1
0
 def test_combobox_entry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     # might cause a Pango warning, do not break on this
     old_mask = GLib.log_set_always_fatal(GLib.LogLevelFlags.LEVEL_CRITICAL
                                          | GLib.LogLevelFlags.LEVEL_ERROR)
     try:
         combo = gtk.ComboBoxEntry(model=liststore)
     finally:
         GLib.log_set_always_fatal(old_mask)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
 def testComboBoxEntry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     # might cause a Pango warning, do not break on this
     old_mask = GLib.log_set_always_fatal(
         GLib.LogLevelFlags.LEVEL_CRITICAL | GLib.LogLevelFlags.LEVEL_ERROR)
     combo = gtk.ComboBoxEntry(model=liststore)
     GLib.log_set_always_fatal(old_mask)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
 def testComboBoxEntry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     combo = gtk.ComboBoxEntry(model=liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEquals(combo.get_text_column(), 1)
     self.assertEquals(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEquals(combo.get_text_column(), 1)
     self.assertEquals(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEquals(combo.get_text_column(), 1)
     self.assertEquals(combo.get_child().get_text(), 'One')
Exemple #4
0
 def testComboBoxEntry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     combo = gtk.ComboBoxEntry(model=liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
 def test_combobox_entry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     # might cause a Pango warning, do not break on this
     with capture_glib_warnings(allow_warnings=True):
         combo = gtk.ComboBoxEntry(model=liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
 def test_combobox_entry(self):
     liststore = gtk.ListStore(int, str)
     liststore.append((1, 'One'))
     liststore.append((2, 'Two'))
     liststore.append((3, 'Three'))
     # might cause a Pango warning, do not break on this
     with capture_glib_warnings(allow_warnings=True):
         combo = gtk.ComboBoxEntry(model=liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new()
     combo.set_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')
     combo = gtk.combo_box_entry_new_with_model(liststore)
     combo.set_text_column(1)
     combo.set_active(0)
     self.assertEqual(combo.get_text_column(), 1)
     self.assertEqual(combo.get_child().get_text(), 'One')