~ubuntu-branches/ubuntu/quantal/software-center/quantal-proposed

« back to all changes in this revision

Viewing changes to test/gtk3/test_installedpane.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, Robert Roth, Gary Lasker, Natalia Bidart, Adam Conrad, Michael Vogt
  • Date: 2012-06-21 08:44:02 UTC
  • Revision ID: package-import@ubuntu.com-20120621084402-re706ihwxttyks3z
Tags: 5.3.1
[ Robert Roth ]
* lp:~evfool/software-center/lp752376:
  - Updated the code to also work with file:// style deb filenames
    (LP: LP #752376)
* lp:~evfool/software-center/lp1011605:
  - update copyright date in the About window (LP: #1011605)
* lp:~evfool/software-center/lp1011567:
  - add F1 key as accelerator for opening Help (LP: #1011567)

[ Gary Lasker ]
* debian/control:
  - remove recommends for gir1.2-launchpad-integration-3.0 as it is no
    longer needed (many thanks Robert Ancell) 

[ Natalia Bidart ]
* lp:~nataliabidart/software-center/the-organizer:
  + Tests cleanup:
    - Renamed test/ dir to tests/.
    - Moved the testutils module to tests/utils.py.
    - Removed all unnecessary logging setup per test file.
    - Removed all unnecessary shebangs in test files.
    - Isolated test code into tests/ directory, including moving all the
      get_test_window_foo from the gtk3 production modules to
      tests/gtk3/windows.py module.
    - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
      execution of the suite.
    - Pep8 and pyflakes fixes in the files already modified in this branch.
    - Minor bug fix in the softwarecenter/log.py module when trying to 
      create a log dir with proper perms.
* lp:~nataliabidart/software-center/cant-stop-the-music.trunk:
  - Stop the video if user navigates away from an app details page
    (LP: #1003954).
  - Refactored ViewManager so page displaying calls a leave_page before 
    changing a page, and a enter_page when navigating into a page.

[ Adam Conrad ]
* xz-lzma has been rolled into xz-utils, as of 5.1.1alpha+20120614-1

[ Michael Vogt ]
* lp:~mvo/software-center/python-apt-0.8 :
  - fix some leftover python-apt 0.7 API usage that will get removed
    in quantal
* lp:~mvo/software-center/add-profile-cmdline
  - add new --profile option to the app that writes out a cProfile
    logfile
  - add new dbus method com.ubuntu.SoftwarecenterIFace.writeMemoryDump
    to write meliae memory dump for analyizing memleaks/cycles
* lp:~mvo/software-center/more-performance-measurement:
  - add more fine grained data in --measure-startup-time and 
    suppresses times <0.1s in the output

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
 
 
3
 
from gi.repository import Gtk, GObject
4
 
import time
5
 
import unittest
6
 
 
7
 
from testutils import setup_test_env
8
 
setup_test_env()
9
 
 
10
 
TIMEOUT=300
11
 
 
12
 
class TestInstalledPane(unittest.TestCase):
13
 
 
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")
18
 
        self._p()
19
 
        # safe initial show/hide label for later
20
 
        initial_actionbar_label = installedpane.action_bar._label_text
21
 
        # do simple search
22
 
        installedpane.on_search_terms_changed(None, "foo")
23
 
        self._p()
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)
29
 
        # set to show nonapps
30
 
        installedpane._show_nonapp_pkgs()
31
 
        self._p()
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
35
 
        # previous one
36
 
        installedpane._hide_nonapp_pkgs()
37
 
        self._p()
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, "")
41
 
        self._p()
42
 
        all_apps = len(model)
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())
48
 
        Gtk.main()
49
 
 
50
 
    def _p(self):
51
 
        for i in range(10):
52
 
            time.sleep(0.1)
53
 
            while Gtk.events_pending():
54
 
                Gtk.main_iteration()
55
 
 
56
 
 
57
 
if __name__ == "__main__":
58
 
    import logging
59
 
    logging.basicConfig(level=logging.INFO)
60
 
    unittest.main()