~ubuntu-branches/ubuntu/trusty/ubuntuone-control-panel/trusty-proposed

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/tests/test_tabbed_panel.py

  • Committer: Package Import Robot
  • Author(s): Rodney Dawes
  • Date: 2012-12-10 09:56:24 UTC
  • mfrom: (1.1.41)
  • Revision ID: package-import@ubuntu.com-20121210095624-uqwqrftml2gg2xiq
Tags: 4.1.0-0ubuntu1
* New upstream release.
  - Replace simplejson usage with json. (LP: #1029094)
  - Clear search when clicking (X) icon in search entry. (LP: #1070917)
  - Raise existing window if process already running. (LP: #1063927)
  - Don't auto-publish when selecting a search result. (LP: #1065194)
  - Add a new .desktop file for the GNOME-only remix of Ubuntu.
* debian/control:
  - Switch pylint build dependency to pyflakes.
  - Remove python-simplejson from dependencies.
* debian/ubuntuone-control-panel-qt.install:
  - Add new .desktop file for GNOME remix.
  - Remove the messaging menu integration file.
* debian/watch:
  - Update to use stable-4-2 series for Ubuntu 13.04 releases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
 
 
3
#
 
4
# Copyright 2011 Canonical Ltd.
 
5
#
 
6
# This program is free software: you can redistribute it and/or modify it
 
7
# under the terms of the GNU General Public License version 3, as published
 
8
# by the Free Software Foundation.
 
9
#
 
10
# This program is distributed in the hope that it will be useful, but
 
11
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
12
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
13
# PURPOSE.  See the GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License along
 
16
# with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 
 
18
"""Tests for the tabbed panel."""
 
19
 
 
20
from PyQt4 import QtGui
 
21
from twisted.internet import defer
 
22
from twisted.trial.unittest import TestCase
 
23
 
 
24
from ubuntuone.controlpanel.gui.qt import tabbed_panel
 
25
 
 
26
 
 
27
class FakeOverlayWidget(QtGui.QLabel):
 
28
    """Fake a widget that does have the show_orvelay attribute."""
 
29
 
 
30
    def __init__(self, *args, **kwargs):
 
31
        super(FakeOverlayWidget, self).__init__(*args, **kwargs)
 
32
        self.show_overlay = False
 
33
 
 
34
 
 
35
class TabbedPanelTestCase(TestCase):
 
36
    """Test the tabbed panel."""
 
37
 
 
38
    @defer.inlineCallbacks
 
39
    def setUp(self):
 
40
        """Set the tests."""
 
41
        yield super(TabbedPanelTestCase, self).setUp()
 
42
        self.tab_widget = tabbed_panel.TabbedPanel()
 
43
 
 
44
    def test_all_overlay_supported(self):
 
45
        """Test when all the widgets support the overlay feature."""
 
46
        labels = [FakeOverlayWidget("Test"),
 
47
                  FakeOverlayWidget("Test"),
 
48
                  FakeOverlayWidget("Test")]
 
49
        for lab in labels:
 
50
            self.tab_widget.addTab(lab, 'label')
 
51
 
 
52
        self.tab_widget.show_overlay = True
 
53
        self.assertTrue(all([l.show_overlay for l in labels]))
 
54
        self.tab_widget.show_overlay = False
 
55
        self.assertFalse(any([l.show_overlay for l in labels]))