Merge lp:~paulliu/unity8/zoomImage into lp:unity8

Proposed by Ying-Chun Liu
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 754
Merged at revision: 873
Proposed branch: lp:~paulliu/unity8/zoomImage
Merge into: lp:unity8
Diff against target: 467 lines (+383/-10)
7 files modified
qml/Components/LazyImage.qml (+1/-0)
qml/Components/ZoomableImage.qml (+153/-0)
qml/Dash/Previews/PreviewZoomableImage.qml (+4/-7)
tests/qmltests/CMakeLists.txt (+1/-0)
tests/qmltests/Components/tst_ZoomableImage.qml (+192/-0)
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml (+6/-3)
tests/utils/modules/Unity/Test/UnityTestCase.qml (+26/-0)
To merge this branch: bzr merge lp:~paulliu/unity8/zoomImage
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Andrea Cimitan (community) Needs Fixing
Michał Sawicz Needs Information
Review via email: mp+207941@code.launchpad.net

Commit message

Add Zoomable Image for Preview widgets.

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.
lp:~paulliu/unity8/zoomImage updated
736. By Ying-Chun Liu on 2014-02-24

Fix coding style.

Michał Sawicz (saviq) wrote :

qml/Dash/Previews/PreviewZoomableImage.qml: bad whitespace in lines 94, 134

lp:~paulliu/unity8/zoomImage updated
737. By Ying-Chun Liu on 2014-02-25

fix whitespace error.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:737
http://jenkins.qa.ubuntu.com/job/unity8-ci/2403/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3481
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3118/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1273
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/924
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/928
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/928/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/924
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3061
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3484
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3484/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3120
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3120/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5505/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4264

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2403/rebuild

review: Needs Fixing (continuous-integration)
Michał Sawicz (saviq) wrote :

Is AnimatedImage used here for a reason?

review: Needs Information
Ying-Chun Liu (paulliu) wrote :

No. So should I use LazyImage here?

Michał Sawicz (saviq) wrote :

AnimatedImage is meant for... animated, as in multiple-frame images, which we don't expect to support here. Yes, use LazyImage to maintain the loading transitions.

lp:~paulliu/unity8/zoomImage updated
738. By Ying-Chun Liu on 2014-03-11

Use LazyImage instead of AnimatedImage

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:738
http://jenkins.qa.ubuntu.com/job/unity8-ci/2468/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3834
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3419/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1338/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/989
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/993
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/993/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/989
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3365
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3852
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3852/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3421
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3421/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5781/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4683

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2468/rebuild

review: Needs Fixing (continuous-integration)
Andrea Cimitan (cimi) wrote :

Where did you get all the logic for the pinch to zoom? It does make sense to me to have this zoomable image as a separate component, then integrated into the preview, rather than having it directly here in the previews. I'd then add it to either the SDK or the Components folder in qml/Components unity8. (then more tests for it!)

review: Needs Fixing
Ying-Chun Liu (paulliu) wrote :

OK. I'll re-factor it to the Components folder.

Albert Astals Cid (aacid) wrote :

Doesn't merge with current unity8 trunk

review: Needs Fixing
lp:~paulliu/unity8/zoomImage updated
739. By Ying-Chun Liu on 2014-03-18

Move ZoomableImage to Components.
Add more unit tests.

740. By Ying-Chun Liu on 2014-03-18

Merge trunk.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:740
http://jenkins.qa.ubuntu.com/job/unity8-ci/2548/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4040
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3625
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1418
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1069
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1073
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1073/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1069
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3525
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4083
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4083/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3627
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3627/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5952
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4932

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2548/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:740
http://jenkins.qa.ubuntu.com/job/unity8-ci/2581/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4115
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3699
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1451
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1102
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1106
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1106/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1102
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3590
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4176
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4176/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3701
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3701/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6018
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5045

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2581/rebuild

review: Approve (continuous-integration)
Andrea Cimitan (cimi) wrote :

I noticed that the code for ZoomableImage comes from http://developer.nokia.com/community/wiki/images/0/02/QuickFlickr.zip?20131030203027

that is GPLv2 or GPLv3 (both mentioned in the copyright file)

I'd like to see some clarification on the algorithm used, especially this multiplication for 0.98 in calculateSize

Tests:
- ZoomableImage
I'd also make tests more robust, by checking if the scale is exactly the one expected, and not only if the image zooms in or out.

