Merge lp:~tomas-tormo/unity8/bug_1378814 into lp:unity8

Proposed by Tomás Tormo
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2607
Merged at revision: 2692
Proposed branch: lp:~tomas-tormo/unity8/bug_1378814
Merge into: lp:unity8
Diff against target: 320 lines (+139/-31)
4 files modified
qml/Greeter/Infographics.qml (+25/-3)
tests/mocks/libusermetrics/UserMetrics.cpp (+33/-13)
tests/mocks/libusermetrics/UserMetrics.h (+2/-0)
tests/qmltests/Greeter/tst_Infographics.qml (+79/-15)
To merge this branch: bzr merge lp:~tomas-tormo/unity8/bug_1378814
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+303874@code.launchpad.net

Commit message

Reload Infographics userdata when the day changes

Description of the change

Reload infographic notification when the device is unlocked

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Hi Tomás, thanks for your patch.

We can only accept patches for Unity8 if the person has signed the
Canonical contributor licence agreement http://www.ubuntu.com/legal/contributors

As far as I can see you have not so you should do it before we can continue reviewing your code.

Thanks for helping improve unity8 :)

review: Needs Information
Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

Hi Albert!!

I'm signing it right, now, but is asking for a Project contact...what
should I put there?

Thanks!!

On 26/08/16 15:23, Albert Astals Cid wrote:
> Review: Needs Information
>
> Hi Tomás, thanks for your patch.
>
> We can only accept patches for Unity8 if the person has signed the
> Canonical contributor licence agreement http://www.ubuntu.com/legal/contributors
>
> As far as I can see you have not so you should do it before we can continue reviewing your code.
>
> Thanks for helping improve unity8 :)

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

Hi Albert!

I had a look to

    http://www.canonical.com/projects/directory

and saw that Kevin Gunn is the contact for the unity8 project, so I put
his name there :)

I already signed the contract! Thank you for giving me the opportunity
to contribute to this fantastic project!

Tomas

On 26/08/16 17:00, Tomás Tormo wrote:
> Hi Albert!!
>
> I'm signing it right, now, but is asking for a Project contact...what
> should I put there?
>
> Thanks!!
>
> On 26/08/16 15:23, Albert Astals Cid wrote:
>> Review: Needs Information
>>
>> Hi Tomás, thanks for your patch.
>>
>> We can only accept patches for Unity8 if the person has signed the
>> Canonical contributor licence agreement http://www.ubuntu.com/legal/contributors
>>
>> As far as I can see you have not so you should do it before we can continue reviewing your code.
>>
>> Thanks for helping improve unity8 :)
>

lp:~tomas-tormo/unity8/bug_1378814 updated
2598. By Tomás Tormo

Add unit test for new day detection and set in infographics

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

New commit with the following changes:

* Added unit test to check that the current day retrieved from the InfographicModel is correctly set
* Modified test_set_username function data: Removed first row as currently the label is not being modified by the infographicModel when the username changes, remaining blank

Revision history for this message
Albert Astals Cid (aacid) wrote :

The fact that you needed to change test_set_username_data shows you've broken that functionality since the test passes without your code changes.

Also your new test is testing the currentDay is set correctly, but that's mostly an implementation detail, what you want to check is that the label has changed to the correct values, no?

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
Download full text (3.3 KiB)

FAILED: Continuous integration, rev:2598
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tomas-tormo/unity8/bug_1378814/+merge/303874/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2057/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2703
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1487
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1487
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1487
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2731
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2604
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2604
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2604
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2597
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2597/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2597
   ...

Read more...

review: Needs Fixing (continuous-integration)
Revision history for this message
Tomás Tormo (tomas-tormo) wrote :
Download full text (4.9 KiB)

Hi Albert

The test was failing in my computer... After some little research I saw
that was the problem... That's why I made that change.. I'll revert it but
I want to know why is that! :S

About the test_set_username_data, I wanted to make sure that the
dataChanged signal was being fired when a new day was detected.

For this, my idea was first to set the currentDay property and then call
the infographics object as it's being called now (I'm talking from the top
of my mind, I don't have the code with me now)

This should reload the label content from the next UserMetrics data source.
The problem is that no signal was being fired in the unit test (while it
was correctly fired when testing in the phone).

I also thought about mocking the UserMetrics object to make sure that the
nextUserData function was called, but finally I preferred to do a simple
test first, and then discuss with you about the mock possibility , since
the change can be pretty deep.

