~zsombi/ubuntu-ui-toolkit/ima-enhancement

« back to all changes in this revision

Viewing changes to tests/unit_x11/tst_components/tst_header_contents_width.qml

Add UbuntuTestCase.waitForHeaderAnimation().

Approved by PS Jenkins bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
15
 */
16
16
 
17
 
import QtQuick 2.2
 
17
import QtQuick 2.4
18
18
import Ubuntu.Test 1.0
19
 
import Ubuntu.Components 1.1
 
19
import Ubuntu.Components 1.2
20
20
 
21
21
Item {
22
22
    width: units.gu(50)
25
25
    MainView {
26
26
        id: mainView
27
27
        anchors.fill: parent
28
 
        useDeprecatedToolbar: false
29
28
 
30
29
        Tabs {
31
30
            id: tabs
69
68
 
70
69
        property var head_style
71
70
 
72
 
        function wait_for_animation() {
73
 
            tryCompareFunction(function(){return testCase.head_style.animating}, false);
74
 
        }
75
71
        function initTestCase() {
76
 
            testCase.head_style = findChild(mainView, "PageHeadStyle");
77
 
            testCase.wait_for_animation();
 
72
            waitForHeaderAnimation(mainView);
78
73
        }
79
74
 
80
75
        function test_header_contents_width_bug1408481() {
82
77
            testCase.verify(initialWidth > 0, "Initial width has a positive value.");
83
78
            // Select the tab that has more actions.
84
79
            tabs.selectedTabIndex = 1;
85
 
            testCase.wait_for_animation();
 
80
            waitForHeaderAnimation(mainView);
86
81
            // Now less space is available for the header contents, so that the action buttons fit.
87
82
            testCase.verify(searchField.width < initialWidth, "Contents width is reduced.");
88
83
            // Without this wait(), the test does not reproduce bug 1408481.
89
84
            wait(100);
90
85
            // Select the first tab again:
91
86
            tabs.selectedTabIndex = 0;
92
 
            testCase.wait_for_animation();
 
87
            waitForHeaderAnimation(mainView);
93
88
            // Without actions in tab one, the full width is available again for contents
94
89
            testCase.verify(searchField.width === initialWidth, "Contents width is reset.");
95
90
        }