Adding wait for the pinch action to the mouse events is not optimal, and might not work with jenkins (I'd like a comment from danrader on that).

- Preview
The
58 + wait(3000);
Looks like a mistake, should be replaced with a tryCompare if you need to wait for a partcular state to load.

I'd not replicate (almost) the test of the zoomable image (this is already tested), but just add the bits we need to test on the integration.

lp:~paulliu/unity8/zoomImage updated
741. By Ying-Chun Liu on 2014-03-24

Rewrite the zoomable image code.

742. By Ying-Chun Liu on 2014-03-24

Remove the tests which are already in ZoomableImage's test.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:741
http://jenkins.qa.ubuntu.com/job/unity8-ci/2609/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4187
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3771
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1479
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1130
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1134
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1134/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1130
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3640
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4255
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4255/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3773
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3773/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6071
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5132

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2609/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:742
http://jenkins.qa.ubuntu.com/job/unity8-ci/2614/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4201
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3785
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1484
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1135
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1139
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1139/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1135
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3649
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4271
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4271/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3787
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3787/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6083
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5148

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2614/rebuild

review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/zoomImage updated
743. By Ying-Chun Liu on 2014-03-27

Fix PreviewZoomableImage unit test.

744. By Ying-Chun Liu on 2014-03-28

merge trunk

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:744
http://jenkins.qa.ubuntu.com/job/unity8-ci/2666/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4345/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3944
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1536
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1187
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1191
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1191/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1187
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3765/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4444
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4444/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3946
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3946/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6222
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5360

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2666/rebuild

review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/zoomImage updated
745. By Ying-Chun Liu on 2014-03-28

Test scale factor.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:745
http://jenkins.qa.ubuntu.com/job/unity8-ci/2667/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4347
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3946
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1537
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1188
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1192
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1192/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1188
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3767
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4446
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4446/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3948
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3948/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6224
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5364

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2667/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

Can you please set widgetData1 as default widget data so when we do
make tryPreviewZoomableImage
and we have merged lp:~mzanetti/unity8/fix-make-trySomething-qt-5.2 we got something?

review: Needs Fixing
Albert Astals Cid (aacid) wrote :

Also how did you test this?

review: Needs Information
lp:~paulliu/unity8/zoomImage updated
746. By Ying-Chun Liu on 2014-04-03

Add testing mouse wheel and flickable width and height.

Ying-Chun Liu (paulliu) wrote :

ok. I'll add it. But I'm currently encountering a strange bug.
PinchArea receives nothing again. I'm checking it.

lp:~paulliu/unity8/zoomImage updated
747. By Ying-Chun Liu on 2014-04-08

Fix PinchArea and tests.

748. By Ying-Chun Liu on 2014-04-08

Fix some unit test.

PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:747
http://jenkins.qa.ubuntu.com/job/unity8-ci/2748/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/82
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4597
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1618
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1269
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1273
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1273/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1269
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/82
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4192
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4192/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5730
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3959
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4721
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4721/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2748/rebuild

review: Approve (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:748
http://jenkins.qa.ubuntu.com/job/unity8-ci/2751/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/95
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4616
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1621/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1272
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1276
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1276/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1272
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/92
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4209
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4209/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5748
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3973
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4740
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4740/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2751/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:748
http://jenkins.qa.ubuntu.com/job/unity8-ci/2765/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/117
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4651
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1635
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1286
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1290
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1290/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1286
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/114
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4238
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4238/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5792
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4009
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4777
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4777/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2765/rebuild

review: Needs Fixing (continuous-integration)
lp:~paulliu/unity8/zoomImage updated
749. By Ying-Chun Liu on 2014-04-09

Add zoom-out unit test

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:749
http://jenkins.qa.ubuntu.com/job/unity8-ci/2786/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/154
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4711
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1650
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1307
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1311
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1311/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1307
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/150
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4294
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4294/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5860
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4067
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4838
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4838/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2786/rebuild

review: Needs Fixing (continuous-integration)
Albert Astals Cid (aacid) wrote :

Can you please merge trunk into it? Otherwise it doesn't build.

review: Needs Fixing
Albert Astals Cid (aacid) wrote :
Download full text (6.8 KiB)

testZoomableImage doesn't pass here

tsdgeos_work@xps:~/phablet/unity8/zoomImage/builddir$ make testZoomableImage
Scanning dependencies of target testZoomableImage
********* Start testing of qmltestrunner *********
Config: Using QtTest library 5.2.1, Qt 5.2.1
PASS : qmltestrunner::ZoomableImageTest::initTestCase()
PASS : qmltestrunner::ZoomableImageTest::test_loadImage()
PASS : qmltestrunner::ZoomableImageTest::test_mousewheel()
PASS : qmltestrunner::ZoomableImageTest::test_pinch(row 0)
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.0223712539150298 image.scale = 1.0223712539150298
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.0357940073993845 image.scale = 1.0357940073993845
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.0581652649948587 image.scale = 1.0581652649948587
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.0738228162358237 image.scale = 1.0738228162358237
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.0894850291524478 image.scale = 1.0894850291524478
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.1118562916099062 image.scale = 1.1118562916099062
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.1252790499663978 image.scale = 1.1252790499663978
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.1476503152894069 image.scale = 1.1476503152894069
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.1633080509221423 image.scale = 1.1633080509221423
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.1789700895053916 image.scale = 1.1789700895053916
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.201341358651656 image.scale = 1.201341358651656
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.214764120838203 image.scale = 1.214764120838203
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.2371353922590045 image.scale = 1.2371353922590045
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.252793285608461 image.scale = 1.252793285608461
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.268455174455575 image.scale = 1.268455174455575
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.2908264489369636 image.scale = 1.2908264489369636
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.30424921418879 image.scale = 1.30424921418879
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.3266204905056826 image.scale = 1.3266204905056826
QDEBUG : qmltestrunner::ZoomableImageTest::test_pinch(row 1) Pinch Updated pinch.scale = 1.3422785202947793 image.scale = 1.3422785202947793
QDEBUG : qmltestrunner::ZoomableI...

Read more...

review: Needs Fixing
lp:~paulliu/unity8/zoomImage updated
750. By Ying-Chun Liu on 2014-04-22

Merge upstream
[ Albert Astals ]
* Fix last item X position Fixes clicking on the last item sometimes
  not working (LP: #1301871)
* Use upstart in ./run Makes it so that you can use the lock button on
  the device without getting that nasty hwc crash
* Remove AnimationControllerWithSignals.
* Use the correct delegate base item for the Carousel test
* Some simplification in DashContent Kill the ScopeDelegateMapper in
  favour of a simple if (that will eventually go away). Removal of all
  the fake scopes in the tests that added nothing of value to the
  tests. Removal of movementEnded signal that was unused. Removal of
  movementStarted and positionedAtBeginning signals that were being
  used as function calls. Rework DashContent tests so they what the
  function does what it is supposed to do instead of just making sure
  QML signals work .
* Improve Card creation time by adding loaders that make sure only
  what's needed is loaded In my computer it goes from RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotSummaryMode
  l": 3.217 msecs per iteration (total: 3,218, iterations: 1000)
  RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotModel":
  1.647 msecs per iteration (total: 1,648, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleModel": 1.514
  msecs per iteration (total: 1,515, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtModel": 1.471 msecs per
  iteration (total: 1,471, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardArtModel": 1.447 msecs per
  iteration (total: 1,448, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleModel": 1.276 msecs per
  iteration (total: 1,276, iterations: 1000) to RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotSummaryMode
  l": 2.916 msecs per iteration (total: 2,917, iterations: 1000)
  RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleMascotModel":
  1.504 msecs per iteration (total: 1,504, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtSubtitleModel": 1.060
  msecs per iteration (total: 1,061, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleArtModel": 1.052 msecs per
  iteration (total: 1,053, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardArtModel": 0.727 msecs per
  iteration (total: 728, iterations: 1000) RESULT :
  qmltestrunner::benchmark_time:"cardTitleModel": 0.817 msecs per
  iteration (total: 818, iterations: 1000) (LP: #1297197)
[ Allan LeSage ]
* DashApps emulator get_applications should return a list ordered by
  visible y, x.
[ Andrea Cimitan ]
* Workaround for lp1301309 until fixes for palette in ui toolkit (LP:
  #1301309)
[ Leo Arias ]
* Reverted the change that returns application cards instead of
  titles.
[ Nick Dedekind ]
* Indicator services started by unity8 upstart configuration rather
  than manual emmision from indicator manager.
[ Mirco Müller ]
* Fix notification ap-test assertions.
[ Michael Terry ]
* Use new tablet and phone backgrounds from Design.
[ Michael Zanetti ]
* workaround the QTestLogger assertion issue with make tryXyz and our
  custom uqmlscene
[ Michael Terry ]
* When an application requests focus, handle it in Shell.qml by hiding
  the greeter and stopping any edge demo. (LP: #1227753)
[ Leo Arias ]
* Use subprocess.check_call when caling url-dispatcher, so an error
  will be raised if it fails.
* Test application life cycle with fake apps, instead of messaging and
  address book.
[ Didier Roche ]
* Resync trunk with previous revert upload
[ Michał Sawicz ]
* Set the Qt.ImhNoPredictiveText flag on wifi password field, fixes
  lp:1291575 (LP: #1291575)
[ Albert Astals ]
* Take into account the originY when specifying the delegate ranges
  Fixes bug #1300302 (LP: #1300302)
[ CI bot ]
* Resync trunk
[ Allan LeSage ]
* Swiping open an indicator must show its correct title--protect
  against lp:1253804 . (LP: #1253804)
[ Alexander Sack ]
* Fix TypeError: issue seen in system_integration autopilot test on
  image 279. (LP: #1303685)
[ Bill Filler ]
* Set the Qt.ImhNoPredictiveText flag on wifi password field, fixes
  lp:1291575 (LP: #1291575)
[ Leo Arias ]
* Added a search autopilot helper.
[ Michael Terry ]
* Provide a all-in-one script for getting a device to an unlocked
  state.
* Revert to previous version as it's linked to latest sdk change which
  is making gallery-app AP tests failing on the CI dashboard
[ Albert Astals ]
* Adapt to new TabBar
[ Michael Terry ]
* Re-enable test_networkmanager_integration autopilot test on phone
  platforms
[ CI bot ]
* Resync trunk
[ Leo Arias ]
* Reverted the open_preview autopilot helper to return a Preview
  object.
[ Albert Astals ]
* If not running in Mir load the "fake" application manager (LP:
  #1301547)
* Remove unused properties from DashRenderer
[ Michael Zanetti ]
* Fix tests after right edge merge. Drop old stages tests. Fix right
  edge tests if someone doesn't have the GRID_UNIT_PX exported. make
  GenericScopeView test more robust that broke because the ordering
  changed
* add "make xvfbtestSomething" target to run qml tests in xvfb
* make the "make test" commit hook work again
[ Michał Sawicz ]
* Bump version to ensure incompatibility with previous Unity.Application
  implementations.
* We'll only have the unity-mir and mock Ubuntu.Application plugins
  now, no need for mangling the import paths.
[ Michal Hruby ]
* Remove the albumart image provider. (LP: #1262711)
* Don't reset search string after 2 seconds. (LP: #1297246)
[ James Henstridge ]
* Remove the albumart image provider. (LP: #1262711)
[ Albert Astals ]
* Carousel: Add test to make sure we only create the needed delegates
  and not more
* LVWPH: Remove processEvents() call from updatePolish() It causes
  some reentrancy issues and in some times you end up in polishItems()
  with items that have been deleted because you called processEvents()
  This means i need a small tweak in itemGeometryChanged to not
  reposition items if we are inside a setContentHeight call and two
  small tweaks to tests since now things happen in a different order
  and numbers are different (though equivalent) (LP: #1297240)
* Card.qml binding loops are gone. hooray \o/ Also made the aspect
  properties readonly
[ Mirco Müller ]
* A potential fix for "Cannot read property 'state' of null"-failure
  on Jenkins with the VisualSnapDecisionsQueue QML-test of
  notifications.
[ Michael Terry ]
* Pass user's preference for auto-brightness on to powerd. (LP:
  #1273174)
[ Michael Zanetti ]
* Registers a dummy QObject as QTestRootObject in uqmlscene in order
  to fix make trySomething with Qt 5.2.
* For now, have libunity-private depending on libunity-core-6.0-9 as the
  gsettings schema is here. The dependency wasn't direct and dropped from
  Touch image #271. Consequently, unity8 didn't start (gsettings
  segfaulting).
  Proper strategy will be to include the schema in another package to only
  pull it.

751. By Ying-Chun Liu on 2014-04-22

re-factor

752. By Ying-Chun Liu on 2014-04-22

fix whitespace

Albert Astals Cid (aacid) wrote :

Does not seem to work.

How did i test it:
 * Set zoomable: true in PreviewZoomableImage
 * Run it on the phone
 * Go to the music scope and preview a song from Grooveshark that has the non default image ("Sail" in my case)
 * Try to do some zooming around
 * Doesn't work

review: Needs Fixing
lp:~paulliu/unity8/zoomImage updated
753. By Ying-Chun Liu on 2014-04-25

Fix weirdness centering.

Albert Astals Cid (aacid) wrote :

This is the original situation http://imgur.com/txGuDoa and this after i do some zoom+pan http://imgur.com/P0NyuLo

I don't think it makes sense I can pan "past" the image

review: Needs Fixing
lp:~paulliu/unity8/zoomImage updated
754. By Ying-Chun Liu on 2014-04-30

Fix strange drag out of bound.

Albert Astals Cid (aacid) wrote :

Code looks good, it changes PreviewZoomableImage to be aligned to the left to be center aligned, it looks ok to me but i remember we had that in the past and then reverted it so i'm going to approve here but leave un-top approved to let Saviq comment on it.

* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, looks good to me

* Did CI run pass? If not, please explain why.
No, seems mako is stuck in the past or something :/

review: Approve
Albert Astals Cid (aacid) wrote :

since i can't find a case in which it regresses and i've been playing with it a bit in the scenario it made it fail last time we tried using a LazyImage there i'm going to top-approve it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/LazyImage.qml'
2--- qml/Components/LazyImage.qml 2014-03-21 10:48:42 +0000
3+++ qml/Components/LazyImage.qml 2014-04-30 13:51:56 +0000
4@@ -36,6 +36,7 @@
5 property alias cache: image.cache
6 property alias horizontalAlignment: image.horizontalAlignment
7 property alias verticalAlignment: image.verticalAlignment
8+ property alias sourceImage: image
9
10 state: "default"
11
12
13=== added file 'qml/Components/ZoomableImage.qml'
14--- qml/Components/ZoomableImage.qml 1970-01-01 00:00:00 +0000
15+++ qml/Components/ZoomableImage.qml 2014-04-30 13:51:56 +0000
16@@ -0,0 +1,153 @@
17+/*
18+ * Copyright (C) 2014 Canonical, Ltd.
19+ *
20+ * This program is free software; you can redistribute it and/or modify
21+ * it under the terms of the GNU General Public License as published by
22+ * the Free Software Foundation; version 3.
23+ *
24+ * This program is distributed in the hope that it will be useful,
25+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
26+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+ * GNU General Public License for more details.
28+ *
29+ * You should have received a copy of the GNU General Public License
30+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
31+ */
32+
33+import QtQuick 2.0
34+import Ubuntu.Components 0.1
35+import "../Components"
36+
37+/*! \brief Zoomable for image.
38+
39+ This widget shows image contained in source,
40+ can be zoomable accordingly with zoomable.
41+ */
42+
43+Item {
44+ id: root
45+ property alias source: lazyImage.source
46+ property var zoomable: false
47+ property alias imageState: lazyImage.state
48+ property alias scaleTo: lazyImage.scaleTo
49+ property alias asynchronous: lazyImage.asynchronous
50+
51+ Flickable {
52+ id: flickable
53+ objectName: "flickable"
54+ clip: true
55+ contentHeight: imageContainer.height
56+ contentWidth: imageContainer.width
57+
58+ onHeightChanged: image.resetScale()
59+ onWidthChanged: image.resetScale()
60+ anchors.fill: parent
61+
62+ Item {
63+ id: imageContainer
64+ objectName: "imageContainer"
65+ width: Math.max(image.width * image.scale, flickable.width)
66+ height: Math.max(image.height * image.scale, flickable.height)
67+
68+ Item {
69+ id: image
70+ objectName: "image"
71+ property alias imageState: lazyImage.state
72+ property var prevScale
73+ anchors.centerIn: parent
74+
75+ signal imageReloaded
76+
77+ LazyImage {
78+ id: lazyImage
79+ objectName: "lazyImage"
80+ smooth: !flickable.movingVertically
81+ anchors.fill: parent
82+ fillMode: Image.PreserveAspectFit
83+ scaleTo: "fit"
84+
85+ onStateChanged: {
86+ if (state == "ready") {
87+ image.imageReloaded();
88+ }
89+ }
90+ }
91+
92+ onImageReloaded: {
93+ image.height = lazyImage.sourceImage.implicitHeight
94+ image.width = lazyImage.sourceImage.implicitWidth
95+ image.resetScale();
96+ }
97+
98+ function resetScale() {
99+ image.scale = Math.min(flickable.width / image.width, flickable.height / image.height);
100+ pinchArea.minScale = image.scale;
101+ prevScale = Math.min(image.scale, 1);
102+ }
103+
104+ onScaleChanged: {
105+ var currentWidth = width * scale
106+ var currentHeight = height * scale
107+ var scaleRatio = scale / prevScale
108+ if (currentWidth > flickable.width) {
109+ var xpos = flickable.width / 2 + flickable.contentX;
110+ var xoff = xpos * scaleRatio;
111+ flickable.contentX = xoff - flickable.width / 2;
112+ }
113+ if (currentHeight > flickable.height) {
114+ var ypos = flickable.height / 2 + flickable.contentY;
115+ var yoff = ypos * scaleRatio;
116+ flickable.contentY = yoff - flickable.height / 2;
117+ }
118+ prevScale = scale;
119+ }
120+ }
121+ }
122+
123+ PinchArea {
124+ id: pinchArea
125+ objectName: "pinchArea"
126+ property real minScale: 1.0
127+ anchors.fill: parent
128+ enabled: zoomable ? zoomable : false
129+
130+ pinch.target: image
131+ pinch.minimumScale: minScale
132+ pinch.maximumScale: 10
133+
134+ onPinchFinished: flickable.returnToBounds()
135+ }
136+
137+ MouseArea {
138+ id: mouseArea
139+ objectName: "mouseArea"
140+
141+ anchors.fill: parent
142+ enabled: zoomable ? zoomable : false
143+
144+ onWheel: {
145+ var startScale = image.scale;
146+ if (wheel.angleDelta.y > 0) {
147+ image.scale = startScale + 0.1;
148+ } else if (wheel.angleDelta.y < 0) {
149+ if (image.scale > 0.1 && image.scale > pinchArea.minScale) {
150+ image.scale = startScale - 0.1;
151+ }
152+ }
153+ wheel.accepted = true;
154+ }
155+
156+ onPressed: {
157+ mouse.accepted = false;
158+ }
159+
160+ onReleased: {
161+ mouse.accepted = false;
162+ }
163+
164+ onClicked: {
165+ mouse.accepted = false;
166+ }
167+ }
168+ }
169+}
170
171=== modified file 'qml/Dash/Previews/PreviewZoomableImage.qml'
172--- qml/Dash/Previews/PreviewZoomableImage.qml 2014-02-21 18:41:37 +0000
173+++ qml/Dash/Previews/PreviewZoomableImage.qml 2014-04-30 13:51:56 +0000
174@@ -28,14 +28,11 @@
175 id: root
176 implicitHeight: units.gu(22)
177
178- LazyImage {
179+ ZoomableImage {
180+ id: image
181 objectName: "image"
182- anchors {
183- top: parent.top
184- bottom: parent.bottom
185- }
186- scaleTo: "height"
187 source: widgetData["source"]
188- initialWidth: units.gu(13)
189+ zoomable: widgetData["zoomable"] ? widgetData["zoomable"] : false
190+ anchors.fill: parent
191 }
192 }
193
194=== modified file 'tests/qmltests/CMakeLists.txt'
195--- tests/qmltests/CMakeLists.txt 2014-04-22 08:51:33 +0000
196+++ tests/qmltests/CMakeLists.txt 2014-04-30 13:51:56 +0000
197@@ -32,6 +32,7 @@
198 add_qml_test(Components SeeMore)
199 add_qml_test(Components Showable)
200 add_qml_test(Components PageHeaderLabel)
201+add_qml_test(Components ZoomableImage)
202 add_qml_test(Dash Dash IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
203 add_qml_test(Dash DashContent IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
204 add_qml_test(Dash Card)
205
206=== added file 'tests/qmltests/Components/tst_ZoomableImage.qml'
207--- tests/qmltests/Components/tst_ZoomableImage.qml 1970-01-01 00:00:00 +0000
208+++ tests/qmltests/Components/tst_ZoomableImage.qml 2014-04-30 13:51:56 +0000
209@@ -0,0 +1,192 @@
210+/*
211+ * Copyright 2014 Canonical Ltd.
212+ *
213+ * This program is free software; you can redistribute it and/or modify
214+ * it under the terms of the GNU General Public License as published by
215+ * the Free Software Foundation; version 3.
216+ *
217+ * This program is distributed in the hope that it will be useful,
218+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
219+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
220+ * GNU General Public License for more details.
221+ *
222+ * You should have received a copy of the GNU General Public License
223+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
224+ */
225+
226+import QtQuick 2.0
227+import QtTest 1.0
228+import "../../../qml/Components"
229+import Unity.Test 0.1 as UT
230+
231+Rectangle {
232+ id: root
233+ width: units.gu(30)
234+ height: units.gu(60)
235+ color: "lightgrey"
236+
237+ property var widgetData0: {
238+ "source": "",
239+ "zoomable": false
240+ }
241+
242+ property var widgetData1: {
243+ "source": "../../../qml/graphics/phone_background.jpg",
244+ "zoomable": false
245+ }
246+
247+ property var widgetData2: {
248+ "source": "../../../qml/Dash/graphics/phone/screenshots/gallery@12.png",
249+ "zoomable": true
250+ }
251+
252+ ZoomableImage {
253+ id: zoomableImage
254+ width: parent.width
255+ anchors.fill: parent
256+ asynchronous: false
257+ }
258+
259+ SignalSpy {
260+ id: signalSpy
261+ }
262+
263+ UT.UnityTestCase {
264+ name: "ZoomableImageTest"
265+ when: windowShown
266+
267+ function test_loadImage() {
268+ var lazyImage = findChild(zoomableImage, "lazyImage");
269+
270+ zoomableImage.source = widgetData0["source"];
271+ zoomableImage.zoomable = widgetData0["zoomable"];
272+ waitForRendering(zoomableImage);
273+ tryCompare(zoomableImage, "imageState", "default");
274+
275+ signalSpy.signalName = "onStateChanged";
276+ signalSpy.target = lazyImage;
277+ signalSpy.clear();
278+
279+ zoomableImage.source = widgetData1["source"];
280+ zoomableImage.zoomable = widgetData1["zoomable"];
281+ waitForRendering(lazyImage);
282+ tryCompareFunction(function() { return get_filename(lazyImage.source.toString()) === get_filename(widgetData1["source"]); }, true);
283+ waitForRendering(zoomableImage);
284+ tryCompare(zoomableImage, "imageState", "ready");
285+ compare (signalSpy.count, 1);
286+ }
287+
288+ function get_filename(a) {
289+ var wordsA = a.split("/");
290+ var filenameA = wordsA[wordsA.length-1];
291+ return filenameA;
292+ }
293+
294+ function test_mousewheel() {
295+ var image = findChild(zoomableImage, "image");
296+ var lazyImage = findChild(zoomableImage, "lazyImage");
297+ var flickable = findChild(zoomableImage, "flickable");
298+
299+ zoomableImage.source = widgetData2["source"];
300+ zoomableImage.zoomable = true;
301+ waitForRendering(zoomableImage);
302+
303+ tryCompare(zoomableImage, "imageState", "ready");
304+ tryCompareFunction(function() { return get_filename(lazyImage.source.toString()) === get_filename(widgetData2["source"]); }, true);
305+ waitForRendering(image);
306+
307+ // move mouse to center
308+ mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
309+
310+ // Test Zoom-in Zoom-out twice.
311+ for (var c=0; c<2; c++) {
312+ // zoom in
313+ for (var i=0; i<10; i++) {
314+ mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, 10);
315+ tryCompare(image, "scale", 1.0 + (i + 1) * 0.1);
316+ compare(flickable.contentWidth, lazyImage.width * image.scale);
317+ compare(flickable.contentHeight, lazyImage.height * image.scale);
318+ }
319+
320+ // zoom out
321+ for (var i=0; i<10; i++) {
322+ mouseWheel(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2, 0, -10);
323+ tryCompare(image, "scale", 2.0 - (i + 1) * 0.1);
324+ compare(flickable.contentWidth, lazyImage.width * image.scale);
325+ compare(flickable.contentHeight, lazyImage.height * image.scale);
326+ }
327+ }
328+ }
329+
330+ function test_pinch_data() {
331+ return [ { source:widgetData2["source"],
332+ zoomable:false,
333+ answer1: true,
334+ answer2: false,
335+ answer3: true,
336+ answer4: 1.0,
337+ answer5: 1.0 },
338+ { source:widgetData2["source"],
339+ zoomable:true,
340+ answer1: false,
341+ answer2: true,
342+ answer3: false,
343+ answer4: 1.7740461882048026,
344+ answer5: 1.0 }
345+ ]
346+ }
347+
348+ function test_pinch(data) {
349+ var image = findChild(zoomableImage, "image");
350+ var lazyImage = findChild(zoomableImage, "lazyImage");
351+ var flickable = findChild(zoomableImage, "flickable");
352+
353+ signalSpy.signalName = "onScaleChanged";
354+ signalSpy.target = image;
355+ signalSpy.clear();
356+
357+ zoomableImage.source = data.source;
358+ zoomableImage.zoomable = data.zoomable;
359+ waitForRendering(zoomableImage);
360+
361+ tryCompare(zoomableImage, "imageState", "ready");
362+ tryCompareFunction(function() { return get_filename(lazyImage.source.toString()) === get_filename(data.source); }, true);
363+ waitForRendering(image);
364+
365+ var x1Start = zoomableImage.width * 2 / 6;
366+ var y1Start = zoomableImage.height * 2 / 6;
367+ var x1End = zoomableImage.width * 1 / 6;
368+ var y1End = zoomableImage.height * 1 / 6;
369+ var x2Start = zoomableImage.width * 4 / 6;
370+ var y2Start = zoomableImage.height * 4 / 6;
371+ var x2End = zoomableImage.width * 5 / 6;
372+ var y2End = zoomableImage.height * 5 / 6;
373+
374+ var oldScale = image.scale;
375+
376+ // move mouse to center
377+ mouseMove(zoomableImage, zoomableImage.width / 2, zoomableImage.height / 2);
378+
379+ // Test Zoom-in Zoom-out twice.
380+ for (var c=0; c<2; c++) {
381+ wait(3000); // have to delay between two consequent pinch event.
382+ // pinch zoom-in
383+ touchPinch(zoomableImage, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End);
384+
385+ tryCompare(image, "scale", data.answer4);
386+ var newScale = image.scale;
387+ compare(newScale == oldScale, data.answer1, "scale factor not equal: "+ oldScale + "=?" + newScale);
388+ compare(newScale > oldScale, data.answer2, "scale factor didn't changed");
389+ compare(signalSpy.count == 0, data.answer3, "scale signal count error");
390+ compare(newScale, data.answer4, "scale factor error");
391+ compare(flickable.contentWidth, lazyImage.width * image.scale);
392+ compare(flickable.contentHeight, lazyImage.height * image.scale);
393+
394+ wait(3000); // have to delay between two consequent pinch event.
395+ // pinch zoom-out
396+ touchPinch(zoomableImage, x1End, y1End, x1Start, y1Start, x2End, y2End, x2Start, y2Start);
397+ tryCompare(image, "scale", data.answer5);
398+ }
399+ }
400+ }
401+}
402
403=== modified file 'tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml'
404--- tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml 2014-03-03 10:43:23 +0000
405+++ tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml 2014-04-30 13:51:56 +0000
406@@ -36,7 +36,8 @@
407
408 PreviewZoomableImage {
409 id: zoomableImage
410- width: parent.width
411+ anchors.fill: parent
412+ widgetData: widgetData1
413 }
414
415 UT.UnityTestCase {
416@@ -47,10 +48,12 @@
417 var image = findChild(zoomableImage, "image");
418
419 zoomableImage.widgetData = widgetData0;
420- tryCompare(image, "state", "default");
421+ waitForRendering(zoomableImage);
422+ tryCompare(image, "imageState", "default");
423
424 zoomableImage.widgetData = widgetData1;
425- tryCompare(image, "state", "ready");
426+ waitForRendering(zoomableImage);
427+ tryCompare(image, "imageState", "ready");
428 }
429 }
430 }
431
432=== modified file 'tests/utils/modules/Unity/Test/UnityTestCase.qml'
433--- tests/utils/modules/Unity/Test/UnityTestCase.qml 2014-02-28 15:15:21 +0000
434+++ tests/utils/modules/Unity/Test/UnityTestCase.qml 2014-04-30 13:51:56 +0000
435@@ -260,6 +260,32 @@
436 }
437 }
438
439+ function touchPinch(item, x1Start, y1Start, x1End, y1End, x2Start, y2Start, x2End, y2End) {
440+ // Make sure the item is rendered
441+ waitForRendering(item);
442+
443+ var event1 = touchEvent();
444+ // first finger
445+ event1.press(0, x1Start, y1Start);
446+ event1.commit();
447+ // second finger
448+ event1.stationary(0);
449+ event1.press(1, x2Start, y2Start);
450+ event1.commit();
451+
452+ // pinch
453+ for (var i = 0.0; i < 1.0; i += 0.02) {
454+ event1.move(0, x1Start + (x1End - x1Start) * i, y1Start + (y1End - y1Start) * i);
455+ event1.move(1, x2Start + (x2End - x2Start) * i, y2Start + (y2End - y2Start) * i);
456+ event1.commit();
457+ }
458+
459+ // release
460+ event1.release(0, x1End, y1End);
461+ event1.release(1, x2End, y2End);
462+ event1.commit();
463+ }
464+
465 function fetchRootItem(item) {
466 if (item.parent)
467 return fetchRootItem(item.parent)

Subscribers

People subscribed via source and target branches