And now the worst part... I'll be out for a couple of weeks, so I won't be
able to change anything till the middle of September... So if this bug can
wait is perfect for me, if not, feel free to assign it to other person

Thank you very much for your help :)

El mar., 30 ago. 2016 12:31, Unity8 CI Bot <email address hidden>
escribió:

> Review: Needs Fixing continuous-integration
>
> FAILED: Continuous integration, rev:2598
> No commit message was specified in the merge proposal. Click on the
> following link and set the commit message (if you want a jenkins rebuild
> you need to trigger it yourself):
>
> https://code.launchpad.net/~tomas-tormo/unity8/bug_1378814/+merge/303874/+edit-commit-message
>
> https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2057/
> Executed test runs:
> SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2703
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1487
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1487
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1487
> SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2731
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2604
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2604
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2604
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2597
> deb:
> https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2597/artifact/output/*zip*/output.zip
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2597
> deb:
> https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2597/artifact/output/*zip*/output.zip
> SUCCESS:
> https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2597
>...

Read more...

Revision history for this message
Albert Astals Cid (aacid) wrote :

UserMetrics is already mocked, see mocks/libusermetrics/UserMetrics.cpp

It may be that the mock has some shortcomings that need fixing.

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

Great then! I didn't see that since I only had a short time last night to
review the bug...

I'll have a look as soon as I'm back

Thank you very much :)

El mar., 30 ago. 2016 14:54, Albert Astals Cid <email address hidden>
escribió:

> UserMetrics is already mocked, see mocks/libusermetrics/UserMetrics.cpp
>
> It may be that the mock has some shortcomings that need fixing.
> --
> https://code.launchpad.net/~tomas-tormo/unity8/bug_1378814/+merge/303874
> You are the owner of lp:~tomas-tormo/unity8/bug_1378814.
>

Revision history for this message
Albert Astals Cid (aacid) wrote :

ping?

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

Pong! :)

Unfortunately the time out took longer than expected... I came back
yesterday and I'm settling down, so I expect to start again with the bugs
(this one and many more :)) this afternoon.

Thanks for the wait and sorry for the inconvenience... :S

Tomas

El vie., 30 sept. 2016 10:11, Albert Astals Cid <email address hidden>
escribió:

> ping?
> --
> https://code.launchpad.net/~tomas-tormo/unity8/bug_1378814/+merge/303874
> You are the owner of lp:~tomas-tormo/unity8/bug_1378814.
>

lp:~tomas-tormo/unity8/bug_1378814 updated
2599. By Tomás Tormo

* debian/control:
  - Drop unity-scope-mediascanner2 to a Suggests rather than a Recommends,
    to ease our transition to main. It's already seeded directly in
    Touch, so this will only affect the Desktop variant of unity8.

2600. By Tomás Tormo

Reload infographics object before each test

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

I've pushed new changes to address what you told me. The branch has been updated to the last revision in order to make sure that the changes doesn't brake anything.

Please, have a look at them when you have time for this :)

Thank you very much

Revision history for this message
Albert Astals Cid (aacid) wrote :

The new test is a bit suboptimal, the only thing that the test checks is that the currentDay variable has the value you want, but that's not what we care about, what we care about is that the "Reload infographic notification when the device is unlocked", i.e. there should be something that triggers startShowAnimation and then you check stuff changed.

Do I make sense?

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

FAILED: Continuous integration, rev:2600
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tomas-tormo/unity8/bug_1378814/+merge/303874/+edit-commit-message

https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2351/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3094
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1739
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1739
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1739
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3122
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2978/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2978
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2978/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
lp:~tomas-tormo/unity8/bug_1378814 updated
2601. By Tomás Tormo

Reset UserMetrics and Infographic state for each test. Check that user data is correctly updated when the day changes

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

You are totally right.

I changed the implementation to check that the user data is correctly reloaded when the day changes. Moreover, I also modified the UserMetrics mock to add a function which resets its state. In this way, each test starts with a fresh environment.

Please, have a look when you have time :)

Thank you very much

lp:~tomas-tormo/unity8/bug_1378814 updated
2602. By Tomás Tormo

Sync po/oc.po file with trunk

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

PASSED: Continuous integration, rev:2601
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2355/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3106
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1751
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1751
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1751
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3134
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2990/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2990
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2990/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

I've reverted the po/oc.po file, since I accidentally committed an outdated version which was breaking the build in CI...

Sorry for that :S

Revision history for this message
Albert Astals Cid (aacid) wrote :

