3
from gi.repository import Gtk, GObject
7
from testutils import setup_test_env
12
class TestInstalledPane(unittest.TestCase):
14
def test_installedpane(self):
15
from softwarecenter.ui.gtk3.panes.installedpane import get_test_window
16
win = get_test_window()
17
installedpane = win.get_data("pane")
19
# safe initial show/hide label for later
20
initial_actionbar_label = installedpane.action_bar._label_text
22
installedpane.on_search_terms_changed(None, "foo")
24
model = installedpane.app_view.tree_view.get_model()
25
# FIXME: len(model) *only* counts the size of the top level
26
# (category) hits. thats still ok, as non-apps will
27
# add the "system" category
28
len_only_apps = len(model)
30
installedpane._show_nonapp_pkgs()
32
len_with_nonapps = len(model)
33
self.assertTrue(len_with_nonapps > len_only_apps)
34
# set to hide nonapps again and ensure the size matches the
36
installedpane._hide_nonapp_pkgs()
38
self.assertEqual(len(model), len_only_apps)
39
# clear sarch and ensure we get a expanded size again
40
installedpane.on_search_terms_changed(None, "")
43
self.assertTrue(all_apps > len_only_apps)
44
# ensure we have the same show/hide info as initially
45
self.assertEqual(initial_actionbar_label,
46
installedpane.action_bar._label_text)
47
GObject.timeout_add(TIMEOUT, lambda: win.destroy())
53
while Gtk.events_pending():
57
if __name__ == "__main__":
59
logging.basicConfig(level=logging.INFO)