~mvo/software-center/lp1063595

« back to all changes in this revision

Viewing changes to tests/gtk3/test_appdetailsview.py

  • Committer: Gary Lasker
  • Date: 2012-10-05 04:31:08 UTC
  • mfrom: (3212.1.2 fix-size-calc-race)
  • Revision ID: gary.lasker@canonical.com-20121005043108-466to8zj6ebupogp
* lp:~mvo/software-center/fix-size-calc-race:
  - fix crash due to a race in the size calculation code
    in the details view (LP: #1041004)

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
from tests.utils import (
7
7
    do_events,
 
8
    do_events_with_sleep,
8
9
    get_mock_app_from_real_app,
9
10
    get_test_db,
 
11
    get_test_pkg_info,
 
12
    get_test_gtk3_icon_cache,
10
13
    make_recommend_app_data,
11
14
    setup_test_env,
12
15
)
24
27
from softwarecenter.region import REGION_WARNING_STRING
25
28
from tests.gtk3.windows import get_test_window_appdetails
26
29
from tests.test_database import make_purchased_app_details
 
30
from softwarecenter.distro import get_distro
 
31
 
27
32
 
28
33
 
29
34
class BaseViewTestCase(unittest.TestCase):
276
281
        self.assertEqual(self.view.videoplayer.uri, video_url)
277
282
 
278
283
 
 
284
 
279
285
class MultipleVersionsTestCase(BaseViewTestCase):
280
286
 
281
287
    def test_multiple_versions_automatic_button(self):
523
529
                panel.app_recommendations_cat.get_documents(self.db), [])
524
530
 
525
531
 
 
532
class TestRegression(unittest.TestCase):
 
533
    
 
534
    def test_regression_lp1041004(self):
 
535
        from softwarecenter.ui.gtk3.views import appdetailsview
 
536
        db = get_test_db()
 
537
        cache = get_test_pkg_info()
 
538
        icons = get_test_gtk3_icon_cache()
 
539
        distro = get_distro()
 
540
        view = appdetailsview.AppDetailsView(db, distro, icons, cache)
 
541
        cache.emit("query-total-size-on-install-done", "apt", 10, 10)
 
542
        do_events_with_sleep()
 
543
        self.assertEqual(view.totalsize_info.value_label.get_text(), "")
 
544
 
 
545
 
526
546
if __name__ == "__main__":
527
547
    unittest.main()