def test_installedpane(self): from softwarecenter.ui.gtk3.panes.installedpane import get_test_window win = get_test_window() pane = win.get_data("pane") # ensure it visible self.assertTrue(pane.get_property("visible")) # ensure the treeview is there and has data self._p() self.assertTrue(len(pane.treefilter.get_model()) > 5) # schedule close GObject.timeout_add(TIMEOUT, lambda: win.destroy()) Gtk.main()
def test_custom_lists(self): from softwarecenter.ui.gtk3.panes.availablepane import get_test_window win = get_test_window() pane = win.get_data("pane") self._p() pane.on_search_terms_changed(None, "ark,artha,software-center") self._p() model = pane.app_view.tree_view.get_model() # custom list should return three items self.assertTrue(len(model) == 3) # check package names, ordering is default "by relevance" self.assertPkgInListAtIndex(0, model, "ark") self.assertPkgInListAtIndex(1, model, "software-center") self.assertPkgInListAtIndex(2, model, "artha") # check that the status bar offers to install the packages install_button = pane.action_bar.get_button(ActionButtons.INSTALL) self.assertNotEqual(install_button, None) GObject.timeout_add(TIMEOUT, lambda: win.destroy()) Gtk.main()
setup_test_env() # overwrite early import softwarecenter.utils from softwarecenter.enums import TransactionTypes from softwarecenter.utils import convert_desktop_file_to_installed_location from softwarecenter.db.application import Application from softwarecenter.ui.gtk3.panes.availablepane import get_test_window from softwarecenter.backend.unitylauncher import UnityLauncherInfo # Tests for Ubuntu Software Center's integration with the Unity launcher, # see https://wiki.ubuntu.com/SoftwareCenter#Learning%20how%20to%20launch%20an%20application # we can only have one instance of availablepane, so create it here win = get_test_window() available_pane = win.get_data("pane") class TestUnityLauncherIntegration(unittest.TestCase): def setUp(self): # monkey patch is_unity_running softwarecenter.utils.is_unity_running = lambda: True def _zzz(self): for i in range(10): time.sleep(0.1) self._p() def _p(self): while Gtk.events_pending():
def test_historypane(self): from softwarecenter.ui.gtk3.panes.historypane import get_test_window win = get_test_window() GObject.timeout_add(TIMEOUT, lambda: win.destroy()) Gtk.main()