Are you sure that this actually fixes the bug?

I don't see startShowAnimation being triggered either on "day has changed" or on "i'm going out of 'sleep' to show the greeter".

review: Needs Information
lp:~tomas-tormo/unity8/bug_1378814 updated
2603. By Tomás Tormo

Reload Infographics userdata when the screen turns on in case the day changed

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

I've updated the source code to the last revision and now the changes does not solve the bug, since the currentDay variable is reset each time the user turns the screen off (the Greeter is reloaded)

I've changed the implementation to detect the turn screen on event. Each time this happens, a day change is detected, and in that case, the infographics userdata is reloaded.

Please, have a look when you have time :)

Thank you very much

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

FAILED: Continuous integration, rev:2603
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2411/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3164
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1803
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1803
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1803
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3192
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3048/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3048
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/3048/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

I need to ask around if we're supposed to show infographics data on the desktop too, because otherwise relying on the power button may not be the optimal solution since you may have your screen set to not go to sleep and we should still change the infographics value when the day changes.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Yes, since we need to support the Greeter on the desktop too it's better if we don't use the Powerd status change and instead we use a LiveTimer {} object with frequency: LiveTimer.Hour

https://developer.ubuntu.com/api/apps/qml/sdk-15.04.3/Ubuntu.Components.LiveTimer/

review: Needs Fixing
lp:~tomas-tormo/unity8/bug_1378814 updated
2604. By Tomás Tormo

Sync to trunk

2605. By Tomás Tormo

Use a LiveTimer instead of the screen state to detect a new day, so the solution is valid also for the desktop version

2606. By Tomás Tormo

Remove unnecessary imports

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

As you suggested, I changed the Powerd connection solution to the LiveTimer one. I also changed the test to reflect this change. Both base code and test have been tested locally.

Thank you :)

Revision history for this message
Albert Astals Cid (aacid) wrote :

The setDay function in the mock is not needed anymore, right?

review: Needs Fixing
Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

Yes, certainly is not needed anymore, however, it allows the day to be injected to the mock from the testcase. This makes the mock's behavior more deterministic as it can be directly controlled from outside. Future test cases that depend on the day may benefit from it.

However, if you think that it shouldn't be there because it's not used right now, let me know and I'll remove it :)

Revision history for this message
Albert Astals Cid (aacid) wrote :

I'd prefer if we have the "minimal code" needed to fix the issue, so yes please remove it (sorry i pointed you in the wrong direction at first)

lp:~tomas-tormo/unity8/bug_1378814 updated
2607. By Tomás Tormo

Remove unnecessary setDay function from the UserMetrics mock

Revision history for this message
Tomás Tormo (tomas-tormo) wrote :

No problem at all!

I'll removed the function and everything related with it. Tests are passing locally.

Let me know if you see anything else :)

Thank you

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good, i maually triggered CI to see if everything is good also from that perspective.

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

FAILED: Continuous integration, rev:2607
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2454/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3226
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1850
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1850
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/1850
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3254
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3108/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3108
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3108/artifact/output/*zip*/output.zip

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

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

 * Did CI run pass? If not, please explain why.
