~ralsina/ubuntu-sso-client/cross-platform

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/tests/test_enhanced_check_box.py

- Removing the align property from the label that wasn't necessary and was breakint the work wrap.
Also adjust the height of the widget depending if it has more than one line (LP: #940392).

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for the EnhancedCheckBox widget."""
18
18
 
19
 
from PyQt4 import QtCore
 
19
from PyQt4 import QtGui, QtCore
20
20
 
21
21
from ubuntu_sso.qt import enhanced_check_box
22
22
from ubuntu_sso.qt.tests import BaseTestCase
40
40
        check.setText("text")
41
41
        self.assertEqual(check.text(), "text")
42
42
        self.assertEqual(check.text(), check.text_label.text())
 
43
 
 
44
    def test_enhanced_check_size_adjust_with_small_height(self):
 
45
        """Check if the size of the EnhancedCheckBox is adjusted correctly."""
 
46
        text = 't' * 200
 
47
        height = 10
 
48
        widget = QtGui.QWidget()
 
49
        widget.setFixedSize(200, height)
 
50
        check = enhanced_check_box.EnhancedCheckBox(text, widget)
 
51
        self.assertTrue(check.height() > height)
 
52
 
 
53
    def test_enhanced_check_size_adjust_with_big_height(self):
 
54
        """Check if the size of the EnhancedCheckBox is adjusted correctly."""
 
55
        text = 't' * 20
 
56
        height = 200
 
57
        widget = QtGui.QWidget()
 
58
        widget.setFixedSize(200, height)
 
59
        check = enhanced_check_box.EnhancedCheckBox(text, widget)
 
60
        self.assertTrue(check.height() < height)