def get_test_window_appview(): db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() # create a filter app_filter = appfilter.AppFilter(db, cache) app_filter.set_supported_only(False) app_filter.set_installed_only(True) # appview enquirer = enquire.AppEnquire(cache, db) store = appstore2.AppListStore(db, cache, icons) view = appview.AppView(db, cache, icons, show_ratings=True) view.set_model(store) entry = Gtk.Entry() entry.stamp = 0 entry.connect("changed", on_entry_changed, (view, enquirer)) entry.set_text("gtk3") box = Gtk.VBox() box.pack_start(entry, False, True, 0) box.pack_start(view, True, True, 0) win = get_test_window(child=box) win.set_data("appview", view) win.set_data("entry", entry) return win
def get_test_window_confirm_remove(): # test real remove dialog icons = get_test_gtk3_icon_cache() db = get_test_db() app = application.Application("", "p7zip-full") return dependency_dialogs.confirm_remove(None, app, db, icons)
def get_test_window_availablepane(): # needed because available pane will try to get it vm = get_test_gtk3_viewmanager() assert vm is not None db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() backend = get_test_install_backend() distro = softwarecenter.distro.get_distro() manager = appmanager.get_appmanager() if manager is None: # create global AppManager instance manager = appmanager.ApplicationManager(db, backend, icons) navhistory_back_action = Gtk.Action.new("navhistory_back_action", "Back", "Back", None) navhistory_forward_action = Gtk.Action.new("navhistory_forward_action", "Forward", "Forward", None) zl = "softwarecenter.backend.zeitgeist_logger.ZeitgeistLogger"; patch(zl + ".log_install_event").start().return_value = False patch(zl + ".log_uninstall_event").start().return_value = False patch("softwarecenter.utils.is_unity_running").start().return_value = False w = availablepane.AvailablePane(cache, db, distro, icons, navhistory_back_action, navhistory_forward_action) w.init_view() w.show() win = get_test_window(child=w, width=800, height=600) # this is used later in tests win.set_data("pane", w) win.set_data("vm", vm) return win
def get_test_window_apptreeview(): cache = get_test_pkg_info() db = get_test_db() icons = get_test_gtk3_icon_cache() # create a filter app_filter = appfilter.AppFilter(db, cache) app_filter.set_supported_only(False) app_filter.set_installed_only(True) # get the TREEstore store = appstore2.AppTreeStore(db, cache, icons) # populate from data cats = get_test_categories(db) for cat in cats[:3]: with ExecutionTime("query cat '%s'" % cat.name): docs = db.get_docs_from_query(cat.query) store.set_category_documents(cat, docs) # ok, this is confusing - the AppView contains the AppTreeView that # is a tree or list depending on the model app_view = appview.AppView(db, cache, icons, show_ratings=True) app_view.set_model(store) box = Gtk.VBox() box.pack_start(app_view, True, True, 0) win = get_test_window(child=box) return win
def test_regression_lp1041004(self): from softwarecenter.ui.gtk3.views import appdetailsview db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() distro = get_distro() view = appdetailsview.AppDetailsView(db, distro, icons, cache) cache.emit("query-total-size-on-install-done", "apt", 10, 10) do_events_with_sleep() self.assertEqual(view.totalsize_info.value_label.get_text(), "")
def setUp(self): # get required test stuff self.db = get_test_db() self.backend = Mock() self.distro = get_distro() self.datadir = softwarecenter.paths.datadir self.icons = get_test_gtk3_icon_cache() # create it once, it becomes global instance if get_appmanager() is None: ApplicationManager(self.db, self.backend, self.icons)
def setUp(self): # get required test stuff self.db = get_test_db() self.backend = Mock() self.distro = get_distro() self.datadir = softwarecenter.paths.datadir self.icons = get_test_gtk3_icon_cache() # create it once, it becomes global instance if get_appmanager() is None: ApplicationManager( self.db, self.backend, self.icons)
def get_test_window_globalpane(): vm = get_test_gtk3_viewmanager() db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() p = globalpane.GlobalPane(vm, db, cache, icons) win = get_test_window(child=p) win.set_data("pane", p) return win
def get_test_window_pendingpane(): icons = get_test_gtk3_icon_cache() view = pendingpane.PendingPane(icons) # gui scroll = Gtk.ScrolledWindow() scroll.add_with_viewport(view) win = get_test_window(child=scroll) view.grab_focus() return win
def get_test_window_dependency_dialog(): icons = get_test_gtk3_icon_cache() db = get_test_db() depends = ["apt", "synaptic"] app = application.Application("", "software-center") primary = "primary text" button_text = "button_text" dia = dependency_dialogs._get_confirm_internal_dialog( parent=None, app=app, db=db, icons=icons, primary=primary, button_text=button_text, depends=depends, cache=db._aptcache) return dia
def get_test_screenshot_thumbnail_window(): class CycleState(object): def __init__(self): self.app_n = 0 self.apps = [application.Application("Movie Player", "totem"), application.Application("Comix", "comix"), application.Application("Gimp", "gimp"), #application.Application("ACE", "uace"), ] def testing_cycle_apps(widget, thumb, db, cycle_state): d = cycle_state.apps[cycle_state.app_n].get_details(db) if cycle_state.app_n + 1 < len(cycle_state.apps): cycle_state.app_n += 1 else: cycle_state.app_n = 0 thumb.fetch_screenshots(d) return True cycle_state = CycleState() vb = Gtk.VBox(spacing=6) win = get_test_window(child=vb) icons = get_test_gtk3_icon_cache() distro = softwarecenter.distro.get_distro() t = thumbnail.ScreenshotGallery(distro, icons) t.connect('draw', t.draw) frame = containers.FramedBox() frame.add(t) win.set_data("screenshot_thumbnail_widget", t) b = Gtk.Button(label='A button for cycle testing') vb.pack_start(b, False, False, 8) win.set_data("screenshot_button_widget", b) vb.pack_start(frame, True, True, 0) win.set_data("screenshot_thumbnail_cycle_test_button", b) db = get_test_db() win.show_all() testing_cycle_apps(None, t, db, cycle_state) b.connect("clicked", testing_cycle_apps, t, db, cycle_state) return win
def get_test_window_historypane(): # needed because available pane will try to get it vm = get_test_gtk3_viewmanager() vm # make pyflakes happy db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() widget = historypane.HistoryPane(cache, db, None, icons) widget.show() win = get_test_window(child=widget) widget.init_view() return win
def get_test_window_viewswitcher(): cache = get_test_pkg_info() db = get_test_db() icons = get_test_gtk3_icon_cache() manager = get_test_gtk3_viewmanager() view = viewswitcher.ViewSwitcher(manager, db, cache, icons) scroll = Gtk.ScrolledWindow() box = Gtk.VBox() box.pack_start(scroll, True, True, 0) win = get_test_window(child=box) scroll.add_with_viewport(view) return win
def test_no_axi_cataloged_time_info_yet(self): """ ensure that we show "whats new" DB_CATALOGED_TIME data if there is no x-a-i yet """ db = get_test_db() cache = db._aptcache icons = get_test_gtk3_icon_cache() apps_filter = AppFilter(db, cache) # simulate a fresh install with no catalogedtime info in a-x-i if "catalogedtime" in db._axi_values: del db._axi_values["catalogedtime"] # create it view = lobbyview.LobbyView(cache, db, icons, softwarecenter.distro.get_distro(), apps_filter) view.show_all() # and ensure its visible self.assertTrue(view.whats_new_frame.get_property("visible"))
def get_test_window_recommendations(panel_type="lobby"): cache = get_test_pkg_info() db = get_test_db() icons = get_test_gtk3_icon_cache() from softwarecenter.ui.gtk3.models.appstore2 import AppPropertiesHelper properties_helper = AppPropertiesHelper(db, cache, icons) if panel_type is "lobby": view = recommendations.RecommendationsPanelLobby(db, properties_helper) elif panel_type is "category": cats = get_test_categories(db) view = recommendations.RecommendationsPanelCategory( db, properties_helper, cats[0]) else: # panel_type is "details": view = recommendations.RecommendationsPanelDetails( db, properties_helper) win = get_test_window(child=view, width=600, height=300) win.set_data("rec_panel", view) return win
def get_test_window_recommendations(panel_type="lobby"): cache = get_test_pkg_info() db = get_test_db() icons = get_test_gtk3_icon_cache() from softwarecenter.ui.gtk3.models.appstore2 import AppPropertiesHelper properties_helper = AppPropertiesHelper(db, cache, icons) if panel_type is "lobby": view = recommendations.RecommendationsPanelLobby( db, properties_helper) elif panel_type is "category": cats = get_test_categories(db) view = recommendations.RecommendationsPanelCategory( db, properties_helper, cats[0]) else: # panel_type is "details": view = recommendations.RecommendationsPanelDetails( db, properties_helper) win = get_test_window(child=view, width=600, height=300) win.set_data("rec_panel", view) return win
def get_test_window_installedpane(): # needed because available pane will try to get it vm = get_test_gtk3_viewmanager() vm # make pyflakes happy db = get_test_db() cache = get_test_pkg_info() icons = get_test_gtk3_icon_cache() w = installedpane.InstalledPane(cache, db, 'Ubuntu', icons) w.show() # init the view w.init_view() w.state.channel = channel.AllInstalledChannel() view_state = displaystate.DisplayState() view_state.channel = channel.AllInstalledChannel() w.display_overview_page(view_state) win = get_test_window(child=w) win.set_data("pane", w) return win
def setUpClass(cls): cls.cache = get_test_pkg_info() cls.icons = get_test_gtk3_icon_cache() cls.db = get_test_db()
def setUp(self): self.cache = get_test_pkg_info() self.icons = get_test_gtk3_icon_cache() self.db = get_test_db()
def setUp(self): self.parent = None self.db = Mock() self.db._aptcache = FakedCache() self.icons = get_test_gtk3_icon_cache()
def test_get_file_path_from_iconname(self): icons = get_test_gtk3_icon_cache() icon_path = get_file_path_from_iconname(icons, "softwarecenter") self.assertEqual(icon_path, "/usr/share/icons/hicolor/48x48/apps/softwarecenter.svg")
def test_get_file_path_from_iconname(self): icons = get_test_gtk3_icon_cache() icon_path = get_file_path_from_iconname(icons, "softwarecenter") self.assertEqual( icon_path, "/usr/share/icons/hicolor/48x48/apps/softwarecenter.svg")