Merge lp:~aacid/unity8/rework_tst_PreviewRatingDisplayCreationRanges into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Michael Zanetti
Approved revision: 2494
Merged at revision: 2523
Proposed branch: lp:~aacid/unity8/rework_tst_PreviewRatingDisplayCreationRanges
Merge into: lp:unity8
Diff against target: 116 lines (+55/-19)
1 file modified
tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml (+55/-19)
To merge this branch: bzr merge lp:~aacid/unity8/rework_tst_PreviewRatingDisplayCreationRanges
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+298130@code.launchpad.net

Commit message

Rework tst_PreviewRatingDisplayCreationRanges

Remove the time comparison and actually check that only a small amount of items is being created

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Michael Zanetti (mzanetti) wrote :

test passing locally here. makes sense to me

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2493
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1592/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2117
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1112
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1112
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1112
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2145
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2055
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2055
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2055
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2046/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2046
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2046/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1592/rebuild

review: Needs Fixing (continuous-integration)
2494. By Albert Astals Cid

Don't check for an exact number but for <= 20 delegates created

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2494
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1599/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2126
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1118
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1118
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1118
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2154
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2063
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2063
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2063
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2054/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2054
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2054/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1599/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

ok. this test passing in jenkins now too. top-approving

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml'
2--- tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml 2015-11-27 08:12:46 +0000
3+++ tests/qmltests/Dash/Previews/tst_PreviewRatingDisplayCreationRanges.qml 2016-06-23 08:20:54 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright 2014,2015 Canonical Ltd.
7+ * Copyright 2014-2016 Canonical Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11@@ -42,6 +42,8 @@
12 parentFlickable: root
13 }
14
15+ property int createdDelegates: 0
16+
17 Component.onCompleted: {
18 for (var i = 0; i < 500; ++i) {
19 widgetData500.reviews.push({ author: "Some dude", review: "Very cool app" + i });
20@@ -49,37 +51,68 @@
21 factory.widgetData = widgetData500;
22 }
23
24+ Component {
25+ id: countingPreviewRatingSingleDisplayComponent
26+ PreviewRatingSingleDisplay {
27+ objectName: "reviewItem" + index
28+
29+ anchors { left: parent.left; right: parent.right; }
30+
31+ rating: modelData["rating"] || -1
32+ author: modelData["author"] || ""
33+ review: modelData["review"] || ""
34+ Component.onCompleted: root.createdDelegates++;
35+ }
36+ }
37+
38 UT.UnityTestCase {
39- name: "PreviewRatingDisplayTest"
40+ name: "PreviewRatingDisplayCreationRangesTest"
41 when: windowShown
42
43- function test_creation_speed() {
44+ function initTestCase() {
45+ var lists = findChildsByType(factory, "QQuickListView");
46+ compare(lists.length, 1)
47+ lists[0].delegate = countingPreviewRatingSingleDisplayComponent;
48+ }
49+
50+ function test_check_delegate_creation_range() {
51+ // Clear the reviews
52+ factory.widgetData = reviewsEmpty;
53+ waitForRendering(root);
54+
55+ // Unset parentFlickable this disables the creation range code
56 factory.parentFlickable = null;
57- factory.widgetData = reviewsEmpty;
58- waitForRendering(root);
59+ root.createdDelegates = 0;
60
61- var start = new Date().getTime();
62+ // Set the 500 reviews data
63 factory.widgetData = widgetData500;
64 waitForRendering(root);
65- var end = new Date().getTime();
66- var time500 = end - start;
67-
68+
69+ // Check we have created 500 delegates
70+ compare(root.createdDelegates, 500);
71+
72+ // Check review 499 has been created
73+ var reviewItem499 = findChild(factory, "reviewItem499");
74+ verify(reviewItem499 !== null);
75+
76+ // Clear the reviews
77 factory.widgetData = reviewsEmpty;
78 waitForRendering(root);
79
80+ // set parentFlickable to enable the creation ranges code
81 factory.parentFlickable = root;
82- start = new Date().getTime();
83+ root.createdDelegates = 0;
84+
85+ // Set the 500 reviews data
86 factory.widgetData = widgetData500;
87 waitForRendering(root);
88- end = new Date().getTime();
89- var timeRanges500 = end - start;
90-
91- // Measurements show it's usually like 20 times faster
92- // but we set the range at 8 times fast to make sure it's not an unstable test
93- verify(timeRanges500 * 8 < time500);
94- }
95-
96- function test_check_indexes() {
97+
98+ // Check we have only created a few delegates
99+ // For some reason xenial and yaketti we get 16 and on vivid 15 so
100+ // settle for <= 20
101+ expectFailContinue("", "Should not create more than 20 delegates when using ranges");
102+ tryCompareFunction(function() { return root.createdDelegates > 20 }, true);
103+
104 // Check that item 499 isn't there on startup but if we scroll down
105 // it will be there
106 var reviewItem499 = findChild(factory, "reviewItem499");
107@@ -89,6 +122,9 @@
108
109 var reviewItem499 = findChild(factory, "reviewItem499");
110 verify(reviewItem499 !== null);
111+
112+ // Check we have created 500 delegates
113+ compare(root.createdDelegates, 500);
114 }
115 }
116 }

Subscribers

People subscribed via source and target branches