No, but it's unrelated Launcher failures.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Greeter/Infographics.qml'
2--- qml/Greeter/Infographics.qml 2016-09-07 17:13:38 +0000
3+++ qml/Greeter/Infographics.qml 2016-10-27 09:20:50 +0000
4@@ -25,6 +25,8 @@
5
6 property int animDuration: 10
7
8+ property int currentWeekDay
9+
10 QtObject {
11 id: d
12 objectName: "infographicPrivate"
13@@ -56,6 +58,24 @@
14 onDataDisappeared: startShowAnimation() // show "no data" label
15 }
16
17+ LiveTimer {
18+ frequency: LiveTimer.Hour
19+ onTrigger: handleTimerTrigger()
20+ }
21+
22+ function handleTimerTrigger(){
23+ var today = new Date().getDay()
24+ if(infographic.currentWeekDay !== today){
25+ infographic.currentWeekDay = today
26+ reloadUserData();
27+ }
28+ }
29+
30+ function reloadUserData(){
31+ d.useDotAnimation = false
32+ infographic.model.nextDataSource()
33+ }
34+
35 function startShowAnimation() {
36 dotHideAnimTimer.stop()
37 notification.hideAnim.stop()
38@@ -81,7 +101,10 @@
39
40 visible: model.username !== ""
41
42- Component.onCompleted: startShowAnimation()
43+ Component.onCompleted: {
44+ currentWeekDay = new Date().getDay()
45+ startShowAnimation()
46+ }
47
48 Item {
49 id: dataCircle
50@@ -405,8 +428,7 @@
51
52 onDoubleClicked: {
53 if (!d.animating) {
54- d.useDotAnimation = false
55- infographic.model.nextDataSource()
56+ reloadUserData()
57 }
58 }
59 }
60
61=== modified file 'tests/mocks/libusermetrics/UserMetrics.cpp'
62--- tests/mocks/libusermetrics/UserMetrics.cpp 2016-05-26 13:15:35 +0000
63+++ tests/mocks/libusermetrics/UserMetrics.cpp 2016-10-27 09:20:50 +0000
64@@ -88,12 +88,16 @@
65 void setUsername(const QString &username);
66
67 protected:
68+ void findAndSetUsername(const QString &username);
69+
70 void nextFakeData();
71
72 void generateFakeData();
73
74 void loadFakeData();
75
76+ void loadUserMetricsData();
77+
78 void finishSetFakeData();
79
80 private:
81@@ -131,7 +135,7 @@
82 }
83
84 UserMetricsDataPrivate::UserMetricsDataPrivate(UserMetricsData *parent) :
85- q_ptr(parent), m_firstColor(this), m_secondColor(this)
86+ q_ptr(parent), m_label(""), m_firstColor(this), m_secondColor(this)
87 {
88 m_length = calculateLength();
89 }
90@@ -229,12 +233,8 @@
91 {
92 }
93
94-void UserMetricsPrivate::setUsername(const QString &username)
95+void UserMetricsPrivate::findAndSetUsername(const QString &username)
96 {
97- if (m_username == username && m_newData) {
98- return;
99- }
100-
101 m_username = username;
102
103 m_dataIndex = m_fakeData.constFind(m_username);
104@@ -243,6 +243,16 @@
105 m_dataIndex = m_fakeData.constFind("");
106 }
107
108+ m_newData = *m_dataIndex;
109+}
110+
111+void UserMetricsPrivate::setUsername(const QString &username)
112+{
113+ if (m_username == username && m_newData) {
114+ return;
115+ }
116+
117+ findAndSetUsername(username);
118 loadFakeData();
119
120 q_ptr->usernameChanged(m_username);
121@@ -332,7 +342,6 @@
122
123 void UserMetricsPrivate::loadFakeData()
124 {
125- m_newData = *m_dataIndex;
126
127 bool oldLabelEmpty = m_label.isEmpty();
128 bool newLabelEmpty = m_newData->label().isEmpty();
129@@ -351,24 +360,28 @@
130 // we emit no signal if the data has stayed empty
131 }
132
133-void UserMetricsPrivate::finishSetFakeData()
134+void UserMetricsPrivate::loadUserMetricsData()
135 {
136- bool oldLabelEmpty = m_label.isEmpty();
137- bool newLabelEmpty = m_newData->label().isEmpty();
138-
139 m_label = m_newData->label();
140 m_firstColor = m_newData->firstColor();
141 m_firstMonth.setVariantList(m_newData->firstMonth());
142 m_secondColor = m_newData->secondColor();
143 m_secondMonth.setVariantList(m_newData->secondMonth());
144+ m_currentDay = m_newData->length();
145+}
146
147+void UserMetricsPrivate::finishSetFakeData()
148+{
149+ bool oldLabelEmpty = m_label.isEmpty();
150+ bool newLabelEmpty = m_newData->label().isEmpty();
151 bool currentDayChanged = m_currentDay != m_newData->length();
152- m_currentDay = m_newData->length();
153+
154+ loadUserMetricsData();
155
156 q_ptr->labelChanged(m_label);
157 if (currentDayChanged)
158 {
159- q_ptr->currentDayChanged(m_currentDay);
160+ q_ptr->currentDayChanged(m_currentDay);
161 }
162
163 if (oldLabelEmpty && !newLabelEmpty)
164@@ -396,6 +409,7 @@
165 }
166 }
167
168+ m_newData = *m_dataIndex;
169 loadFakeData();
170 }
171
172@@ -464,6 +478,12 @@
173 d_ptr->finishSetFakeData();
174 }
175
176+void UserMetrics::reset()
177+{
178+ d_ptr->findAndSetUsername("");
179+ d_ptr->loadUserMetricsData();
180+}
181+
182 /**
183 * Factory methods
184 */
185
186=== modified file 'tests/mocks/libusermetrics/UserMetrics.h'
187--- tests/mocks/libusermetrics/UserMetrics.h 2013-06-14 19:35:25 +0000
188+++ tests/mocks/libusermetrics/UserMetrics.h 2016-10-27 09:20:50 +0000
189@@ -61,6 +61,8 @@
190
191 QAbstractItemModel *secondMonth() const;
192
193+ Q_INVOKABLE void reset();
194+
195 Q_SIGNALS:
196 void labelChanged(const QString &label);
197
198
199=== modified file 'tests/qmltests/Greeter/tst_Infographics.qml'
200--- tests/qmltests/Greeter/tst_Infographics.qml 2015-11-06 19:43:38 +0000
201+++ tests/qmltests/Greeter/tst_Infographics.qml 2016-10-27 09:20:50 +0000
202@@ -38,15 +38,62 @@
203 width: units.gu(120)
204 height: units.gu(120)
205
206+ Loader {
207+ id: loader
208+
209+ active: false
210+ anchors.fill: parent
211+
212+ property bool componentDestroyed: true
213+ sourceComponent: Component {
214+ Infographics {
215+ id: infographic
216+ width: loader.width
217+ height: loader.height
218+ model: infographicModel
219+
220+ Component.onDestruction: {
221+ loader.componentDestroyed = true
222+ }
223+ }
224+ }
225+ }
226+
227 UT.UnityTestCase {
228 name: "Infographics"
229 when: windowShown
230
231- property var dataCircle: findChild(infographic, "dataCircle")
232- property var dots: findChild(infographic, "dots")
233- property var label: findChild(infographic, "label")
234- property var presentCircles: findChild(infographic, "presentCircles")
235- property var pastCircles: findChild(infographic, "pastCircles")
236+ property var dataCircle
237+ property var dots
238+ property var label
239+ property var presentCircles
240+ property var pastCircles
241+ property var infographic
242+
243+ function reloadInfographic() {
244+ loader.active = false;
245+ tryCompare(loader, "status", Loader.Null);
246+ tryCompare(loader, "item", null);
247+ tryCompare(loader, "componentDestroyed", true);
248+ loader.active = true;
249+ tryCompare(loader, "status", Loader.Ready);
250+ loader.componentDestroyed = false
251+ infographic = loader.item
252+ }
253+
254+ function reloadModel() {
255+ infographicModel.reset()
256+ }
257+
258+ function init() {
259+ reloadModel()
260+ reloadInfographic()
261+ dataCircle = findChild(infographic, "dataCircle")
262+ dots = findChild(infographic, "dots")
263+ label = findChild(infographic, "label")
264+ presentCircles = findChild(infographic, "presentCircles")
265+ pastCircles = findChild(infographic, "pastCircles")
266+ }
267
268 function test_dot_states_data() {
269 return [
270@@ -74,9 +121,10 @@
271
272 function test_set_username_data() {
273 return [
274- { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
275- { username: "two-factor", label: "", visible: true },
276- { username: "", label: "", visible: false },
277+ { username: "has-password", label: "<b>19</b> minutes talk time", visible: true },
278+ { username: "two-factor", label: "", visible: true },
279+ { username: "", label: "", visible: false },
280+
281 ]
282 }
283
284@@ -85,13 +133,29 @@
285 tryCompare(label, "text", data.label)
286 compare(infographic.visible, data.visible);
287 }
288- }
289-
290- Infographics {
291- id: infographic
292-
293- anchors.fill: parent
294- model: infographicModel
295+
296+ function test_update_userdata_when_new_day_data()
297+ {
298+ return [
299+ { tag: "Same day", currentDayOffset: 0, label: "<b>19</b> minutes talk time" },
300+ { tag: "Different day", currentDayOffset: 1, label: "<b>33</b> messages today" },
301+ ]
302+ }
303+
304+ function test_update_userdata_when_new_day(data)
305+ {
306+ //Given
307+ var today = new Date().getDay()
308+ infographicModel.username = "single"
309+ infographic.currentWeekDay = (today - data.currentDayOffset)
310+
311+ //When
312+ infographic.handleTimerTrigger()
313+
314+ //Then
315+ tryCompare(infographic, "currentWeekDay", today)
316+ tryCompare(label, "text", data.label)
317+ }
318 }
319
320 Dot { id: dot }

Subscribers

People subscribed via source and target branches