Merge lp:~mzanetti/unity8/fix_snap_decision_test into lp:unity8
- fix_snap_decision_test
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~mzanetti/unity8/fix_snap_decision_test |
Merge into: | lp:unity8 |
Diff against target: |
2962 lines (+1086/-824) 68 files modified
plugins/AccountsService/AccountsService.qmltypes (+2/-0) plugins/Dash/Dash.qmltypes (+3/-0) plugins/LightDM/LightDM.qmltypes (+1/-0) plugins/Ubuntu/Payments/Payments.qmltypes (+1/-0) plugins/Unity/DashCommunicator/DashCommunicator.qmltypes (+17/-4) plugins/Unity/Indicators/CMakeLists.txt (+1/-0) plugins/Unity/Indicators/Indicators.qmltypes (+10/-7) plugins/Unity/Indicators/plugin.cpp (+8/-2) plugins/Unity/Indicators/plugin.h (+1/-1) plugins/Unity/Indicators/sharedunitymenumodel.cpp (+87/-0) plugins/Unity/Indicators/sharedunitymenumodel.h (+66/-0) plugins/Unity/Indicators/unitymenumodelcache.cpp (+28/-13) plugins/Unity/Indicators/unitymenumodelcache.h (+15/-9) plugins/Unity/Launcher/Launcher.qmltypes (+17/-12) plugins/Unity/Session/Session.qmltypes (+10/-0) plugins/Utils/Utils.qmltypes (+6/-0) qml/Greeter/Clock.qml (+9/-9) qml/Notifications/Notifications.qml (+1/-0) qml/Panel/Indicators/CachedUnityMenuModel.qml (+0/-39) qml/Panel/Indicators/IndicatorBase.qml (+2/-2) qml/Shell.qml (+1/-1) tests/mocks/AccountsService/AccountsService.qmltypes (+2/-0) tests/mocks/LightDM/LightDM.qmltypes (+1/-0) tests/mocks/QMenuModel/QMenuModel.qmltypes (+1/-1) tests/mocks/QMenuModel/unitymenumodel.cpp (+1/-2) tests/mocks/QMenuModel/unitymenumodel.h (+6/-2) tests/mocks/Ubuntu/Payments/Payments.qmltypes (+2/-0) tests/mocks/Ubuntu/Telephony/Telephony.qmltypes (+2/-1) tests/mocks/Unity/Application/Application.qmltypes (+13/-0) tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes (+2/-2) tests/mocks/Unity/Indicators/CMakeLists.txt (+3/-10) tests/mocks/Unity/Indicators/FakeMenuPage.qml (+0/-27) tests/mocks/Unity/Indicators/Indicators.qmltypes (+41/-11) tests/mocks/Unity/Indicators/IndicatorsModel.qml (+143/-35) tests/mocks/Unity/Indicators/RootActionState.qml (+17/-9) tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp (+60/-29) tests/mocks/Unity/Indicators/fakeindicatorsmodel.h (+8/-2) tests/mocks/Unity/Indicators/fakeplugin.cpp (+8/-4) tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp (+57/-0) tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h (+49/-0) tests/mocks/Unity/Indicators/indicators_fake.qrc (+0/-14) tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml (+0/-35) tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml (+0/-23) tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml (+0/-23) tests/mocks/Unity/Indicators/qmldir (+0/-1) tests/mocks/Unity/Launcher/Launcher.qmltypes (+13/-0) tests/mocks/Unity/Unity.qmltypes (+32/-0) tests/plugins/Unity/Indicators/CMakeLists.txt (+1/-0) tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp (+102/-0) tests/qmltests/CMakeLists.txt (+7/-8) tests/qmltests/Greeter/tst_Clock.qml (+57/-40) tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml (+0/-137) tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml (+21/-24) tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml (+0/-8) tests/qmltests/Panel/tst_IndicatorItem.qml (+1/-1) tests/qmltests/Panel/tst_IndicatorRow.qml (+17/-19) tests/qmltests/Panel/tst_Indicators.qml (+1/-0) tests/qmltests/Panel/tst_MenuContent.qml (+0/-8) tests/qmltests/tst_Shell.qml (+128/-40) tests/qmltests/tst_ShellWithPin.qml (+2/-0) tests/qmltests/tst_TabletShell.qml (+2/-0) |
To merge this branch: | bzr merge lp:~mzanetti/unity8/fix_snap_decision_test |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Michał Sawicz | Approve | ||
Josh Arenson | Approve | ||
Gerry Boland | Pending | ||
Michael Zanetti | Pending | ||
Review via email: mp+238238@code.launchpad.net |
This proposal supersedes a proposal from 2014-10-07.
This proposal has been superseded by a proposal from 2014-10-15.
Commit message
Fix lp:1370240 by making stages interactive when a snap decision is dismissed.
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
no
* Did you perform an exploratory manual test run of your code change and any related functionality?
yes
* Did you make sure that your branch does not contain spurious tags?
yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
no
* If you changed the UI, has there been a design review?
no
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1316
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal | # |
Testing this, it works fine!
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
fix looks great now. much better then the previous edition.
If possible, I think it would be worth adding a regression test for it still.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1316
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1321
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
6/17 Test #3: whitespace .......
/tmp/buildd/
Michael Zanetti (mzanetti) wrote : Posted in a previous version of this proposal | # |
I have reverted the actual fix and ran the test, it's still passing, so it doesn't really catch the bug.
Michał Sawicz (saviq) : | # |
Michał Sawicz (saviq) wrote : | # |
I constantly get:
FAIL! : qmltestrunner:
Actual (): false
Expected (): true
Loc: [/home/
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1323
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1324. By Michael Zanetti
-
merge trunk, update test to work with trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1324
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : | # |
"""
+ mouseClick(
"""
Please do "tap(buttonAccept)" instead to better emulate what happens on the device.
Daniel d'Andrada (dandrader) wrote : | # |
> """
> + mouseClick(
> """
>
> Please do "tap(buttonAccept)" instead to better emulate what happens on the
> device.
And no need to pass the position to tap() as it defaults to the center of the tapped item.
- 1325. By Michael Zanetti
-
revert back to activeFocus, make it a bit more robust
Michał Sawicz (saviq) wrote : | # |
This still failed to me. It seems to click the accept button too early and the notification doesn't close.
Michał Sawicz (saviq) wrote : | # |
and all the compare()s without tries feel a bit racy, too.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1325
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1326. By Michael Zanetti
-
cerry-pick fix over
- 1327. By Michael Zanetti
-
add more waitForRendering
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1326
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1327
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Josh Arenson (josharenson) wrote : | # |
Verified the fix works, tests pass, and couldn't reproduce what @saviq saw in #584819
However, I feel https:/
- 1328. By Michael Zanetti
-
wait for the notification to be expanded
- 1329. By Michael Zanetti
-
drop unneeded findChild
Michał Sawicz (saviq) wrote : | # |
* Did you perform an exploratory manual test run of the code change and any related functionality?
Y
* Did CI run pass? If not, please explain why.
Other than ap, which is in bad condition...
* Did you make sure that the branch does not contain spurious tags?
Y
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1329
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 1330. By Michael Zanetti
- 1331. By Michael Zanetti
-
fix bad merge
Unmerged revisions
Preview Diff
1 | === modified file 'plugins/AccountsService/AccountsService.qmltypes' | |||
2 | --- plugins/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000 | |||
3 | +++ plugins/AccountsService/AccountsService.qmltypes 2014-10-15 19:48:28 +0000 | |||
4 | @@ -23,6 +23,8 @@ | |||
5 | 23 | } | 23 | } |
6 | 24 | Property { name: "user"; type: "string" } | 24 | Property { name: "user"; type: "string" } |
7 | 25 | Property { name: "demoEdges"; type: "bool" } | 25 | Property { name: "demoEdges"; type: "bool" } |
8 | 26 | Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true } | ||
9 | 27 | Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true } | ||
10 | 26 | Property { name: "backgroundFile"; type: "string"; isReadonly: true } | 28 | Property { name: "backgroundFile"; type: "string"; isReadonly: true } |
11 | 27 | Property { name: "statsWelcomeScreen"; type: "bool"; isReadonly: true } | 29 | Property { name: "statsWelcomeScreen"; type: "bool"; isReadonly: true } |
12 | 28 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } | 30 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } |
13 | 29 | 31 | ||
14 | === modified file 'plugins/Dash/Dash.qmltypes' | |||
15 | --- plugins/Dash/Dash.qmltypes 2014-08-14 01:28:06 +0000 | |||
16 | +++ plugins/Dash/Dash.qmltypes 2014-10-15 19:48:28 +0000 | |||
17 | @@ -40,9 +40,12 @@ | |||
18 | 40 | Property { name: "forceNoClip"; type: "bool" } | 40 | Property { name: "forceNoClip"; type: "bool" } |
19 | 41 | Property { name: "stickyHeaderHeight"; type: "int"; isReadonly: true } | 41 | Property { name: "stickyHeaderHeight"; type: "int"; isReadonly: true } |
20 | 42 | Property { name: "headerItemShownHeight"; type: "double"; isReadonly: true } | 42 | Property { name: "headerItemShownHeight"; type: "double"; isReadonly: true } |
21 | 43 | Property { name: "cacheBuffer"; type: "double" } | ||
22 | 43 | Signal { name: "headerChanged" } | 44 | Signal { name: "headerChanged" } |
23 | 44 | Method { name: "positionAtBeginning" } | 45 | Method { name: "positionAtBeginning" } |
24 | 45 | Method { name: "showHeader" } | 46 | Method { name: "showHeader" } |
25 | 47 | Method { name: "firstCreatedIndex"; type: "int" } | ||
26 | 48 | Method { name: "createdItemCount"; type: "int" } | ||
27 | 46 | Method { | 49 | Method { |
28 | 47 | name: "item" | 50 | name: "item" |
29 | 48 | type: "QQuickItem*" | 51 | type: "QQuickItem*" |
30 | 49 | 52 | ||
31 | === modified file 'plugins/LightDM/LightDM.qmltypes' | |||
32 | --- plugins/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000 | |||
33 | +++ plugins/LightDM/LightDM.qmltypes 2014-10-15 19:48:28 +0000 | |||
34 | @@ -37,6 +37,7 @@ | |||
35 | 37 | Signal { name: "isActiveChanged" } | 37 | Signal { name: "isActiveChanged" } |
36 | 38 | Signal { name: "isAuthenticatedChanged" } | 38 | Signal { name: "isAuthenticatedChanged" } |
37 | 39 | Signal { name: "showGreeter" } | 39 | Signal { name: "showGreeter" } |
38 | 40 | Signal { name: "hideGreeter" } | ||
39 | 40 | Signal { | 41 | Signal { |
40 | 41 | name: "requestAuthenticationUser" | 42 | name: "requestAuthenticationUser" |
41 | 42 | Parameter { name: "user"; type: "string" } | 43 | Parameter { name: "user"; type: "string" } |
42 | 43 | 44 | ||
43 | === modified file 'plugins/Ubuntu/Payments/Payments.qmltypes' | |||
44 | --- plugins/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000 | |||
45 | +++ plugins/Ubuntu/Payments/Payments.qmltypes 2014-10-15 19:48:28 +0000 | |||
46 | @@ -37,6 +37,7 @@ | |||
47 | 37 | Parameter { name: "error"; type: "string" } | 37 | Parameter { name: "error"; type: "string" } |
48 | 38 | } | 38 | } |
49 | 39 | Signal { name: "purchaseCompleted" } | 39 | Signal { name: "purchaseCompleted" } |
50 | 40 | Signal { name: "purchaseCancelled" } | ||
51 | 40 | Method { name: "start" } | 41 | Method { name: "start" } |
52 | 41 | } | 42 | } |
53 | 42 | } | 43 | } |
54 | 43 | 44 | ||
55 | === modified file 'plugins/Unity/DashCommunicator/DashCommunicator.qmltypes' | |||
56 | --- plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000 | |||
57 | +++ plugins/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-15 19:48:28 +0000 | |||
58 | @@ -9,14 +9,14 @@ | |||
59 | 9 | Module { | 9 | Module { |
60 | 10 | Component { | 10 | Component { |
61 | 11 | name: "DashCommunicator" | 11 | name: "DashCommunicator" |
63 | 12 | prototype: "QObject" | 12 | prototype: "QThread" |
64 | 13 | exports: ["Unity.DashCommunicator/DashCommunicator 0.1"] | 13 | exports: ["Unity.DashCommunicator/DashCommunicator 0.1"] |
65 | 14 | exportMetaObjectRevisions: [0] | 14 | exportMetaObjectRevisions: [0] |
66 | 15 | Method { | 15 | Method { |
67 | 16 | name: "setCurrentScope" | 16 | name: "setCurrentScope" |
68 | 17 | Parameter { name: "scopeId"; type: "string" } | 17 | Parameter { name: "scopeId"; type: "string" } |
69 | 18 | Parameter { name: "animate"; type: "bool" } | 18 | Parameter { name: "animate"; type: "bool" } |
71 | 19 | Parameter { name: "reset"; type: "bool" } | 19 | Parameter { name: "isSwipe"; type: "bool" } |
72 | 20 | } | 20 | } |
73 | 21 | } | 21 | } |
74 | 22 | Component { | 22 | Component { |
75 | @@ -28,7 +28,20 @@ | |||
76 | 28 | name: "setCurrentScopeRequested" | 28 | name: "setCurrentScopeRequested" |
77 | 29 | Parameter { name: "scopeId"; type: "string" } | 29 | Parameter { name: "scopeId"; type: "string" } |
78 | 30 | Parameter { name: "animate"; type: "bool" } | 30 | Parameter { name: "animate"; type: "bool" } |
81 | 31 | Parameter { name: "reset"; type: "bool" } | 31 | Parameter { name: "isSwipe"; type: "bool" } |
82 | 32 | } | 32 | } |
83 | 33 | } | ||
84 | 34 | Component { | ||
85 | 35 | name: "QThread" | ||
86 | 36 | prototype: "QObject" | ||
87 | 37 | Signal { name: "started" } | ||
88 | 38 | Signal { name: "finished" } | ||
89 | 39 | Method { | ||
90 | 40 | name: "start" | ||
91 | 41 | Parameter { type: "Priority" } | ||
92 | 42 | } | ||
93 | 43 | Method { name: "start" } | ||
94 | 44 | Method { name: "terminate" } | ||
95 | 45 | Method { name: "quit" } | ||
96 | 33 | } | 46 | } |
97 | 34 | } | 47 | } |
98 | 35 | 48 | ||
99 | === modified file 'plugins/Unity/Indicators/CMakeLists.txt' | |||
100 | --- plugins/Unity/Indicators/CMakeLists.txt 2014-07-30 16:00:55 +0000 | |||
101 | +++ plugins/Unity/Indicators/CMakeLists.txt 2014-10-15 19:48:28 +0000 | |||
102 | @@ -24,6 +24,7 @@ | |||
103 | 24 | modelprinter.cpp | 24 | modelprinter.cpp |
104 | 25 | plugin.cpp | 25 | plugin.cpp |
105 | 26 | rootactionstate.cpp | 26 | rootactionstate.cpp |
106 | 27 | sharedunitymenumodel.cpp | ||
107 | 27 | unitymenumodelcache.cpp | 28 | unitymenumodelcache.cpp |
108 | 28 | unitymenumodelstack.cpp | 29 | unitymenumodelstack.cpp |
109 | 29 | visibleindicatorsmodel.cpp | 30 | visibleindicatorsmodel.cpp |
110 | 30 | 31 | ||
111 | === modified file 'plugins/Unity/Indicators/Indicators.qmltypes' | |||
112 | --- plugins/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000 | |||
113 | +++ plugins/Unity/Indicators/Indicators.qmltypes 2014-10-15 19:48:28 +0000 | |||
114 | @@ -210,6 +210,16 @@ | |||
115 | 210 | Signal { name: "indexChanged" } | 210 | Signal { name: "indexChanged" } |
116 | 211 | } | 211 | } |
117 | 212 | Component { | 212 | Component { |
118 | 213 | name: "SharedUnityMenuModel" | ||
119 | 214 | prototype: "QObject" | ||
120 | 215 | exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"] | ||
121 | 216 | exportMetaObjectRevisions: [0] | ||
122 | 217 | Property { name: "busName"; type: "QByteArray" } | ||
123 | 218 | Property { name: "menuObjectPath"; type: "QByteArray" } | ||
124 | 219 | Property { name: "actions"; type: "QVariantMap" } | ||
125 | 220 | Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true } | ||
126 | 221 | } | ||
127 | 222 | Component { | ||
128 | 213 | name: "UnityMenuModelCache" | 223 | name: "UnityMenuModelCache" |
129 | 214 | prototype: "QObject" | 224 | prototype: "QObject" |
130 | 215 | exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] | 225 | exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] |
131 | @@ -217,13 +227,6 @@ | |||
132 | 217 | isSingleton: true | 227 | isSingleton: true |
133 | 218 | exportMetaObjectRevisions: [0] | 228 | exportMetaObjectRevisions: [0] |
134 | 219 | Method { | 229 | Method { |
135 | 220 | name: "model" | ||
136 | 221 | type: "UnityMenuModel*" | ||
137 | 222 | Parameter { name: "bus"; type: "QByteArray" } | ||
138 | 223 | Parameter { name: "path"; type: "QByteArray" } | ||
139 | 224 | Parameter { name: "actions"; type: "QVariantMap" } | ||
140 | 225 | } | ||
141 | 226 | Method { | ||
142 | 227 | name: "contains" | 230 | name: "contains" |
143 | 228 | type: "bool" | 231 | type: "bool" |
144 | 229 | Parameter { name: "path"; type: "QByteArray" } | 232 | Parameter { name: "path"; type: "QByteArray" } |
145 | 230 | 233 | ||
146 | === modified file 'plugins/Unity/Indicators/plugin.cpp' | |||
147 | --- plugins/Unity/Indicators/plugin.cpp 2014-07-30 16:00:55 +0000 | |||
148 | +++ plugins/Unity/Indicators/plugin.cpp 2014-10-15 19:48:28 +0000 | |||
149 | @@ -30,18 +30,23 @@ | |||
150 | 30 | #include "menucontentactivator.h" | 30 | #include "menucontentactivator.h" |
151 | 31 | #include "modelprinter.h" | 31 | #include "modelprinter.h" |
152 | 32 | #include "rootactionstate.h" | 32 | #include "rootactionstate.h" |
153 | 33 | #include "sharedunitymenumodel.h" | ||
154 | 33 | #include "unitymenumodelcache.h" | 34 | #include "unitymenumodelcache.h" |
155 | 34 | #include "unitymenumodelstack.h" | 35 | #include "unitymenumodelstack.h" |
156 | 35 | #include "visibleindicatorsmodel.h" | 36 | #include "visibleindicatorsmodel.h" |
157 | 36 | 37 | ||
158 | 38 | #include <unitymenumodel.h> | ||
159 | 39 | |||
160 | 37 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { | 40 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { |
161 | 38 | Q_UNUSED(engine); | 41 | Q_UNUSED(engine); |
162 | 39 | Q_UNUSED(scriptEngine); | 42 | Q_UNUSED(scriptEngine); |
164 | 40 | return new UnityMenuModelCache; | 43 | return UnityMenuModelCache::singleton(); |
165 | 41 | } | 44 | } |
166 | 42 | 45 | ||
168 | 43 | void Indicators2Plugin::registerTypes(const char *uri) | 46 | void IndicatorsPlugin::registerTypes(const char *uri) |
169 | 44 | { | 47 | { |
170 | 48 | qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*"); | ||
171 | 49 | |||
172 | 45 | qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager"); | 50 | qmlRegisterType<IndicatorsManager>(uri, 0, 1, "IndicatorsManager"); |
173 | 46 | qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel"); | 51 | qmlRegisterType<IndicatorsModel>(uri, 0, 1, "IndicatorsModel"); |
174 | 47 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); | 52 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); |
175 | @@ -49,6 +54,7 @@ | |||
176 | 49 | qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState"); | 54 | qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState"); |
177 | 50 | qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter"); | 55 | qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter"); |
178 | 51 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); | 56 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); |
179 | 57 | qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel"); | ||
180 | 52 | 58 | ||
181 | 53 | qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); | 59 | qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); |
182 | 54 | 60 | ||
183 | 55 | 61 | ||
184 | === modified file 'plugins/Unity/Indicators/plugin.h' | |||
185 | --- plugins/Unity/Indicators/plugin.h 2013-08-14 09:07:45 +0000 | |||
186 | +++ plugins/Unity/Indicators/plugin.h 2014-10-15 19:48:28 +0000 | |||
187 | @@ -22,7 +22,7 @@ | |||
188 | 22 | 22 | ||
189 | 23 | #include <QtQml/QQmlExtensionPlugin> | 23 | #include <QtQml/QQmlExtensionPlugin> |
190 | 24 | 24 | ||
192 | 25 | class Indicators2Plugin : public QQmlExtensionPlugin | 25 | class IndicatorsPlugin : public QQmlExtensionPlugin |
193 | 26 | { | 26 | { |
194 | 27 | Q_OBJECT | 27 | Q_OBJECT |
195 | 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | 28 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") |
196 | 29 | 29 | ||
197 | === added file 'plugins/Unity/Indicators/sharedunitymenumodel.cpp' | |||
198 | --- plugins/Unity/Indicators/sharedunitymenumodel.cpp 1970-01-01 00:00:00 +0000 | |||
199 | +++ plugins/Unity/Indicators/sharedunitymenumodel.cpp 2014-10-15 19:48:28 +0000 | |||
200 | @@ -0,0 +1,87 @@ | |||
201 | 1 | /* | ||
202 | 2 | * Copyright 2014 Canonical Ltd. | ||
203 | 3 | * | ||
204 | 4 | * This program is free software; you can redistribute it and/or modify | ||
205 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
206 | 6 | * the Free Software Foundation; version 3. | ||
207 | 7 | * | ||
208 | 8 | * This program is distributed in the hope that it will be useful, | ||
209 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
210 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
211 | 11 | * GNU Lesser General Public License for more details. | ||
212 | 12 | * | ||
213 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
214 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
215 | 15 | * | ||
216 | 16 | */ | ||
217 | 17 | |||
218 | 18 | #include "sharedunitymenumodel.h" | ||
219 | 19 | #include "unitymenumodelcache.h" | ||
220 | 20 | |||
221 | 21 | SharedUnityMenuModel::SharedUnityMenuModel(QObject* parent) | ||
222 | 22 | : QObject(parent) | ||
223 | 23 | { | ||
224 | 24 | } | ||
225 | 25 | |||
226 | 26 | QByteArray SharedUnityMenuModel::busName() const | ||
227 | 27 | { | ||
228 | 28 | return m_busName; | ||
229 | 29 | } | ||
230 | 30 | |||
231 | 31 | void SharedUnityMenuModel::setBusName(const QByteArray& busName) | ||
232 | 32 | { | ||
233 | 33 | if (m_busName != busName) { | ||
234 | 34 | m_busName = busName; | ||
235 | 35 | Q_EMIT busNameChanged(); | ||
236 | 36 | initialize(); | ||
237 | 37 | } | ||
238 | 38 | } | ||
239 | 39 | |||
240 | 40 | QByteArray SharedUnityMenuModel::menuObjectPath() const | ||
241 | 41 | { | ||
242 | 42 | return m_menuObjectPath; | ||
243 | 43 | } | ||
244 | 44 | |||
245 | 45 | void SharedUnityMenuModel::setMenuObjectPath(const QByteArray& menuObjectPath) | ||
246 | 46 | { | ||
247 | 47 | if (m_menuObjectPath != menuObjectPath) { | ||
248 | 48 | m_menuObjectPath = menuObjectPath; | ||
249 | 49 | Q_EMIT menuObjectPathChanged(); | ||
250 | 50 | initialize(); | ||
251 | 51 | } | ||
252 | 52 | } | ||
253 | 53 | |||
254 | 54 | QVariantMap SharedUnityMenuModel::actions() const | ||
255 | 55 | { | ||
256 | 56 | return m_actions; | ||
257 | 57 | } | ||
258 | 58 | |||
259 | 59 | void SharedUnityMenuModel::setActions(const QVariantMap& actions) | ||
260 | 60 | { | ||
261 | 61 | if (m_actions != actions) { | ||
262 | 62 | m_actions = actions; | ||
263 | 63 | Q_EMIT actionsChanged(); | ||
264 | 64 | initialize(); | ||
265 | 65 | } | ||
266 | 66 | } | ||
267 | 67 | |||
268 | 68 | UnityMenuModel* SharedUnityMenuModel::model() const | ||
269 | 69 | { | ||
270 | 70 | return m_model ? m_model.data() : nullptr; | ||
271 | 71 | } | ||
272 | 72 | |||
273 | 73 | void SharedUnityMenuModel::initialize() | ||
274 | 74 | { | ||
275 | 75 | if (m_busName.isEmpty() || m_menuObjectPath.isEmpty() || m_actions.isEmpty()) { | ||
276 | 76 | if (!m_model.isNull()) { | ||
277 | 77 | m_model.clear(); | ||
278 | 78 | Q_EMIT modelChanged(); | ||
279 | 79 | } | ||
280 | 80 | } else { | ||
281 | 81 | QSharedPointer<UnityMenuModel> model = UnityMenuModelCache::singleton()->model(m_busName, m_menuObjectPath, m_actions); | ||
282 | 82 | if (model != m_model) { | ||
283 | 83 | m_model = model; | ||
284 | 84 | Q_EMIT modelChanged(); | ||
285 | 85 | } | ||
286 | 86 | } | ||
287 | 87 | } | ||
288 | 0 | 88 | ||
289 | === added file 'plugins/Unity/Indicators/sharedunitymenumodel.h' | |||
290 | --- plugins/Unity/Indicators/sharedunitymenumodel.h 1970-01-01 00:00:00 +0000 | |||
291 | +++ plugins/Unity/Indicators/sharedunitymenumodel.h 2014-10-15 19:48:28 +0000 | |||
292 | @@ -0,0 +1,66 @@ | |||
293 | 1 | /* | ||
294 | 2 | * Copyright 2014 Canonical Ltd. | ||
295 | 3 | * | ||
296 | 4 | * This program is free software; you can redistribute it and/or modify | ||
297 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
298 | 6 | * the Free Software Foundation; version 3. | ||
299 | 7 | * | ||
300 | 8 | * This program is distributed in the hope that it will be useful, | ||
301 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
302 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
303 | 11 | * GNU Lesser General Public License for more details. | ||
304 | 12 | * | ||
305 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
306 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
307 | 15 | * | ||
308 | 16 | */ | ||
309 | 17 | |||
310 | 18 | #ifndef SHAREDUNITYMENUMODEL_H | ||
311 | 19 | #define SHAREDUNITYMENUMODEL_H | ||
312 | 20 | |||
313 | 21 | #include "unityindicatorsglobal.h" | ||
314 | 22 | |||
315 | 23 | #include <QObject> | ||
316 | 24 | #include <QSharedPointer> | ||
317 | 25 | #include <QVariantMap> | ||
318 | 26 | |||
319 | 27 | class UnityMenuModel; | ||
320 | 28 | |||
321 | 29 | class UNITYINDICATORS_EXPORT SharedUnityMenuModel : public QObject | ||
322 | 30 | { | ||
323 | 31 | Q_OBJECT | ||
324 | 32 | Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged) | ||
325 | 33 | Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged) | ||
326 | 34 | Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged) | ||
327 | 35 | Q_PROPERTY(UnityMenuModel* model READ model NOTIFY modelChanged) | ||
328 | 36 | |||
329 | 37 | public: | ||
330 | 38 | SharedUnityMenuModel(QObject* parent = nullptr); | ||
331 | 39 | |||
332 | 40 | QByteArray busName() const; | ||
333 | 41 | void setBusName(const QByteArray&); | ||
334 | 42 | |||
335 | 43 | QByteArray menuObjectPath() const; | ||
336 | 44 | void setMenuObjectPath(const QByteArray&); | ||
337 | 45 | |||
338 | 46 | QVariantMap actions() const; | ||
339 | 47 | void setActions(const QVariantMap&); | ||
340 | 48 | |||
341 | 49 | UnityMenuModel* model() const; | ||
342 | 50 | |||
343 | 51 | Q_SIGNALS: | ||
344 | 52 | void busNameChanged(); | ||
345 | 53 | void menuObjectPathChanged(); | ||
346 | 54 | void actionsChanged(); | ||
347 | 55 | void modelChanged(); | ||
348 | 56 | |||
349 | 57 | private: | ||
350 | 58 | void initialize(); | ||
351 | 59 | |||
352 | 60 | QByteArray m_busName; | ||
353 | 61 | QByteArray m_menuObjectPath; | ||
354 | 62 | QVariantMap m_actions; | ||
355 | 63 | QSharedPointer<UnityMenuModel> m_model; | ||
356 | 64 | }; | ||
357 | 65 | |||
358 | 66 | #endif // SHAREDUNITYMENUMODEL_H | ||
359 | 0 | 67 | ||
360 | === modified file 'plugins/Unity/Indicators/unitymenumodelcache.cpp' | |||
361 | --- plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-08-20 09:16:28 +0000 | |||
362 | +++ plugins/Unity/Indicators/unitymenumodelcache.cpp 2014-10-15 19:48:28 +0000 | |||
363 | @@ -20,30 +20,45 @@ | |||
364 | 20 | #include "unitymenumodelcache.h" | 20 | #include "unitymenumodelcache.h" |
365 | 21 | #include <unitymenumodel.h> | 21 | #include <unitymenumodel.h> |
366 | 22 | 22 | ||
367 | 23 | #include <QQmlEngine> | ||
368 | 24 | |||
369 | 25 | QPointer<UnityMenuModelCache> UnityMenuModelCache::theCache = nullptr; | ||
370 | 26 | |||
371 | 27 | UnityMenuModelCache* UnityMenuModelCache::singleton() | ||
372 | 28 | { | ||
373 | 29 | if (theCache.isNull()) { | ||
374 | 30 | theCache = new UnityMenuModelCache(); | ||
375 | 31 | } | ||
376 | 32 | return theCache.data(); | ||
377 | 33 | } | ||
378 | 34 | |||
379 | 23 | UnityMenuModelCache::UnityMenuModelCache(QObject* parent) | 35 | UnityMenuModelCache::UnityMenuModelCache(QObject* parent) |
380 | 24 | : QObject(parent) | 36 | : QObject(parent) |
381 | 25 | { | 37 | { |
382 | 26 | } | 38 | } |
383 | 27 | 39 | ||
391 | 28 | UnityMenuModelCache::~UnityMenuModelCache() | 40 | QSharedPointer<UnityMenuModel> UnityMenuModelCache::model(const QByteArray& bus, |
392 | 29 | { | 41 | const QByteArray& path, |
393 | 30 | } | 42 | const QVariantMap& actions) |
387 | 31 | |||
388 | 32 | UnityMenuModel* UnityMenuModelCache::model(const QByteArray& bus, | ||
389 | 33 | const QByteArray& path, | ||
390 | 34 | const QVariantMap& actions) | ||
394 | 35 | { | 43 | { |
395 | 36 | if (m_registry.contains(path)) | 44 | if (m_registry.contains(path)) |
396 | 37 | return m_registry[path]; | 45 | return m_registry[path]; |
397 | 38 | 46 | ||
403 | 39 | UnityMenuModel* menuModel = new UnityMenuModel; | 47 | UnityMenuModel* model = new UnityMenuModel; |
404 | 40 | connect(menuModel, &QObject::destroyed, this, [menuModel, this](QObject*) { | 48 | QQmlEngine::setObjectOwnership(model, QQmlEngine::CppOwnership); |
405 | 41 | QList<QByteArray> keys = m_registry.keys(menuModel); | 49 | |
406 | 42 | Q_FOREACH(const QByteArray& key, keys) { | 50 | QSharedPointer<UnityMenuModel> menuModel(model); |
407 | 43 | m_registry.remove(key); | 51 | connect(model, &QObject::destroyed, this, [this] { |
408 | 52 | QMutableHashIterator<QByteArray, QWeakPointer<UnityMenuModel>> iter(m_registry); | ||
409 | 53 | while(iter.hasNext()) { | ||
410 | 54 | auto keyVal = iter.next(); | ||
411 | 55 | if (keyVal.value().isNull()) { | ||
412 | 56 | iter.remove(); | ||
413 | 57 | break; | ||
414 | 58 | } | ||
415 | 44 | } | 59 | } |
416 | 45 | }); | 60 | }); |
418 | 46 | m_registry[path] = menuModel; | 61 | m_registry[path] = menuModel.toWeakRef(); |
419 | 47 | 62 | ||
420 | 48 | menuModel->setBusName(bus); | 63 | menuModel->setBusName(bus); |
421 | 49 | menuModel->setMenuObjectPath(path); | 64 | menuModel->setMenuObjectPath(path); |
422 | 50 | 65 | ||
423 | === modified file 'plugins/Unity/Indicators/unitymenumodelcache.h' | |||
424 | --- plugins/Unity/Indicators/unitymenumodelcache.h 2014-08-26 08:14:44 +0000 | |||
425 | +++ plugins/Unity/Indicators/unitymenumodelcache.h 2014-10-15 19:48:28 +0000 | |||
426 | @@ -24,6 +24,8 @@ | |||
427 | 24 | 24 | ||
428 | 25 | #include <QObject> | 25 | #include <QObject> |
429 | 26 | #include <QHash> | 26 | #include <QHash> |
430 | 27 | #include <QPointer> | ||
431 | 28 | #include <QWeakPointer> | ||
432 | 27 | 29 | ||
433 | 28 | class UnityMenuModel; | 30 | class UnityMenuModel; |
434 | 29 | 31 | ||
435 | @@ -32,15 +34,19 @@ | |||
436 | 32 | Q_OBJECT | 34 | Q_OBJECT |
437 | 33 | public: | 35 | public: |
438 | 34 | UnityMenuModelCache(QObject*parent=nullptr); | 36 | UnityMenuModelCache(QObject*parent=nullptr); |
448 | 35 | ~UnityMenuModelCache(); | 37 | |
449 | 36 | 38 | static UnityMenuModelCache* singleton(); | |
450 | 37 | Q_INVOKABLE UnityMenuModel* model(const QByteArray& bus, | 39 | |
451 | 38 | const QByteArray& path, | 40 | virtual QSharedPointer<UnityMenuModel> model(const QByteArray& bus, |
452 | 39 | const QVariantMap& actions); | 41 | const QByteArray& path, |
453 | 40 | Q_INVOKABLE bool contains(const QByteArray& path); | 42 | const QVariantMap& actions); |
454 | 41 | 43 | ||
455 | 42 | private: | 44 | // for tests use |
456 | 43 | QHash<QByteArray, UnityMenuModel*> m_registry; | 45 | Q_INVOKABLE virtual bool contains(const QByteArray& path); |
457 | 46 | |||
458 | 47 | protected: | ||
459 | 48 | QHash<QByteArray, QWeakPointer<UnityMenuModel>> m_registry; | ||
460 | 49 | static QPointer<UnityMenuModelCache> theCache; | ||
461 | 44 | }; | 50 | }; |
462 | 45 | 51 | ||
463 | 46 | #endif // UNITYMENUMODELCACHE_H | 52 | #endif // UNITYMENUMODELCACHE_H |
464 | 47 | 53 | ||
465 | === modified file 'plugins/Unity/Launcher/Launcher.qmltypes' | |||
466 | --- plugins/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000 | |||
467 | +++ plugins/Unity/Launcher/Launcher.qmltypes 2014-10-15 19:48:28 +0000 | |||
468 | @@ -13,14 +13,6 @@ | |||
469 | 13 | exports: ["Unity.Launcher/LauncherItem 0.1"] | 13 | exports: ["Unity.Launcher/LauncherItem 0.1"] |
470 | 14 | isCreatable: false | 14 | isCreatable: false |
471 | 15 | exportMetaObjectRevisions: [0] | 15 | exportMetaObjectRevisions: [0] |
472 | 16 | Signal { | ||
473 | 17 | name: "favoriteChanged" | ||
474 | 18 | Parameter { name: "favorite"; type: "bool" } | ||
475 | 19 | } | ||
476 | 20 | Signal { | ||
477 | 21 | name: "runningChanged" | ||
478 | 22 | Parameter { name: "running"; type: "bool" } | ||
479 | 23 | } | ||
480 | 24 | } | 16 | } |
481 | 25 | Component { | 17 | Component { |
482 | 26 | name: "LauncherModel" | 18 | name: "LauncherModel" |
483 | @@ -30,6 +22,10 @@ | |||
484 | 30 | isSingleton: true | 22 | isSingleton: true |
485 | 31 | exportMetaObjectRevisions: [0] | 23 | exportMetaObjectRevisions: [0] |
486 | 32 | Method { | 24 | Method { |
487 | 25 | name: "requestRemove" | ||
488 | 26 | Parameter { name: "appId"; type: "string" } | ||
489 | 27 | } | ||
490 | 28 | Method { | ||
491 | 33 | name: "get" | 29 | name: "get" |
492 | 34 | type: "unity::shell::launcher::LauncherItemInterface*" | 30 | type: "unity::shell::launcher::LauncherItemInterface*" |
493 | 35 | Parameter { name: "index"; type: "int" } | 31 | Parameter { name: "index"; type: "int" } |
494 | @@ -49,10 +45,6 @@ | |||
495 | 49 | Parameter { name: "appId"; type: "string" } | 45 | Parameter { name: "appId"; type: "string" } |
496 | 50 | } | 46 | } |
497 | 51 | Method { | 47 | Method { |
498 | 52 | name: "requestRemove" | ||
499 | 53 | Parameter { name: "appId"; type: "string" } | ||
500 | 54 | } | ||
501 | 55 | Method { | ||
502 | 56 | name: "quickListActionInvoked" | 48 | name: "quickListActionInvoked" |
503 | 57 | Parameter { name: "appId"; type: "string" } | 49 | Parameter { name: "appId"; type: "string" } |
504 | 58 | Parameter { name: "actionIndex"; type: "int" } | 50 | Parameter { name: "actionIndex"; type: "int" } |
505 | @@ -88,6 +80,7 @@ | |||
506 | 88 | Property { name: "recent"; type: "bool"; isReadonly: true } | 80 | Property { name: "recent"; type: "bool"; isReadonly: true } |
507 | 89 | Property { name: "progress"; type: "int"; isReadonly: true } | 81 | Property { name: "progress"; type: "int"; isReadonly: true } |
508 | 90 | Property { name: "count"; type: "int"; isReadonly: true } | 82 | Property { name: "count"; type: "int"; isReadonly: true } |
509 | 83 | Property { name: "countVisible"; type: "bool"; isReadonly: true } | ||
510 | 91 | Property { name: "focused"; type: "bool"; isReadonly: true } | 84 | Property { name: "focused"; type: "bool"; isReadonly: true } |
511 | 92 | Property { | 85 | Property { |
512 | 93 | name: "quickList" | 86 | name: "quickList" |
513 | @@ -96,6 +89,14 @@ | |||
514 | 96 | isPointer: true | 89 | isPointer: true |
515 | 97 | } | 90 | } |
516 | 98 | Signal { | 91 | Signal { |
517 | 92 | name: "nameChanged" | ||
518 | 93 | Parameter { name: "name"; type: "string" } | ||
519 | 94 | } | ||
520 | 95 | Signal { | ||
521 | 96 | name: "iconChanged" | ||
522 | 97 | Parameter { name: "icon"; type: "string" } | ||
523 | 98 | } | ||
524 | 99 | Signal { | ||
525 | 99 | name: "pinnedChanged" | 100 | name: "pinnedChanged" |
526 | 100 | Parameter { name: "pinned"; type: "bool" } | 101 | Parameter { name: "pinned"; type: "bool" } |
527 | 101 | } | 102 | } |
528 | @@ -116,6 +117,10 @@ | |||
529 | 116 | Parameter { name: "count"; type: "int" } | 117 | Parameter { name: "count"; type: "int" } |
530 | 117 | } | 118 | } |
531 | 118 | Signal { | 119 | Signal { |
532 | 120 | name: "countVisibleChanged" | ||
533 | 121 | Parameter { name: "countVisible"; type: "bool" } | ||
534 | 122 | } | ||
535 | 123 | Signal { | ||
536 | 119 | name: "focusedChanged" | 124 | name: "focusedChanged" |
537 | 120 | Parameter { name: "focused"; type: "bool" } | 125 | Parameter { name: "focused"; type: "bool" } |
538 | 121 | } | 126 | } |
539 | 122 | 127 | ||
540 | === modified file 'plugins/Unity/Session/Session.qmltypes' | |||
541 | --- plugins/Unity/Session/Session.qmltypes 2014-08-14 01:28:06 +0000 | |||
542 | +++ plugins/Unity/Session/Session.qmltypes 2014-10-15 19:48:28 +0000 | |||
543 | @@ -34,4 +34,14 @@ | |||
544 | 34 | Method { name: "RequestReboot" } | 34 | Method { name: "RequestReboot" } |
545 | 35 | Method { name: "RequestShutdown" } | 35 | Method { name: "RequestShutdown" } |
546 | 36 | } | 36 | } |
547 | 37 | Component { | ||
548 | 38 | name: "OrientationLock" | ||
549 | 39 | prototype: "QObject" | ||
550 | 40 | exports: ["Unity.Session/OrientationLock 0.1"] | ||
551 | 41 | isCreatable: false | ||
552 | 42 | isSingleton: true | ||
553 | 43 | exportMetaObjectRevisions: [0] | ||
554 | 44 | Property { name: "enabled"; type: "bool"; isReadonly: true } | ||
555 | 45 | Property { name: "savedOrientation"; type: "Qt::ScreenOrientation" } | ||
556 | 46 | } | ||
557 | 37 | } | 47 | } |
558 | 38 | 48 | ||
559 | === modified file 'plugins/Utils/Utils.qmltypes' | |||
560 | --- plugins/Utils/Utils.qmltypes 2014-08-14 01:28:06 +0000 | |||
561 | +++ plugins/Utils/Utils.qmltypes 2014-10-15 19:48:28 +0000 | |||
562 | @@ -107,6 +107,12 @@ | |||
563 | 107 | } | 107 | } |
564 | 108 | } | 108 | } |
565 | 109 | Component { | 109 | Component { |
566 | 110 | name: "RelativeTimeFormatter" | ||
567 | 111 | prototype: "TimeFormatter" | ||
568 | 112 | exports: ["Utils/RelativeTimeFormatter 0.1"] | ||
569 | 113 | exportMetaObjectRevisions: [0] | ||
570 | 114 | } | ||
571 | 115 | Component { | ||
572 | 110 | name: "TimeFormatter" | 116 | name: "TimeFormatter" |
573 | 111 | prototype: "QObject" | 117 | prototype: "QObject" |
574 | 112 | exports: ["Utils/GDateTimeFormatter 0.1", "Utils/TimeFormatter 0.1"] | 118 | exports: ["Utils/GDateTimeFormatter 0.1", "Utils/TimeFormatter 0.1"] |
575 | 113 | 119 | ||
576 | === modified file 'qml/Greeter/Clock.qml' | |||
577 | --- qml/Greeter/Clock.qml 2014-08-20 08:39:09 +0000 | |||
578 | +++ qml/Greeter/Clock.qml 2014-10-15 19:48:28 +0000 | |||
579 | @@ -34,21 +34,21 @@ | |||
580 | 34 | } | 34 | } |
581 | 35 | } | 35 | } |
582 | 36 | 36 | ||
584 | 37 | CachedUnityMenuModel { | 37 | Indicators.SharedUnityMenuModel { |
585 | 38 | id: timeModel | 38 | id: timeModel |
586 | 39 | objectName: "timeModel" | 39 | objectName: "timeModel" |
587 | 40 | 40 | ||
588 | 41 | busName: "com.canonical.indicator.datetime" | 41 | busName: "com.canonical.indicator.datetime" |
590 | 42 | actionsObjectPath: "/com/canonical/indicator/datetime" | 42 | actions: { "indicator": "/com/canonical/indicator/datetime" } |
591 | 43 | menuObjectPath: clock.visible ? "/com/canonical/indicator/datetime/phone" : "" | 43 | menuObjectPath: clock.visible ? "/com/canonical/indicator/datetime/phone" : "" |
592 | 44 | } | ||
593 | 44 | 45 | ||
601 | 45 | Indicators.RootActionState { | 46 | Indicators.RootActionState { |
602 | 46 | menu: timeModel.model | 47 | menu: timeModel.model |
603 | 47 | onUpdated: { | 48 | onUpdated: { |
604 | 48 | if (timeLabel.text != rightLabel) { | 49 | if (timeLabel.text != rightLabel) { |
605 | 49 | timeLabel.text = rightLabel; | 50 | if (rightLabel != "") timeLabel.text = rightLabel; |
606 | 50 | clock.currentDate = new Date(); | 51 | clock.currentDate = new Date(); |
600 | 51 | } | ||
607 | 52 | } | 52 | } |
608 | 53 | } | 53 | } |
609 | 54 | } | 54 | } |
610 | 55 | 55 | ||
611 | === modified file 'qml/Notifications/Notifications.qml' | |||
612 | --- qml/Notifications/Notifications.qml 2014-09-09 09:34:28 +0000 | |||
613 | +++ qml/Notifications/Notifications.qml 2014-10-15 19:48:28 +0000 | |||
614 | @@ -32,6 +32,7 @@ | |||
615 | 32 | 32 | ||
616 | 33 | SortFilterProxyModel { | 33 | SortFilterProxyModel { |
617 | 34 | id: snapDecisionProxyModel | 34 | id: snapDecisionProxyModel |
618 | 35 | objectName: "snapDecisionProxyModel" | ||
619 | 35 | 36 | ||
620 | 36 | model: notificationList.model | 37 | model: notificationList.model |
621 | 37 | filterRole: UnityNotifications.ModelInterface != undefined ? UnityNotifications.ModelInterface.RoleType : 0 | 38 | filterRole: UnityNotifications.ModelInterface != undefined ? UnityNotifications.ModelInterface.RoleType : 0 |
622 | 38 | 39 | ||
623 | === removed file 'qml/Panel/Indicators/CachedUnityMenuModel.qml' | |||
624 | --- qml/Panel/Indicators/CachedUnityMenuModel.qml 2014-08-20 08:39:09 +0000 | |||
625 | +++ qml/Panel/Indicators/CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000 | |||
626 | @@ -1,39 +0,0 @@ | |||
627 | 1 | /* | ||
628 | 2 | * Copyright 2013 Canonical Ltd. | ||
629 | 3 | * | ||
630 | 4 | * This program is free software; you can redistribute it and/or modify | ||
631 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
632 | 6 | * the Free Software Foundation; version 3. | ||
633 | 7 | * | ||
634 | 8 | * This program is distributed in the hope that it will be useful, | ||
635 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
636 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
637 | 11 | * GNU Lesser General Public License for more details. | ||
638 | 12 | * | ||
639 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
640 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
641 | 15 | * | ||
642 | 16 | * Authors: | ||
643 | 17 | * Nick Dedekind <nick.dedekind@canonical.com> | ||
644 | 18 | */ | ||
645 | 19 | |||
646 | 20 | import QtQuick 2.0 | ||
647 | 21 | import QMenuModel 0.1 | ||
648 | 22 | import Unity.Indicators 0.1 as Indicators | ||
649 | 23 | |||
650 | 24 | // Make sure we don't duplicate models. | ||
651 | 25 | Item { | ||
652 | 26 | id: cachedModel | ||
653 | 27 | property string busName | ||
654 | 28 | property string actionsObjectPath | ||
655 | 29 | property string menuObjectPath | ||
656 | 30 | readonly property bool ready: busName!=="" && actionsObjectPath!=="" && menuObjectPath!=="" | ||
657 | 31 | |||
658 | 32 | property var model: { | ||
659 | 33 | if (!ready) return null; | ||
660 | 34 | |||
661 | 35 | return Indicators.UnityMenuModelCache.model(cachedModel.busName, | ||
662 | 36 | cachedModel.menuObjectPath, | ||
663 | 37 | { "indicator": cachedModel.actionsObjectPath }); | ||
664 | 38 | } | ||
665 | 39 | } | ||
666 | 40 | 0 | ||
667 | === modified file 'qml/Panel/Indicators/IndicatorBase.qml' | |||
668 | --- qml/Panel/Indicators/IndicatorBase.qml 2014-09-29 10:24:58 +0000 | |||
669 | +++ qml/Panel/Indicators/IndicatorBase.qml 2014-10-15 19:48:28 +0000 | |||
670 | @@ -37,10 +37,10 @@ | |||
671 | 37 | property alias menuModel: cachedModel.model | 37 | property alias menuModel: cachedModel.model |
672 | 38 | property alias rootActionState: rootAction | 38 | property alias rootActionState: rootAction |
673 | 39 | 39 | ||
675 | 40 | CachedUnityMenuModel { | 40 | SharedUnityMenuModel { |
676 | 41 | id: cachedModel | 41 | id: cachedModel |
677 | 42 | busName: indicatorItem.busName | 42 | busName: indicatorItem.busName |
679 | 43 | actionsObjectPath: indicatorItem.actionsObjectPath | 43 | actions: { "indicator": indicatorItem.actionsObjectPath } |
680 | 44 | menuObjectPath: indicatorItem.deviceMenuObjectPath | 44 | menuObjectPath: indicatorItem.deviceMenuObjectPath |
681 | 45 | } | 45 | } |
682 | 46 | 46 | ||
683 | 47 | 47 | ||
684 | === modified file 'qml/Shell.qml' | |||
685 | --- qml/Shell.qml 2014-10-13 15:41:29 +0000 | |||
686 | +++ qml/Shell.qml 2014-10-15 19:48:28 +0000 | |||
687 | @@ -248,7 +248,7 @@ | |||
688 | 248 | Binding { | 248 | Binding { |
689 | 249 | target: applicationsDisplayLoader.item | 249 | target: applicationsDisplayLoader.item |
690 | 250 | property: "interactive" | 250 | property: "interactive" |
692 | 251 | value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0 | 251 | value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0 && !notifications.useModal |
693 | 252 | } | 252 | } |
694 | 253 | Binding { | 253 | Binding { |
695 | 254 | target: applicationsDisplayLoader.item | 254 | target: applicationsDisplayLoader.item |
696 | 255 | 255 | ||
697 | === modified file 'tests/mocks/AccountsService/AccountsService.qmltypes' | |||
698 | --- tests/mocks/AccountsService/AccountsService.qmltypes 2014-09-01 12:18:53 +0000 | |||
699 | +++ tests/mocks/AccountsService/AccountsService.qmltypes 2014-10-15 19:48:28 +0000 | |||
700 | @@ -23,6 +23,8 @@ | |||
701 | 23 | } | 23 | } |
702 | 24 | Property { name: "user"; type: "string" } | 24 | Property { name: "user"; type: "string" } |
703 | 25 | Property { name: "demoEdges"; type: "bool" } | 25 | Property { name: "demoEdges"; type: "bool" } |
704 | 26 | Property { name: "enableLauncherWhileLocked"; type: "bool" } | ||
705 | 27 | Property { name: "enableIndicatorsWhileLocked"; type: "bool" } | ||
706 | 26 | Property { name: "backgroundFile"; type: "string" } | 28 | Property { name: "backgroundFile"; type: "string" } |
707 | 27 | Property { name: "statsWelcomeScreen"; type: "bool" } | 29 | Property { name: "statsWelcomeScreen"; type: "bool" } |
708 | 28 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } | 30 | Property { name: "passwordDisplayHint"; type: "PasswordDisplayHint"; isReadonly: true } |
709 | 29 | 31 | ||
710 | === modified file 'tests/mocks/LightDM/LightDM.qmltypes' | |||
711 | --- tests/mocks/LightDM/LightDM.qmltypes 2014-09-01 12:18:53 +0000 | |||
712 | +++ tests/mocks/LightDM/LightDM.qmltypes 2014-10-15 19:48:28 +0000 | |||
713 | @@ -37,6 +37,7 @@ | |||
714 | 37 | Signal { name: "isActiveChanged" } | 37 | Signal { name: "isActiveChanged" } |
715 | 38 | Signal { name: "isAuthenticatedChanged" } | 38 | Signal { name: "isAuthenticatedChanged" } |
716 | 39 | Signal { name: "showGreeter" } | 39 | Signal { name: "showGreeter" } |
717 | 40 | Signal { name: "hideGreeter" } | ||
718 | 40 | Signal { | 41 | Signal { |
719 | 41 | name: "requestAuthenticationUser" | 42 | name: "requestAuthenticationUser" |
720 | 42 | Parameter { name: "user"; type: "string" } | 43 | Parameter { name: "user"; type: "string" } |
721 | 43 | 44 | ||
722 | === modified file 'tests/mocks/QMenuModel/QMenuModel.qmltypes' | |||
723 | --- tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-08-14 01:28:06 +0000 | |||
724 | +++ tests/mocks/QMenuModel/QMenuModel.qmltypes 2014-10-15 19:48:28 +0000 | |||
725 | @@ -18,12 +18,12 @@ | |||
726 | 18 | prototype: "QAbstractListModel" | 18 | prototype: "QAbstractListModel" |
727 | 19 | exports: ["QMenuModel/UnityMenuModel 0.1"] | 19 | exports: ["QMenuModel/UnityMenuModel 0.1"] |
728 | 20 | exportMetaObjectRevisions: [0] | 20 | exportMetaObjectRevisions: [0] |
729 | 21 | Property { name: "modelData"; type: "QVariant" } | ||
730 | 22 | Property { name: "busName"; type: "QByteArray" } | 21 | Property { name: "busName"; type: "QByteArray" } |
731 | 23 | Property { name: "actions"; type: "QVariantMap" } | 22 | Property { name: "actions"; type: "QVariantMap" } |
732 | 24 | Property { name: "menuObjectPath"; type: "QByteArray" } | 23 | Property { name: "menuObjectPath"; type: "QByteArray" } |
733 | 25 | Property { name: "actionStateParser"; type: "ActionStateParser"; isPointer: true } | 24 | Property { name: "actionStateParser"; type: "ActionStateParser"; isPointer: true } |
734 | 26 | Property { name: "nameOwner"; type: "string"; isReadonly: true } | 25 | Property { name: "nameOwner"; type: "string"; isReadonly: true } |
735 | 26 | Property { name: "modelData"; type: "QVariant" } | ||
736 | 27 | Method { | 27 | Method { |
737 | 28 | name: "insertRow" | 28 | name: "insertRow" |
738 | 29 | Parameter { name: "row"; type: "int" } | 29 | Parameter { name: "row"; type: "int" } |
739 | 30 | 30 | ||
740 | === modified file 'tests/mocks/QMenuModel/unitymenumodel.cpp' | |||
741 | --- tests/mocks/QMenuModel/unitymenumodel.cpp 2014-08-26 08:14:44 +0000 | |||
742 | +++ tests/mocks/QMenuModel/unitymenumodel.cpp 2014-10-15 19:48:28 +0000 | |||
743 | @@ -50,13 +50,12 @@ | |||
744 | 50 | { | 50 | { |
745 | 51 | beginResetModel(); | 51 | beginResetModel(); |
746 | 52 | 52 | ||
747 | 53 | m_modelData.clear(); | ||
748 | 54 | m_modelData = data.toList(); | 53 | m_modelData = data.toList(); |
749 | 54 | Q_EMIT modelDataChanged(); | ||
750 | 55 | 55 | ||
751 | 56 | endResetModel(); | 56 | endResetModel(); |
752 | 57 | } | 57 | } |
753 | 58 | 58 | ||
754 | 59 | |||
755 | 60 | void UnityMenuModel::insertRow(int row, const QVariant& data) | 59 | void UnityMenuModel::insertRow(int row, const QVariant& data) |
756 | 61 | { | 60 | { |
757 | 62 | row = qMin(row, rowCount()); | 61 | row = qMin(row, rowCount()); |
758 | 63 | 62 | ||
759 | === modified file 'tests/mocks/QMenuModel/unitymenumodel.h' | |||
760 | --- tests/mocks/QMenuModel/unitymenumodel.h 2014-08-26 08:14:44 +0000 | |||
761 | +++ tests/mocks/QMenuModel/unitymenumodel.h 2014-10-15 19:48:28 +0000 | |||
762 | @@ -27,13 +27,15 @@ | |||
763 | 27 | class Q_DECL_EXPORT UnityMenuModel : public QAbstractListModel | 27 | class Q_DECL_EXPORT UnityMenuModel : public QAbstractListModel |
764 | 28 | { | 28 | { |
765 | 29 | Q_OBJECT | 29 | Q_OBJECT |
766 | 30 | Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) | ||
767 | 31 | Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged) | 30 | Q_PROPERTY(QByteArray busName READ busName WRITE setBusName NOTIFY busNameChanged) |
768 | 32 | Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged) | 31 | Q_PROPERTY(QVariantMap actions READ actions WRITE setActions NOTIFY actionsChanged) |
769 | 33 | Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged) | 32 | Q_PROPERTY(QByteArray menuObjectPath READ menuObjectPath WRITE setMenuObjectPath NOTIFY menuObjectPathChanged) |
770 | 34 | Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged) | 33 | Q_PROPERTY(ActionStateParser* actionStateParser READ actionStateParser WRITE setActionStateParser NOTIFY actionStateParserChanged) |
771 | 35 | Q_PROPERTY(QString nameOwner READ nameOwner NOTIFY nameOwnerChanged) | 34 | Q_PROPERTY(QString nameOwner READ nameOwner NOTIFY nameOwnerChanged) |
772 | 36 | 35 | ||
773 | 36 | // internal mock properties | ||
774 | 37 | Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) | ||
775 | 38 | |||
776 | 37 | public: | 39 | public: |
777 | 38 | UnityMenuModel(QObject *parent = nullptr); | 40 | UnityMenuModel(QObject *parent = nullptr); |
778 | 39 | virtual ~UnityMenuModel(); | 41 | virtual ~UnityMenuModel(); |
779 | @@ -81,8 +83,10 @@ | |||
780 | 81 | void actionsChanged(); | 83 | void actionsChanged(); |
781 | 82 | void menuObjectPathChanged(); | 84 | void menuObjectPathChanged(); |
782 | 83 | void actionStateParserChanged(); | 85 | void actionStateParserChanged(); |
783 | 86 | void nameOwnerChanged(); | ||
784 | 87 | |||
785 | 88 | // Internal mock usage | ||
786 | 84 | void modelDataChanged(); | 89 | void modelDataChanged(); |
787 | 85 | void nameOwnerChanged(); | ||
788 | 86 | 90 | ||
789 | 87 | private: | 91 | private: |
790 | 88 | QVariantMap rowData(int row) const; | 92 | QVariantMap rowData(int row) const; |
791 | 89 | 93 | ||
792 | === modified file 'tests/mocks/Ubuntu/Payments/Payments.qmltypes' | |||
793 | --- tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-06-27 20:53:24 +0000 | |||
794 | +++ tests/mocks/Ubuntu/Payments/Payments.qmltypes 2014-10-15 19:48:28 +0000 | |||
795 | @@ -37,6 +37,8 @@ | |||
796 | 37 | Parameter { name: "error"; type: "string" } | 37 | Parameter { name: "error"; type: "string" } |
797 | 38 | } | 38 | } |
798 | 39 | Signal { name: "purchaseCompleted" } | 39 | Signal { name: "purchaseCompleted" } |
799 | 40 | Signal { name: "purchaseCancelled" } | ||
800 | 40 | Method { name: "start" } | 41 | Method { name: "start" } |
801 | 42 | Method { name: "process" } | ||
802 | 41 | } | 43 | } |
803 | 42 | } | 44 | } |
804 | 43 | 45 | ||
805 | === modified file 'tests/mocks/Ubuntu/Telephony/Telephony.qmltypes' | |||
806 | --- tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-08-14 13:33:28 +0000 | |||
807 | +++ tests/mocks/Ubuntu/Telephony/Telephony.qmltypes 2014-10-15 19:48:28 +0000 | |||
808 | @@ -22,7 +22,8 @@ | |||
809 | 22 | exportMetaObjectRevisions: [0] | 22 | exportMetaObjectRevisions: [0] |
810 | 23 | Property { name: "phoneNumber"; type: "string" } | 23 | Property { name: "phoneNumber"; type: "string" } |
811 | 24 | Property { name: "isConference"; type: "bool" } | 24 | Property { name: "isConference"; type: "bool" } |
813 | 25 | Property { name: "elapsedTime"; type: "int"; isReadonly: true } | 25 | Property { name: "elapsedTime"; type: "int" } |
814 | 26 | Property { name: "elapsedTimerRunning"; type: "bool" } | ||
815 | 26 | } | 27 | } |
816 | 27 | Component { | 28 | Component { |
817 | 28 | name: "MockCallManager" | 29 | name: "MockCallManager" |
818 | 29 | 30 | ||
819 | === modified file 'tests/mocks/Unity/Application/Application.qmltypes' | |||
820 | --- tests/mocks/Unity/Application/Application.qmltypes 2014-09-01 12:24:06 +0000 | |||
821 | +++ tests/mocks/Unity/Application/Application.qmltypes 2014-10-15 19:48:28 +0000 | |||
822 | @@ -238,6 +238,7 @@ | |||
823 | 238 | Property { name: "state"; type: "State"; isReadonly: true } | 238 | Property { name: "state"; type: "State"; isReadonly: true } |
824 | 239 | Property { name: "name"; type: "string"; isReadonly: true } | 239 | Property { name: "name"; type: "string"; isReadonly: true } |
825 | 240 | Property { name: "live"; type: "bool"; isReadonly: true } | 240 | Property { name: "live"; type: "bool"; isReadonly: true } |
826 | 241 | Property { name: "orientation"; type: "Qt::ScreenOrientation" } | ||
827 | 241 | Signal { | 242 | Signal { |
828 | 242 | name: "typeChanged" | 243 | name: "typeChanged" |
829 | 243 | Parameter { type: "Type" } | 244 | Parameter { type: "Type" } |
830 | @@ -268,10 +269,15 @@ | |||
831 | 268 | exportMetaObjectRevisions: [0] | 269 | exportMetaObjectRevisions: [0] |
832 | 269 | Property { name: "name"; type: "string"; isReadonly: true } | 270 | Property { name: "name"; type: "string"; isReadonly: true } |
833 | 270 | Property { name: "surface"; type: "MirSurfaceItem"; isReadonly: true; isPointer: true } | 271 | Property { name: "surface"; type: "MirSurfaceItem"; isReadonly: true; isPointer: true } |
834 | 272 | Property { name: "application"; type: "ApplicationInfo"; isReadonly: true; isPointer: true } | ||
835 | 271 | Property { name: "parentSession"; type: "Session"; isReadonly: true; isPointer: true } | 273 | Property { name: "parentSession"; type: "Session"; isReadonly: true; isPointer: true } |
836 | 272 | Property { name: "childSessions"; type: "SessionModel"; isReadonly: true; isPointer: true } | 274 | Property { name: "childSessions"; type: "SessionModel"; isReadonly: true; isPointer: true } |
837 | 273 | Property { name: "live"; type: "bool"; isReadonly: true } | 275 | Property { name: "live"; type: "bool"; isReadonly: true } |
838 | 274 | Signal { | 276 | Signal { |
839 | 277 | name: "applicationChanged" | ||
840 | 278 | Parameter { type: "ApplicationInfo"; isPointer: true } | ||
841 | 279 | } | ||
842 | 280 | Signal { | ||
843 | 275 | name: "surfaceChanged" | 281 | name: "surfaceChanged" |
844 | 276 | Parameter { type: "MirSurfaceItem"; isPointer: true } | 282 | Parameter { type: "MirSurfaceItem"; isPointer: true } |
845 | 277 | } | 283 | } |
846 | @@ -368,6 +374,12 @@ | |||
847 | 368 | Property { name: "stage"; type: "Stage"; isReadonly: true } | 374 | Property { name: "stage"; type: "Stage"; isReadonly: true } |
848 | 369 | Property { name: "state"; type: "State"; isReadonly: true } | 375 | Property { name: "state"; type: "State"; isReadonly: true } |
849 | 370 | Property { name: "focused"; type: "bool"; isReadonly: true } | 376 | Property { name: "focused"; type: "bool"; isReadonly: true } |
850 | 377 | Property { name: "splashTitle"; type: "string"; isReadonly: true } | ||
851 | 378 | Property { name: "splashImage"; type: "QUrl"; isReadonly: true } | ||
852 | 379 | Property { name: "splashShowHeader"; type: "bool"; isReadonly: true } | ||
853 | 380 | Property { name: "splashColor"; type: "QColor"; isReadonly: true } | ||
854 | 381 | Property { name: "splashColorHeader"; type: "QColor"; isReadonly: true } | ||
855 | 382 | Property { name: "splashColorFooter"; type: "QColor"; isReadonly: true } | ||
856 | 371 | Signal { | 383 | Signal { |
857 | 372 | name: "nameChanged" | 384 | name: "nameChanged" |
858 | 373 | Parameter { name: "name"; type: "string" } | 385 | Parameter { name: "name"; type: "string" } |
859 | @@ -414,6 +426,7 @@ | |||
860 | 414 | Property { name: "count"; type: "int"; isReadonly: true } | 426 | Property { name: "count"; type: "int"; isReadonly: true } |
861 | 415 | Property { name: "focusedApplicationId"; type: "string"; isReadonly: true } | 427 | Property { name: "focusedApplicationId"; type: "string"; isReadonly: true } |
862 | 416 | Property { name: "suspended"; type: "bool" } | 428 | Property { name: "suspended"; type: "bool" } |
863 | 429 | Property { name: "forceDashActive"; type: "bool" } | ||
864 | 417 | Signal { | 430 | Signal { |
865 | 418 | name: "focusRequested" | 431 | name: "focusRequested" |
866 | 419 | Parameter { name: "appId"; type: "string" } | 432 | Parameter { name: "appId"; type: "string" } |
867 | 420 | 433 | ||
868 | === modified file 'tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes' | |||
869 | --- tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-08-14 13:33:28 +0000 | |||
870 | +++ tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes 2014-10-15 19:48:28 +0000 | |||
871 | @@ -34,13 +34,13 @@ | |||
872 | 34 | name: "setCurrentScopeRequested" | 34 | name: "setCurrentScopeRequested" |
873 | 35 | Parameter { name: "scopeId"; type: "string" } | 35 | Parameter { name: "scopeId"; type: "string" } |
874 | 36 | Parameter { name: "animate"; type: "bool" } | 36 | Parameter { name: "animate"; type: "bool" } |
876 | 37 | Parameter { name: "reset"; type: "bool" } | 37 | Parameter { name: "isSwipe"; type: "bool" } |
877 | 38 | } | 38 | } |
878 | 39 | Method { | 39 | Method { |
879 | 40 | name: "mockSetCurrentScope" | 40 | name: "mockSetCurrentScope" |
880 | 41 | Parameter { name: "scopeId"; type: "string" } | 41 | Parameter { name: "scopeId"; type: "string" } |
881 | 42 | Parameter { name: "animate"; type: "bool" } | 42 | Parameter { name: "animate"; type: "bool" } |
883 | 43 | Parameter { name: "reset"; type: "bool" } | 43 | Parameter { name: "isSwipe"; type: "bool" } |
884 | 44 | } | 44 | } |
885 | 45 | } | 45 | } |
886 | 46 | } | 46 | } |
887 | 47 | 47 | ||
888 | === modified file 'tests/mocks/Unity/Indicators/CMakeLists.txt' | |||
889 | --- tests/mocks/Unity/Indicators/CMakeLists.txt 2014-08-20 08:39:09 +0000 | |||
890 | +++ tests/mocks/Unity/Indicators/CMakeLists.txt 2014-10-15 19:48:28 +0000 | |||
891 | @@ -12,24 +12,17 @@ | |||
892 | 12 | 12 | ||
893 | 13 | set(IndicatorsFakeQml_SOURCES | 13 | set(IndicatorsFakeQml_SOURCES |
894 | 14 | fakeplugin.cpp | 14 | fakeplugin.cpp |
895 | 15 | fakeindicatorsmodel.cpp | ||
896 | 16 | fakeunitymenumodelcache.cpp | ||
897 | 15 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h | 17 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/indicators.h |
898 | 16 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/menucontentactivator.cpp | 18 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/menucontentactivator.cpp |
899 | 19 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/sharedunitymenumodel.cpp | ||
900 | 17 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelcache.cpp | 20 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelcache.cpp |
901 | 18 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp | 21 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/unitymenumodelstack.cpp |
902 | 19 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp | 22 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Indicators/visibleindicatorsmodel.cpp |
903 | 20 | fakeindicatorsmodel.cpp | ||
904 | 21 | ) | ||
905 | 22 | |||
906 | 23 | set(IndicatorsFakeQml_RESOURCES | ||
907 | 24 | indicators_fake.qrc | ||
908 | 25 | ) | ||
909 | 26 | |||
910 | 27 | qt5_add_resources(IndicatorsFakeQml_RESOURCES_RCC | ||
911 | 28 | ${IndicatorsFakeQml_RESOURCES} | ||
912 | 29 | ) | 23 | ) |
913 | 30 | 24 | ||
914 | 31 | add_library(IndicatorsFakeQml SHARED | 25 | add_library(IndicatorsFakeQml SHARED |
915 | 32 | ${IndicatorsFakeQml_RESOURCES_RCC} | ||
916 | 33 | ${IndicatorsFakeQml_SOURCES} | 26 | ${IndicatorsFakeQml_SOURCES} |
917 | 34 | ) | 27 | ) |
918 | 35 | add_definitions(-DUNITYINDICATORS_LIBRARY) | 28 | add_definitions(-DUNITYINDICATORS_LIBRARY) |
919 | 36 | 29 | ||
920 | === removed file 'tests/mocks/Unity/Indicators/FakeMenuPage.qml' | |||
921 | --- tests/mocks/Unity/Indicators/FakeMenuPage.qml 2014-09-09 15:10:52 +0000 | |||
922 | +++ tests/mocks/Unity/Indicators/FakeMenuPage.qml 1970-01-01 00:00:00 +0000 | |||
923 | @@ -1,27 +0,0 @@ | |||
924 | 1 | /* | ||
925 | 2 | * Copyright 2013 Canonical Ltd. | ||
926 | 3 | * | ||
927 | 4 | * This program is free software; you can redistribute it and/or modify | ||
928 | 5 | * it under the terms of the GNU General Public License as published by | ||
929 | 6 | * the Free Software Foundation; version 3. | ||
930 | 7 | * | ||
931 | 8 | * This program is distributed in the hope that it will be useful, | ||
932 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
933 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
934 | 11 | * GNU General Public License for more details. | ||
935 | 12 | * | ||
936 | 13 | * You should have received a copy of the GNU General Public License | ||
937 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
938 | 15 | */ | ||
939 | 16 | |||
940 | 17 | import QtQuick 2.0 | ||
941 | 18 | |||
942 | 19 | Flickable { | ||
943 | 20 | objectName: "fakeMenuPlugin" | ||
944 | 21 | // Make it compatible with the PluginItem interface | ||
945 | 22 | function reset() { | ||
946 | 23 | if (shell != undefined && shell.indicator_status != undefined) { | ||
947 | 24 | shell.indicator_status[objectName].reset++; | ||
948 | 25 | } | ||
949 | 26 | } | ||
950 | 27 | } | ||
951 | 28 | 0 | ||
952 | === modified file 'tests/mocks/Unity/Indicators/Indicators.qmltypes' | |||
953 | --- tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-09-01 12:18:53 +0000 | |||
954 | +++ tests/mocks/Unity/Indicators/Indicators.qmltypes 2014-10-15 19:48:28 +0000 | |||
955 | @@ -29,6 +29,7 @@ | |||
956 | 29 | exports: ["Unity.Indicators/FakeIndicatorsModel 0.1"] | 29 | exports: ["Unity.Indicators/FakeIndicatorsModel 0.1"] |
957 | 30 | exportMetaObjectRevisions: [0] | 30 | exportMetaObjectRevisions: [0] |
958 | 31 | Property { name: "count"; type: "int"; isReadonly: true } | 31 | Property { name: "count"; type: "int"; isReadonly: true } |
959 | 32 | Property { name: "modelData"; type: "QVariant" } | ||
960 | 32 | Method { | 33 | Method { |
961 | 33 | name: "load" | 34 | name: "load" |
962 | 34 | Parameter { name: "profile"; type: "string" } | 35 | Parameter { name: "profile"; type: "string" } |
963 | @@ -39,6 +40,15 @@ | |||
964 | 39 | Parameter { name: "row"; type: "QVariantMap" } | 40 | Parameter { name: "row"; type: "QVariantMap" } |
965 | 40 | } | 41 | } |
966 | 41 | Method { | 42 | Method { |
967 | 43 | name: "insert" | ||
968 | 44 | Parameter { name: "row"; type: "int" } | ||
969 | 45 | Parameter { name: "data"; type: "QVariantMap" } | ||
970 | 46 | } | ||
971 | 47 | Method { | ||
972 | 48 | name: "remove" | ||
973 | 49 | Parameter { name: "row"; type: "int" } | ||
974 | 50 | } | ||
975 | 51 | Method { | ||
976 | 42 | name: "data" | 52 | name: "data" |
977 | 43 | type: "QVariant" | 53 | type: "QVariant" |
978 | 44 | Parameter { name: "row"; type: "int" } | 54 | Parameter { name: "row"; type: "int" } |
979 | @@ -46,6 +56,27 @@ | |||
980 | 46 | } | 56 | } |
981 | 47 | } | 57 | } |
982 | 48 | Component { | 58 | Component { |
983 | 59 | name: "FakeUnityMenuModelCache" | ||
984 | 60 | prototype: "UnityMenuModelCache" | ||
985 | 61 | exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] | ||
986 | 62 | isCreatable: false | ||
987 | 63 | isSingleton: true | ||
988 | 64 | exportMetaObjectRevisions: [0] | ||
989 | 65 | Method { | ||
990 | 66 | name: "setCachedModelData" | ||
991 | 67 | Parameter { name: "bus"; type: "QByteArray" } | ||
992 | 68 | Parameter { name: "path"; type: "QByteArray" } | ||
993 | 69 | Parameter { name: "actions"; type: "QVariantMap" } | ||
994 | 70 | Parameter { name: "data"; type: "QVariant" } | ||
995 | 71 | } | ||
996 | 72 | Method { | ||
997 | 73 | name: "setCachedModelData" | ||
998 | 74 | Parameter { name: "bus"; type: "QByteArray" } | ||
999 | 75 | Parameter { name: "path"; type: "QByteArray" } | ||
1000 | 76 | Parameter { name: "actions"; type: "QVariantMap" } | ||
1001 | 77 | } | ||
1002 | 78 | } | ||
1003 | 79 | Component { | ||
1004 | 49 | name: "FlatMenuProxyModelRole" | 80 | name: "FlatMenuProxyModelRole" |
1005 | 50 | prototype: "QObject" | 81 | prototype: "QObject" |
1006 | 51 | exports: ["Unity.Indicators/FlatMenuProxyModelRole 0.1"] | 82 | exports: ["Unity.Indicators/FlatMenuProxyModelRole 0.1"] |
1007 | @@ -160,19 +191,18 @@ | |||
1008 | 160 | } | 191 | } |
1009 | 161 | Component { name: "QIdentityProxyModel"; prototype: "QAbstractProxyModel" } | 192 | Component { name: "QIdentityProxyModel"; prototype: "QAbstractProxyModel" } |
1010 | 162 | Component { | 193 | Component { |
1011 | 194 | name: "SharedUnityMenuModel" | ||
1012 | 195 | prototype: "QObject" | ||
1013 | 196 | exports: ["Unity.Indicators/SharedUnityMenuModel 0.1"] | ||
1014 | 197 | exportMetaObjectRevisions: [0] | ||
1015 | 198 | Property { name: "busName"; type: "QByteArray" } | ||
1016 | 199 | Property { name: "menuObjectPath"; type: "QByteArray" } | ||
1017 | 200 | Property { name: "actions"; type: "QVariantMap" } | ||
1018 | 201 | Property { name: "model"; type: "UnityMenuModel"; isReadonly: true; isPointer: true } | ||
1019 | 202 | } | ||
1020 | 203 | Component { | ||
1021 | 163 | name: "UnityMenuModelCache" | 204 | name: "UnityMenuModelCache" |
1022 | 164 | prototype: "QObject" | 205 | prototype: "QObject" |
1023 | 165 | exports: ["Unity.Indicators/UnityMenuModelCache 0.1"] | ||
1024 | 166 | isCreatable: false | ||
1025 | 167 | isSingleton: true | ||
1026 | 168 | exportMetaObjectRevisions: [0] | ||
1027 | 169 | Method { | ||
1028 | 170 | name: "model" | ||
1029 | 171 | type: "UnityMenuModel*" | ||
1030 | 172 | Parameter { name: "bus"; type: "QByteArray" } | ||
1031 | 173 | Parameter { name: "path"; type: "QByteArray" } | ||
1032 | 174 | Parameter { name: "actions"; type: "QVariantMap" } | ||
1033 | 175 | } | ||
1034 | 176 | Method { | 206 | Method { |
1035 | 177 | name: "contains" | 207 | name: "contains" |
1036 | 178 | type: "bool" | 208 | type: "bool" |
1037 | 179 | 209 | ||
1038 | === modified file 'tests/mocks/Unity/Indicators/IndicatorsModel.qml' | |||
1039 | --- tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-03-03 11:55:00 +0000 | |||
1040 | +++ tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-10-15 19:48:28 +0000 | |||
1041 | @@ -18,43 +18,151 @@ | |||
1042 | 18 | import Unity.Indicators 0.1 as Indicators | 18 | import Unity.Indicators 0.1 as Indicators |
1043 | 19 | 19 | ||
1044 | 20 | Indicators.FakeIndicatorsModel { | 20 | Indicators.FakeIndicatorsModel { |
1045 | 21 | id: root | ||
1046 | 22 | |||
1047 | 23 | Component.onCompleted: { | ||
1048 | 24 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake1", | ||
1049 | 25 | "/com/canonical/indicators/fake1", | ||
1050 | 26 | "/com/canonical/indicators/fake1", | ||
1051 | 27 | getUnityMenuModelData("fake-indicator-bluetooth", | ||
1052 | 28 | "Bluetooth (F)", | ||
1053 | 29 | "", | ||
1054 | 30 | [ "image://theme/bluetooth-active" ])); | ||
1055 | 31 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake2", | ||
1056 | 32 | "/com/canonical/indicators/fake2", | ||
1057 | 33 | "/com/canonical/indicators/fake2", | ||
1058 | 34 | getUnityMenuModelData("fake-indicator-network", | ||
1059 | 35 | "Network (F)", | ||
1060 | 36 | "", | ||
1061 | 37 | [ "image://theme/simcard-error", "image://theme/wifi-high" ])); | ||
1062 | 38 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake3", | ||
1063 | 39 | "/com/canonical/indicators/fake3", | ||
1064 | 40 | "/com/canonical/indicators/fake3", | ||
1065 | 41 | getUnityMenuModelData("fake-indicator-sound", | ||
1066 | 42 | "Messages (F)", | ||
1067 | 43 | "", | ||
1068 | 44 | [ "image://theme/messages-new" ])); | ||
1069 | 45 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake4", | ||
1070 | 46 | "/com/canonical/indicators/fake4", | ||
1071 | 47 | "/com/canonical/indicators/fake4", | ||
1072 | 48 | getUnityMenuModelData("fake-indicator-power", | ||
1073 | 49 | "Sound (F)", | ||
1074 | 50 | "", | ||
1075 | 51 | [ "image://theme/audio-volume-high" ])); | ||
1076 | 52 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicators.fake5", | ||
1077 | 53 | "/com/canonical/indicators/fake5", | ||
1078 | 54 | "/com/canonical/indicators/fake5", | ||
1079 | 55 | getUnityMenuModelData("fake-indicator-power", | ||
1080 | 56 | "Battery (F)", | ||
1081 | 57 | "", | ||
1082 | 58 | [ "image://theme/battery-020" ])); | ||
1083 | 59 | } | ||
1084 | 60 | |||
1085 | 61 | function getUnityMenuModelData(identifier, title, label, icons) { | ||
1086 | 62 | var root = [{ | ||
1087 | 63 | "rowData": { // 1 | ||
1088 | 64 | "label": "", | ||
1089 | 65 | "sensitive": true, | ||
1090 | 66 | "isSeparator": false, | ||
1091 | 67 | "icon": "", | ||
1092 | 68 | "type": "com.canonical.indicator.root", | ||
1093 | 69 | "ext": {}, | ||
1094 | 70 | "action": "", | ||
1095 | 71 | "actionState": { | ||
1096 | 72 | "title": title, | ||
1097 | 73 | "label": label, | ||
1098 | 74 | "icons": icons | ||
1099 | 75 | }, | ||
1100 | 76 | "isCheck": false, | ||
1101 | 77 | "isRadio": false, | ||
1102 | 78 | "isToggled": false, | ||
1103 | 79 | }, | ||
1104 | 80 | "submenu": [] | ||
1105 | 81 | }]; | ||
1106 | 82 | |||
1107 | 83 | var submenus = []; | ||
1108 | 84 | for (var i = 0; i < 8; i++) { | ||
1109 | 85 | var submenu = { | ||
1110 | 86 | "rowData": { // 1.1 | ||
1111 | 87 | "label": identifier, | ||
1112 | 88 | "sensitive": true, | ||
1113 | 89 | "isSeparator": false, | ||
1114 | 90 | "icon": "", | ||
1115 | 91 | "type": undefined, | ||
1116 | 92 | "ext": {}, | ||
1117 | 93 | "action": "", | ||
1118 | 94 | "actionState": {}, | ||
1119 | 95 | "isCheck": false, | ||
1120 | 96 | "isRadio": false, | ||
1121 | 97 | "isToggled": false, | ||
1122 | 98 | }}; | ||
1123 | 99 | submenus.push(submenu); | ||
1124 | 100 | } | ||
1125 | 101 | root[0]["submenu"] = submenus; | ||
1126 | 102 | |||
1127 | 103 | return root; | ||
1128 | 104 | } | ||
1129 | 105 | |||
1130 | 106 | property var originalModelData: [ | ||
1131 | 107 | { | ||
1132 | 108 | "identifier": "indicator-fake1", | ||
1133 | 109 | "widgetSource": "Indicators/DefaultIndicatorWidget.qml", | ||
1134 | 110 | "pageSource": "Indicators/DefaultIndicatorPage.qml", | ||
1135 | 111 | "indicatorProperties": { | ||
1136 | 112 | "enabled": true, | ||
1137 | 113 | "busName": "com.canonical.indicators.fake1", | ||
1138 | 114 | "menuObjectPath": "/com/canonical/indicators/fake1", | ||
1139 | 115 | "actionsObjectPath": "/com/canonical/indicators/fake1" | ||
1140 | 116 | } | ||
1141 | 117 | }, | ||
1142 | 118 | { | ||
1143 | 119 | "identifier": "indicator-fake2", | ||
1144 | 120 | "widgetSource": "Indicators/DefaultIndicatorWidget.qml", | ||
1145 | 121 | "pageSource": "Indicators/DefaultIndicatorPage.qml", | ||
1146 | 122 | "indicatorProperties": { | ||
1147 | 123 | "enabled": true, | ||
1148 | 124 | "busName": "com.canonical.indicators.fake2", | ||
1149 | 125 | "menuObjectPath": "/com/canonical/indicators/fake2", | ||
1150 | 126 | "actionsObjectPath": "/com/canonical/indicators/fake2" | ||
1151 | 127 | } | ||
1152 | 128 | }, | ||
1153 | 129 | { | ||
1154 | 130 | "identifier": "indicator-fake3", | ||
1155 | 131 | "widgetSource": "Indicators/DefaultIndicatorWidget.qml", | ||
1156 | 132 | "pageSource": "Indicators/DefaultIndicatorPage.qml", | ||
1157 | 133 | "indicatorProperties": { | ||
1158 | 134 | "enabled": true, | ||
1159 | 135 | "busName": "com.canonical.indicators.fake3", | ||
1160 | 136 | "menuObjectPath": "/com/canonical/indicators/fake3", | ||
1161 | 137 | "actionsObjectPath": "/com/canonical/indicators/fake3" | ||
1162 | 138 | } | ||
1163 | 139 | }, | ||
1164 | 140 | { | ||
1165 | 141 | "identifier": "indicator-fake4", | ||
1166 | 142 | "widgetSource": "Indicators/DefaultIndicatorWidget.qml", | ||
1167 | 143 | "pageSource": "Indicators/DefaultIndicatorPage.qml", | ||
1168 | 144 | "indicatorProperties": { | ||
1169 | 145 | "enabled": true, | ||
1170 | 146 | "busName": "com.canonical.indicators.fake4", | ||
1171 | 147 | "menuObjectPath": "/com/canonical/indicators/fake4", | ||
1172 | 148 | "actionsObjectPath": "/com/canonical/indicators/fake4" | ||
1173 | 149 | } | ||
1174 | 150 | }, | ||
1175 | 151 | { | ||
1176 | 152 | "identifier": "indicator-fake5", | ||
1177 | 153 | "widgetSource": "Indicators/DefaultIndicatorWidget.qml", | ||
1178 | 154 | "pageSource": "Indicators/DefaultIndicatorPage.qml", | ||
1179 | 155 | "indicatorProperties": { | ||
1180 | 156 | "enabled": true, | ||
1181 | 157 | "busName": "com.canonical.indicators.fake5", | ||
1182 | 158 | "menuObjectPath": "/com/canonical/indicators/fake5", | ||
1183 | 159 | "actionsObjectPath": "/com/canonical/indicators/fake5" | ||
1184 | 160 | } | ||
1185 | 161 | } | ||
1186 | 162 | ] | ||
1187 | 21 | 163 | ||
1188 | 22 | function load(profile) { | 164 | function load(profile) { |
1189 | 23 | unload(); | 165 | unload(); |
1225 | 24 | 166 | root.modelData = originalModelData; | |
1191 | 25 | append({ "identifier": "indicator-fake1", | ||
1192 | 26 | "position": 0, | ||
1193 | 27 | "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml", | ||
1194 | 28 | "pageSource": "qrc:/tests/indciators/qml/fake_menu_page1.qml", | ||
1195 | 29 | "indicatorProperties": { enabled: true } | ||
1196 | 30 | }); | ||
1197 | 31 | |||
1198 | 32 | append({ "identifier": "indicator-fake2", | ||
1199 | 33 | "position": 1, | ||
1200 | 34 | "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget2.qml", | ||
1201 | 35 | "pageSource": "qrc:/tests/indciators/qml/fake_menu_page2.qml", | ||
1202 | 36 | "indicatorProperties": { enabled: true } | ||
1203 | 37 | }); | ||
1204 | 38 | |||
1205 | 39 | append({ "identifier": "indicator-fake3", | ||
1206 | 40 | "position": 2, | ||
1207 | 41 | "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget3.qml", | ||
1208 | 42 | "pageSource": "qrc:/tests/indciators/qml/fake_menu_page3.qml", | ||
1209 | 43 | "indicatorProperties": { enabled: true } | ||
1210 | 44 | }); | ||
1211 | 45 | |||
1212 | 46 | append({ "identifier": "indicator-fake4", | ||
1213 | 47 | "position": 3, | ||
1214 | 48 | "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget4.qml", | ||
1215 | 49 | "pageSource": "qrc:/tests/indciators/qml/fake_menu_page4.qml", | ||
1216 | 50 | "indicatorProperties": { enabled: true } | ||
1217 | 51 | }); | ||
1218 | 52 | |||
1219 | 53 | append({ "identifier": "indicator-fake5", | ||
1220 | 54 | "position": 4, | ||
1221 | 55 | "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget5.qml", | ||
1222 | 56 | "pageSource": "qrc:/tests/indciators/qml/fake_menu_page5.qml", | ||
1223 | 57 | "indicatorProperties": { enabled: true } | ||
1224 | 58 | }); | ||
1226 | 59 | } | 167 | } |
1227 | 60 | } | 168 | } |
1228 | 61 | 169 | ||
1229 | === modified file 'tests/mocks/Unity/Indicators/RootActionState.qml' | |||
1230 | --- tests/mocks/Unity/Indicators/RootActionState.qml 2013-10-28 18:19:15 +0000 | |||
1231 | +++ tests/mocks/Unity/Indicators/RootActionState.qml 2014-10-15 19:48:28 +0000 | |||
1232 | @@ -19,15 +19,23 @@ | |||
1233 | 19 | 19 | ||
1234 | 20 | import QtQuick 2.0 | 20 | import QtQuick 2.0 |
1235 | 21 | 21 | ||
1245 | 22 | QtObject { | 22 | Item { |
1246 | 23 | property var menu | 23 | property var menu: null |
1247 | 24 | property bool valid: false | 24 | property bool valid: cachedState !== undefined |
1248 | 25 | property string title | 25 | property string title: cachedState && cachedState.hasOwnProperty("title") ? cachedState["title"] : "" |
1249 | 26 | property string leftLabel | 26 | property string leftLabel: cachedState && cachedState.hasOwnProperty("pre-label") ? cachedState["pre-label"] : "" |
1250 | 27 | property string rightLabel | 27 | property string rightLabel: cachedState && cachedState.hasOwnProperty("label") ? cachedState["label"] : "" |
1251 | 28 | property var icons | 28 | property var icons: cachedState && cachedState.hasOwnProperty("icons") ? cachedState["icons"] : [] |
1252 | 29 | property string accessibleName | 29 | property string accessibleName: cachedState && cachedState.hasOwnProperty("accessible-desc") ? cachedState["accessible-desc"] : "" |
1253 | 30 | property bool visible: true | 30 | visible: cachedState && cachedState.hasOwnProperty("visible") ? cachedState["visible"] : true |
1254 | 31 | |||
1255 | 32 | property var cachedState: menu ? menu.get(0, "actionState") : undefined | ||
1256 | 33 | Connections { | ||
1257 | 34 | target: menu | ||
1258 | 35 | onModelDataChanged: { | ||
1259 | 36 | cachedState = menu.get(0, "actionState"); | ||
1260 | 37 | } | ||
1261 | 38 | } | ||
1262 | 31 | 39 | ||
1263 | 32 | signal updated | 40 | signal updated |
1264 | 33 | 41 | ||
1265 | 34 | 42 | ||
1266 | === modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp' | |||
1267 | --- tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-07-01 09:49:24 +0000 | |||
1268 | +++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.cpp 2014-10-15 19:48:28 +0000 | |||
1269 | @@ -31,7 +31,6 @@ | |||
1270 | 31 | /*! \internal */ | 31 | /*! \internal */ |
1271 | 32 | FakeIndicatorsModel::~FakeIndicatorsModel() | 32 | FakeIndicatorsModel::~FakeIndicatorsModel() |
1272 | 33 | { | 33 | { |
1273 | 34 | qDeleteAll(m_indicators); | ||
1274 | 35 | } | 34 | } |
1275 | 36 | 35 | ||
1276 | 37 | int FakeIndicatorsModel::count() const | 36 | int FakeIndicatorsModel::count() const |
1277 | @@ -47,29 +46,61 @@ | |||
1278 | 47 | { | 46 | { |
1279 | 48 | beginResetModel(); | 47 | beginResetModel(); |
1280 | 49 | 48 | ||
1304 | 50 | qDeleteAll(m_indicators); | 49 | m_modelData.clear(); |
1305 | 51 | m_indicators.clear(); | 50 | Q_EMIT modelDataChanged(); |
1306 | 52 | 51 | ||
1307 | 53 | endResetModel(); | 52 | endResetModel(); |
1308 | 54 | } | 53 | } |
1309 | 55 | 54 | ||
1310 | 56 | 55 | ||
1311 | 57 | void FakeIndicatorsModel::append(const QVariantMap& row) | 56 | void FakeIndicatorsModel::append(const QVariantMap& data) |
1312 | 58 | { | 57 | { |
1313 | 59 | Indicator* new_row = new QHash<int, QVariant>(); | 58 | QList<QVariant> allData = m_modelData.toList(); |
1314 | 60 | for (auto iter = row.begin(); iter != row.end(); ++iter ) | 59 | beginInsertRows(QModelIndex(), allData.count(), allData.count()); |
1315 | 61 | { | 60 | |
1316 | 62 | int key = roleNames().key(iter.key().toUtf8(), -1); | 61 | allData.append(data); |
1317 | 63 | if (key != -1) { | 62 | m_modelData = allData; |
1318 | 64 | new_row->insert(key, iter.value()); | 63 | Q_EMIT modelDataChanged(); |
1319 | 65 | } | 64 | |
1320 | 66 | } | 65 | endInsertRows(); |
1321 | 67 | 66 | } | |
1322 | 68 | beginInsertRows(QModelIndex(), m_indicators.count(), m_indicators.count()); | 67 | |
1323 | 69 | 68 | void FakeIndicatorsModel::insert(int row, const QVariantMap& data) | |
1324 | 70 | m_indicators.append(new_row); | 69 | { |
1325 | 71 | 70 | QList<QVariant> allData = m_modelData.toList(); | |
1326 | 72 | endInsertRows(); | 71 | row = qMax(0, qMin(row, allData.count())); |
1327 | 72 | |||
1328 | 73 | beginInsertRows(QModelIndex(), row, row); | ||
1329 | 74 | |||
1330 | 75 | allData.insert(row, data); | ||
1331 | 76 | m_modelData = allData; | ||
1332 | 77 | Q_EMIT modelDataChanged(); | ||
1333 | 78 | |||
1334 | 79 | endInsertRows(); | ||
1335 | 80 | } | ||
1336 | 81 | |||
1337 | 82 | void FakeIndicatorsModel::remove(int row) | ||
1338 | 83 | { | ||
1339 | 84 | QList<QVariant> allData = m_modelData.toList(); | ||
1340 | 85 | row = qMax(0, qMin(row, allData.count())); | ||
1341 | 86 | |||
1342 | 87 | beginRemoveRows(QModelIndex(), row, row); | ||
1343 | 88 | |||
1344 | 89 | allData.removeAt(row); | ||
1345 | 90 | m_modelData = allData; | ||
1346 | 91 | Q_EMIT modelDataChanged(); | ||
1347 | 92 | |||
1348 | 93 | endRemoveRows(); | ||
1349 | 94 | } | ||
1350 | 95 | |||
1351 | 96 | void FakeIndicatorsModel::setModelData(const QVariant& modelData) | ||
1352 | 97 | { | ||
1353 | 98 | beginResetModel(); | ||
1354 | 99 | |||
1355 | 100 | m_modelData = modelData; | ||
1356 | 101 | Q_EMIT modelDataChanged(); | ||
1357 | 102 | |||
1358 | 103 | endResetModel(); | ||
1359 | 73 | } | 104 | } |
1360 | 74 | 105 | ||
1361 | 75 | QHash<int, QByteArray> FakeIndicatorsModel::roleNames() const | 106 | QHash<int, QByteArray> FakeIndicatorsModel::roleNames() const |
1362 | @@ -91,18 +122,18 @@ | |||
1363 | 91 | return 1; | 122 | return 1; |
1364 | 92 | } | 123 | } |
1365 | 93 | 124 | ||
1367 | 94 | Q_INVOKABLE QVariant FakeIndicatorsModel::data(int row, int role) const | 125 | QVariant FakeIndicatorsModel::data(int row, int role) const |
1368 | 95 | { | 126 | { |
1369 | 96 | return data(index(row, 0), role); | 127 | return data(index(row, 0), role); |
1370 | 97 | } | 128 | } |
1371 | 98 | 129 | ||
1372 | 99 | QVariant FakeIndicatorsModel::data(const QModelIndex &index, int role) const | 130 | QVariant FakeIndicatorsModel::data(const QModelIndex &index, int role) const |
1373 | 100 | { | 131 | { |
1375 | 101 | if (!index.isValid() || index.row() >= m_indicators.size()) | 132 | QList<QVariant> dataList = m_modelData.toList(); |
1376 | 133 | if (!index.isValid() || index.row() >= dataList.size()) | ||
1377 | 102 | return QVariant(); | 134 | return QVariant(); |
1378 | 103 | 135 | ||
1381 | 104 | Indicator* indicator = m_indicators[index.row()]; | 136 | return dataList[index.row()].toMap()[roleNames()[role]]; |
1380 | 105 | return indicator->value(role, QVariant()); | ||
1382 | 106 | } | 137 | } |
1383 | 107 | 138 | ||
1384 | 108 | QModelIndex FakeIndicatorsModel::parent(const QModelIndex&) const | 139 | QModelIndex FakeIndicatorsModel::parent(const QModelIndex&) const |
1385 | @@ -112,5 +143,5 @@ | |||
1386 | 112 | 143 | ||
1387 | 113 | int FakeIndicatorsModel::rowCount(const QModelIndex&) const | 144 | int FakeIndicatorsModel::rowCount(const QModelIndex&) const |
1388 | 114 | { | 145 | { |
1390 | 115 | return m_indicators.count(); | 146 | return m_modelData.toList().count(); |
1391 | 116 | } | 147 | } |
1392 | 117 | 148 | ||
1393 | === modified file 'tests/mocks/Unity/Indicators/fakeindicatorsmodel.h' | |||
1394 | --- tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-03-03 12:01:09 +0000 | |||
1395 | +++ tests/mocks/Unity/Indicators/fakeindicatorsmodel.h 2014-10-15 19:48:28 +0000 | |||
1396 | @@ -27,6 +27,7 @@ | |||
1397 | 27 | Q_OBJECT | 27 | Q_OBJECT |
1398 | 28 | Q_ENUMS(Roles) | 28 | Q_ENUMS(Roles) |
1399 | 29 | Q_PROPERTY(int count READ count NOTIFY countChanged) | 29 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
1400 | 30 | Q_PROPERTY(QVariant modelData READ modelData WRITE setModelData NOTIFY modelDataChanged) | ||
1401 | 30 | public: | 31 | public: |
1402 | 31 | 32 | ||
1403 | 32 | FakeIndicatorsModel(QObject *parent=0); | 33 | FakeIndicatorsModel(QObject *parent=0); |
1404 | @@ -36,9 +37,14 @@ | |||
1405 | 36 | Q_INVOKABLE void unload(); | 37 | Q_INVOKABLE void unload(); |
1406 | 37 | 38 | ||
1407 | 38 | Q_INVOKABLE void append(const QVariantMap& row); | 39 | Q_INVOKABLE void append(const QVariantMap& row); |
1408 | 40 | Q_INVOKABLE void insert(int row, const QVariantMap& data); | ||
1409 | 41 | Q_INVOKABLE void remove(int row); | ||
1410 | 39 | 42 | ||
1411 | 40 | Q_INVOKABLE QVariant data(int row, int role) const; | 43 | Q_INVOKABLE QVariant data(int row, int role) const; |
1412 | 41 | 44 | ||
1413 | 45 | void setModelData(const QVariant& data); | ||
1414 | 46 | QVariant modelData() const { return m_modelData; } | ||
1415 | 47 | |||
1416 | 42 | /* QAbstractItemModel */ | 48 | /* QAbstractItemModel */ |
1417 | 43 | QHash<int, QByteArray> roleNames() const; | 49 | QHash<int, QByteArray> roleNames() const; |
1418 | 44 | int columnCount(const QModelIndex &parent = QModelIndex()) const; | 50 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
1419 | @@ -48,12 +54,12 @@ | |||
1420 | 48 | 54 | ||
1421 | 49 | Q_SIGNALS: | 55 | Q_SIGNALS: |
1422 | 50 | void countChanged(); | 56 | void countChanged(); |
1423 | 57 | void modelDataChanged(); | ||
1424 | 51 | 58 | ||
1425 | 52 | private: | 59 | private: |
1426 | 53 | int count() const; | 60 | int count() const; |
1427 | 54 | 61 | ||
1430 | 55 | typedef QHash<int, QVariant> Indicator; | 62 | QVariant m_modelData; |
1429 | 56 | QList<Indicator*> m_indicators; | ||
1431 | 57 | }; | 63 | }; |
1432 | 58 | 64 | ||
1433 | 59 | #endif // FAKE_INDICATORSMODEL_H | 65 | #endif // FAKE_INDICATORSMODEL_H |
1434 | 60 | 66 | ||
1435 | === modified file 'tests/mocks/Unity/Indicators/fakeplugin.cpp' | |||
1436 | --- tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-08-20 08:39:09 +0000 | |||
1437 | +++ tests/mocks/Unity/Indicators/fakeplugin.cpp 2014-10-15 19:48:28 +0000 | |||
1438 | @@ -26,19 +26,22 @@ | |||
1439 | 26 | #include "fakeindicatorsmodel.h" | 26 | #include "fakeindicatorsmodel.h" |
1440 | 27 | #include "indicators.h" | 27 | #include "indicators.h" |
1441 | 28 | #include "menucontentactivator.h" | 28 | #include "menucontentactivator.h" |
1443 | 29 | #include "unitymenumodelcache.h" | 29 | #include "sharedunitymenumodel.h" |
1444 | 30 | #include "fakeunitymenumodelcache.h" | ||
1445 | 30 | #include "unitymenumodelstack.h" | 31 | #include "unitymenumodelstack.h" |
1446 | 31 | #include "visibleindicatorsmodel.h" | 32 | #include "visibleindicatorsmodel.h" |
1447 | 32 | 33 | ||
1448 | 34 | #include <unitymenumodel.h> | ||
1449 | 35 | |||
1450 | 33 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { | 36 | static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) { |
1451 | 34 | Q_UNUSED(engine); | 37 | Q_UNUSED(engine); |
1452 | 35 | Q_UNUSED(scriptEngine); | 38 | Q_UNUSED(scriptEngine); |
1454 | 36 | return new UnityMenuModelCache; | 39 | return FakeUnityMenuModelCache::singleton(); |
1455 | 37 | } | 40 | } |
1456 | 38 | 41 | ||
1457 | 39 | void IndicatorsFakePlugin::registerTypes(const char * uri) | 42 | void IndicatorsFakePlugin::registerTypes(const char * uri) |
1458 | 40 | { | 43 | { |
1460 | 41 | Q_INIT_RESOURCE(indicators_fake); | 44 | qRegisterMetaType<UnityMenuModel*>("UnityMenuModel*"); |
1461 | 42 | 45 | ||
1462 | 43 | // internal | 46 | // internal |
1463 | 44 | qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel"); | 47 | qmlRegisterType<FakeIndicatorsModel>(uri, 0, 1, "FakeIndicatorsModel"); |
1464 | @@ -47,8 +50,9 @@ | |||
1465 | 47 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); | 50 | qmlRegisterType<MenuContentActivator>(uri, 0, 1, "MenuContentActivator"); |
1466 | 48 | qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack"); | 51 | qmlRegisterType<UnityMenuModelStack>(uri, 0, 1, "UnityMenuModelStack"); |
1467 | 49 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); | 52 | qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel"); |
1468 | 53 | qmlRegisterType<SharedUnityMenuModel>(uri, 0, 1, "SharedUnityMenuModel"); | ||
1469 | 50 | 54 | ||
1471 | 51 | qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); | 55 | qmlRegisterSingletonType<FakeUnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton); |
1472 | 52 | 56 | ||
1473 | 53 | // external uncreatables | 57 | // external uncreatables |
1474 | 54 | qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class"); | 58 | qmlRegisterUncreatableType<MenuContentState>(uri, 0, 1, "MenuContentState", "Can't create MenuContentState class"); |
1475 | 55 | 59 | ||
1476 | === added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp' | |||
1477 | --- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 1970-01-01 00:00:00 +0000 | |||
1478 | +++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.cpp 2014-10-15 19:48:28 +0000 | |||
1479 | @@ -0,0 +1,57 @@ | |||
1480 | 1 | /* | ||
1481 | 2 | * Copyright 2014 Canonical Ltd. | ||
1482 | 3 | * | ||
1483 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1484 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1485 | 6 | * the Free Software Foundation; version 3. | ||
1486 | 7 | * | ||
1487 | 8 | * This program is distributed in the hope that it will be useful, | ||
1488 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1489 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1490 | 11 | * GNU Lesser General Public License for more details. | ||
1491 | 12 | * | ||
1492 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1493 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1494 | 15 | */ | ||
1495 | 16 | |||
1496 | 17 | #include "fakeunitymenumodelcache.h" | ||
1497 | 18 | #include <unitymenumodel.h> | ||
1498 | 19 | |||
1499 | 20 | QPointer<FakeUnityMenuModelCache> FakeUnityMenuModelCache::theFakeCache = nullptr; | ||
1500 | 21 | |||
1501 | 22 | FakeUnityMenuModelCache* FakeUnityMenuModelCache::singleton() | ||
1502 | 23 | { | ||
1503 | 24 | if (theFakeCache.isNull()) { | ||
1504 | 25 | theFakeCache = new FakeUnityMenuModelCache(); | ||
1505 | 26 | } | ||
1506 | 27 | return theFakeCache.data(); | ||
1507 | 28 | } | ||
1508 | 29 | |||
1509 | 30 | FakeUnityMenuModelCache::FakeUnityMenuModelCache(QObject* parent) | ||
1510 | 31 | : UnityMenuModelCache(parent) | ||
1511 | 32 | { | ||
1512 | 33 | } | ||
1513 | 34 | |||
1514 | 35 | QSharedPointer<UnityMenuModel> FakeUnityMenuModelCache::model(const QByteArray& bus, | ||
1515 | 36 | const QByteArray& path, | ||
1516 | 37 | const QVariantMap& actions) | ||
1517 | 38 | { | ||
1518 | 39 | return UnityMenuModelCache::singleton()->model(bus, path, actions); | ||
1519 | 40 | } | ||
1520 | 41 | |||
1521 | 42 | bool FakeUnityMenuModelCache::contains(const QByteArray& path) | ||
1522 | 43 | { | ||
1523 | 44 | return UnityMenuModelCache::singleton()->contains(path); | ||
1524 | 45 | } | ||
1525 | 46 | |||
1526 | 47 | void FakeUnityMenuModelCache::setCachedModelData(const QByteArray& bus, | ||
1527 | 48 | const QByteArray& path, | ||
1528 | 49 | const QVariantMap& actions, | ||
1529 | 50 | const QVariant& data) | ||
1530 | 51 | { | ||
1531 | 52 | // keep a ref forever! | ||
1532 | 53 | if (!m_models.contains(path)) { | ||
1533 | 54 | m_models[path] = model(bus, path, actions); | ||
1534 | 55 | } | ||
1535 | 56 | m_models[path]->setModelData(data); | ||
1536 | 57 | } | ||
1537 | 0 | 58 | ||
1538 | === added file 'tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h' | |||
1539 | --- tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 1970-01-01 00:00:00 +0000 | |||
1540 | +++ tests/mocks/Unity/Indicators/fakeunitymenumodelcache.h 2014-10-15 19:48:28 +0000 | |||
1541 | @@ -0,0 +1,49 @@ | |||
1542 | 1 | /* | ||
1543 | 2 | * Copyright 2014 Canonical Ltd. | ||
1544 | 3 | * | ||
1545 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1546 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1547 | 6 | * the Free Software Foundation; version 3. | ||
1548 | 7 | * | ||
1549 | 8 | * This program is distributed in the hope that it will be useful, | ||
1550 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1551 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1552 | 11 | * GNU Lesser General Public License for more details. | ||
1553 | 12 | * | ||
1554 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1555 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1556 | 15 | */ | ||
1557 | 16 | |||
1558 | 17 | #ifndef FAKEUNITYMENUMODELCACHE_H | ||
1559 | 18 | #define FAKEUNITYMENUMODELCACHE_H | ||
1560 | 19 | |||
1561 | 20 | #include "unitymenumodelcache.h" | ||
1562 | 21 | |||
1563 | 22 | #include <QVariantMap> | ||
1564 | 23 | |||
1565 | 24 | class FakeUnityMenuModelCache : public UnityMenuModelCache | ||
1566 | 25 | { | ||
1567 | 26 | Q_OBJECT | ||
1568 | 27 | public: | ||
1569 | 28 | FakeUnityMenuModelCache(QObject* parent = nullptr); | ||
1570 | 29 | |||
1571 | 30 | static FakeUnityMenuModelCache* singleton(); | ||
1572 | 31 | |||
1573 | 32 | QSharedPointer<UnityMenuModel> model(const QByteArray& bus, | ||
1574 | 33 | const QByteArray& path, | ||
1575 | 34 | const QVariantMap& actions) override; | ||
1576 | 35 | bool contains(const QByteArray& path) override; | ||
1577 | 36 | |||
1578 | 37 | |||
1579 | 38 | |||
1580 | 39 | Q_INVOKABLE void setCachedModelData(const QByteArray& bus, | ||
1581 | 40 | const QByteArray& path, | ||
1582 | 41 | const QVariantMap& actions, | ||
1583 | 42 | const QVariant& data = QVariant()); | ||
1584 | 43 | |||
1585 | 44 | private: | ||
1586 | 45 | static QPointer<FakeUnityMenuModelCache> theFakeCache; | ||
1587 | 46 | QHash<QByteArray, QSharedPointer<UnityMenuModel>> m_models; | ||
1588 | 47 | }; | ||
1589 | 48 | |||
1590 | 49 | #endif // FAKEUNITYMENUMODELCACHE_H | ||
1591 | 0 | 50 | ||
1592 | === removed file 'tests/mocks/Unity/Indicators/indicators_fake.qrc' | |||
1593 | --- tests/mocks/Unity/Indicators/indicators_fake.qrc 2013-06-17 09:02:14 +0000 | |||
1594 | +++ tests/mocks/Unity/Indicators/indicators_fake.qrc 1970-01-01 00:00:00 +0000 | |||
1595 | @@ -1,14 +0,0 @@ | |||
1596 | 1 | <RCC> | ||
1597 | 2 | <qresource prefix="/tests/indciators"> | ||
1598 | 3 | <file>qml/fake_menu_widget1.qml</file> | ||
1599 | 4 | <file>qml/fake_menu_widget2.qml</file> | ||
1600 | 5 | <file>qml/fake_menu_widget3.qml</file> | ||
1601 | 6 | <file>qml/fake_menu_widget4.qml</file> | ||
1602 | 7 | <file>qml/fake_menu_widget5.qml</file> | ||
1603 | 8 | <file>qml/fake_menu_page1.qml</file> | ||
1604 | 9 | <file>qml/fake_menu_page2.qml</file> | ||
1605 | 10 | <file>qml/fake_menu_page3.qml</file> | ||
1606 | 11 | <file>qml/fake_menu_page4.qml</file> | ||
1607 | 12 | <file>qml/fake_menu_page5.qml</file> | ||
1608 | 13 | </qresource> | ||
1609 | 14 | </RCC> | ||
1610 | 15 | 0 | ||
1611 | === removed directory 'tests/mocks/Unity/Indicators/qml' | |||
1612 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml' | |||
1613 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 2014-01-14 16:44:35 +0000 | |||
1614 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page1.qml 1970-01-01 00:00:00 +0000 | |||
1615 | @@ -1,35 +0,0 @@ | |||
1616 | 1 | /* | ||
1617 | 2 | * Copyright 2013 Canonical Ltd. | ||
1618 | 3 | * | ||
1619 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1620 | 5 | * it under the terms of the GNU General Public License as published by | ||
1621 | 6 | * the Free Software Foundation; version 3. | ||
1622 | 7 | * | ||
1623 | 8 | * This program is distributed in the hope that it will be useful, | ||
1624 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1625 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1626 | 11 | * GNU General Public License for more details. | ||
1627 | 12 | * | ||
1628 | 13 | * You should have received a copy of the GNU General Public License | ||
1629 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1630 | 15 | */ | ||
1631 | 16 | |||
1632 | 17 | import QtQuick 2.0 | ||
1633 | 18 | import Unity.Indicators 0.1 as Indicators | ||
1634 | 19 | |||
1635 | 20 | Indicators.FakeMenuPage { | ||
1636 | 21 | id: menu_plugin1 | ||
1637 | 22 | |||
1638 | 23 | Rectangle { | ||
1639 | 24 | id: contents | ||
1640 | 25 | color: "red" | ||
1641 | 26 | |||
1642 | 27 | height: 150 | ||
1643 | 28 | width: 150 | ||
1644 | 29 | |||
1645 | 30 | anchors { | ||
1646 | 31 | horizontalCenter: parent.horizontalCenter | ||
1647 | 32 | verticalCenter: parent.verticalCenter | ||
1648 | 33 | } | ||
1649 | 34 | } | ||
1650 | 35 | } | ||
1651 | 36 | 0 | ||
1652 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml' | |||
1653 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 2014-01-14 16:44:35 +0000 | |||
1654 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page2.qml 1970-01-01 00:00:00 +0000 | |||
1655 | @@ -1,35 +0,0 @@ | |||
1656 | 1 | /* | ||
1657 | 2 | * Copyright 2013 Canonical Ltd. | ||
1658 | 3 | * | ||
1659 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1660 | 5 | * it under the terms of the GNU General Public License as published by | ||
1661 | 6 | * the Free Software Foundation; version 3. | ||
1662 | 7 | * | ||
1663 | 8 | * This program is distributed in the hope that it will be useful, | ||
1664 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1665 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1666 | 11 | * GNU General Public License for more details. | ||
1667 | 12 | * | ||
1668 | 13 | * You should have received a copy of the GNU General Public License | ||
1669 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1670 | 15 | */ | ||
1671 | 16 | |||
1672 | 17 | import QtQuick 2.0 | ||
1673 | 18 | import Unity.Indicators 0.1 as Indicators | ||
1674 | 19 | |||
1675 | 20 | Indicators.FakeMenuPage { | ||
1676 | 21 | id: menu_plugin2 | ||
1677 | 22 | |||
1678 | 23 | Rectangle { | ||
1679 | 24 | id: contents | ||
1680 | 25 | color: "blue" | ||
1681 | 26 | |||
1682 | 27 | height: 150 | ||
1683 | 28 | width: 150 | ||
1684 | 29 | |||
1685 | 30 | anchors { | ||
1686 | 31 | horizontalCenter: parent.horizontalCenter | ||
1687 | 32 | verticalCenter: parent.verticalCenter | ||
1688 | 33 | } | ||
1689 | 34 | } | ||
1690 | 35 | } | ||
1691 | 36 | 0 | ||
1692 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml' | |||
1693 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 2014-01-14 16:44:35 +0000 | |||
1694 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page3.qml 1970-01-01 00:00:00 +0000 | |||
1695 | @@ -1,35 +0,0 @@ | |||
1696 | 1 | /* | ||
1697 | 2 | * Copyright 2013 Canonical Ltd. | ||
1698 | 3 | * | ||
1699 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1700 | 5 | * it under the terms of the GNU General Public License as published by | ||
1701 | 6 | * the Free Software Foundation; version 3. | ||
1702 | 7 | * | ||
1703 | 8 | * This program is distributed in the hope that it will be useful, | ||
1704 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1705 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1706 | 11 | * GNU General Public License for more details. | ||
1707 | 12 | * | ||
1708 | 13 | * You should have received a copy of the GNU General Public License | ||
1709 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1710 | 15 | */ | ||
1711 | 16 | |||
1712 | 17 | import QtQuick 2.0 | ||
1713 | 18 | import Unity.Indicators 0.1 as Indicators | ||
1714 | 19 | |||
1715 | 20 | Indicators.FakeMenuPage { | ||
1716 | 21 | id: menu_plugin3 | ||
1717 | 22 | |||
1718 | 23 | Rectangle { | ||
1719 | 24 | id: contents | ||
1720 | 25 | color: "yellow" | ||
1721 | 26 | |||
1722 | 27 | height: 150 | ||
1723 | 28 | width: 150 | ||
1724 | 29 | |||
1725 | 30 | anchors { | ||
1726 | 31 | horizontalCenter: parent.horizontalCenter | ||
1727 | 32 | verticalCenter: parent.verticalCenter | ||
1728 | 33 | } | ||
1729 | 34 | } | ||
1730 | 35 | } | ||
1731 | 36 | 0 | ||
1732 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml' | |||
1733 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 2014-01-14 16:44:35 +0000 | |||
1734 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page4.qml 1970-01-01 00:00:00 +0000 | |||
1735 | @@ -1,35 +0,0 @@ | |||
1736 | 1 | /* | ||
1737 | 2 | * Copyright 2013 Canonical Ltd. | ||
1738 | 3 | * | ||
1739 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1740 | 5 | * it under the terms of the GNU General Public License as published by | ||
1741 | 6 | * the Free Software Foundation; version 3. | ||
1742 | 7 | * | ||
1743 | 8 | * This program is distributed in the hope that it will be useful, | ||
1744 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1745 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1746 | 11 | * GNU General Public License for more details. | ||
1747 | 12 | * | ||
1748 | 13 | * You should have received a copy of the GNU General Public License | ||
1749 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1750 | 15 | */ | ||
1751 | 16 | |||
1752 | 17 | import QtQuick 2.0 | ||
1753 | 18 | import Unity.Indicators 0.1 as Indicators | ||
1754 | 19 | |||
1755 | 20 | Indicators.FakeMenuPage { | ||
1756 | 21 | id: menu_plugin4 | ||
1757 | 22 | |||
1758 | 23 | Rectangle { | ||
1759 | 24 | id: contents | ||
1760 | 25 | color: "green" | ||
1761 | 26 | |||
1762 | 27 | height: 150 | ||
1763 | 28 | width: 150 | ||
1764 | 29 | |||
1765 | 30 | anchors { | ||
1766 | 31 | horizontalCenter: parent.horizontalCenter | ||
1767 | 32 | verticalCenter: parent.verticalCenter | ||
1768 | 33 | } | ||
1769 | 34 | } | ||
1770 | 35 | } | ||
1771 | 36 | 0 | ||
1772 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml' | |||
1773 | --- tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 2014-01-14 16:44:35 +0000 | |||
1774 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_page5.qml 1970-01-01 00:00:00 +0000 | |||
1775 | @@ -1,35 +0,0 @@ | |||
1776 | 1 | /* | ||
1777 | 2 | * Copyright 2013 Canonical Ltd. | ||
1778 | 3 | * | ||
1779 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1780 | 5 | * it under the terms of the GNU General Public License as published by | ||
1781 | 6 | * the Free Software Foundation; version 3. | ||
1782 | 7 | * | ||
1783 | 8 | * This program is distributed in the hope that it will be useful, | ||
1784 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1785 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1786 | 11 | * GNU General Public License for more details. | ||
1787 | 12 | * | ||
1788 | 13 | * You should have received a copy of the GNU General Public License | ||
1789 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1790 | 15 | */ | ||
1791 | 16 | |||
1792 | 17 | import QtQuick 2.0 | ||
1793 | 18 | import Unity.Indicators 0.1 as Indicators | ||
1794 | 19 | |||
1795 | 20 | Indicators.FakeMenuPage { | ||
1796 | 21 | id: menu_plugin5 | ||
1797 | 22 | |||
1798 | 23 | Rectangle { | ||
1799 | 24 | id: contents | ||
1800 | 25 | color: "orange" | ||
1801 | 26 | |||
1802 | 27 | height: 150 | ||
1803 | 28 | width: 150 | ||
1804 | 29 | |||
1805 | 30 | anchors { | ||
1806 | 31 | horizontalCenter: parent.horizontalCenter | ||
1807 | 32 | verticalCenter: parent.verticalCenter | ||
1808 | 33 | } | ||
1809 | 34 | } | ||
1810 | 35 | } | ||
1811 | 36 | 0 | ||
1812 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml' | |||
1813 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 2013-06-17 09:02:14 +0000 | |||
1814 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget1.qml 1970-01-01 00:00:00 +0000 | |||
1815 | @@ -1,23 +0,0 @@ | |||
1816 | 1 | /* | ||
1817 | 2 | * Copyright 2013 Canonical Ltd. | ||
1818 | 3 | * | ||
1819 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1820 | 5 | * it under the terms of the GNU General Public License as published by | ||
1821 | 6 | * the Free Software Foundation; version 3. | ||
1822 | 7 | * | ||
1823 | 8 | * This program is distributed in the hope that it will be useful, | ||
1824 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1825 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1826 | 11 | * GNU General Public License for more details. | ||
1827 | 12 | * | ||
1828 | 13 | * You should have received a copy of the GNU General Public License | ||
1829 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1830 | 15 | */ | ||
1831 | 16 | |||
1832 | 17 | import QtQuick 2.0 | ||
1833 | 18 | |||
1834 | 19 | Rectangle { | ||
1835 | 20 | width: 40 | ||
1836 | 21 | height: 40 | ||
1837 | 22 | color : "red" | ||
1838 | 23 | } | ||
1839 | 24 | 0 | ||
1840 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml' | |||
1841 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2014-01-13 16:25:32 +0000 | |||
1842 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 1970-01-01 00:00:00 +0000 | |||
1843 | @@ -1,23 +0,0 @@ | |||
1844 | 1 | /* | ||
1845 | 2 | * Copyright 2013 Canonical Ltd. | ||
1846 | 3 | * | ||
1847 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1848 | 5 | * it under the terms of the GNU General Public License as published by | ||
1849 | 6 | * the Free Software Foundation; version 3. | ||
1850 | 7 | * | ||
1851 | 8 | * This program is distributed in the hope that it will be useful, | ||
1852 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1853 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1854 | 11 | * GNU General Public License for more details. | ||
1855 | 12 | * | ||
1856 | 13 | * You should have received a copy of the GNU General Public License | ||
1857 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1858 | 15 | */ | ||
1859 | 16 | |||
1860 | 17 | import QtQuick 2.0 | ||
1861 | 18 | |||
1862 | 19 | Rectangle { | ||
1863 | 20 | width: 40 | ||
1864 | 21 | height: 40 | ||
1865 | 22 | color : "blue" | ||
1866 | 23 | } | ||
1867 | 24 | 0 | ||
1868 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml' | |||
1869 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2014-01-13 16:25:32 +0000 | |||
1870 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 1970-01-01 00:00:00 +0000 | |||
1871 | @@ -1,23 +0,0 @@ | |||
1872 | 1 | /* | ||
1873 | 2 | * Copyright 2013 Canonical Ltd. | ||
1874 | 3 | * | ||
1875 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1876 | 5 | * it under the terms of the GNU General Public License as published by | ||
1877 | 6 | * the Free Software Foundation; version 3. | ||
1878 | 7 | * | ||
1879 | 8 | * This program is distributed in the hope that it will be useful, | ||
1880 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1881 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1882 | 11 | * GNU General Public License for more details. | ||
1883 | 12 | * | ||
1884 | 13 | * You should have received a copy of the GNU General Public License | ||
1885 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1886 | 15 | */ | ||
1887 | 16 | |||
1888 | 17 | import QtQuick 2.0 | ||
1889 | 18 | |||
1890 | 19 | Rectangle { | ||
1891 | 20 | width: 40 | ||
1892 | 21 | height: 40 | ||
1893 | 22 | color : "yellow" | ||
1894 | 23 | } | ||
1895 | 24 | 0 | ||
1896 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml' | |||
1897 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 2013-06-17 09:02:14 +0000 | |||
1898 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget4.qml 1970-01-01 00:00:00 +0000 | |||
1899 | @@ -1,23 +0,0 @@ | |||
1900 | 1 | /* | ||
1901 | 2 | * Copyright 2013 Canonical Ltd. | ||
1902 | 3 | * | ||
1903 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1904 | 5 | * it under the terms of the GNU General Public License as published by | ||
1905 | 6 | * the Free Software Foundation; version 3. | ||
1906 | 7 | * | ||
1907 | 8 | * This program is distributed in the hope that it will be useful, | ||
1908 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1909 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1910 | 11 | * GNU General Public License for more details. | ||
1911 | 12 | * | ||
1912 | 13 | * You should have received a copy of the GNU General Public License | ||
1913 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1914 | 15 | */ | ||
1915 | 16 | |||
1916 | 17 | import QtQuick 2.0 | ||
1917 | 18 | |||
1918 | 19 | Rectangle { | ||
1919 | 20 | width: 40 | ||
1920 | 21 | height: 40 | ||
1921 | 22 | color : "green" | ||
1922 | 23 | } | ||
1923 | 24 | 0 | ||
1924 | === removed file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml' | |||
1925 | --- tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 2013-06-17 09:02:14 +0000 | |||
1926 | +++ tests/mocks/Unity/Indicators/qml/fake_menu_widget5.qml 1970-01-01 00:00:00 +0000 | |||
1927 | @@ -1,23 +0,0 @@ | |||
1928 | 1 | /* | ||
1929 | 2 | * Copyright 2013 Canonical Ltd. | ||
1930 | 3 | * | ||
1931 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1932 | 5 | * it under the terms of the GNU General Public License as published by | ||
1933 | 6 | * the Free Software Foundation; version 3. | ||
1934 | 7 | * | ||
1935 | 8 | * This program is distributed in the hope that it will be useful, | ||
1936 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1937 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1938 | 11 | * GNU General Public License for more details. | ||
1939 | 12 | * | ||
1940 | 13 | * You should have received a copy of the GNU General Public License | ||
1941 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1942 | 15 | */ | ||
1943 | 16 | |||
1944 | 17 | import QtQuick 2.0 | ||
1945 | 18 | |||
1946 | 19 | Rectangle { | ||
1947 | 20 | width: 40 | ||
1948 | 21 | height: 40 | ||
1949 | 22 | color : "orange" | ||
1950 | 23 | } | ||
1951 | 24 | 0 | ||
1952 | === modified file 'tests/mocks/Unity/Indicators/qmldir' | |||
1953 | --- tests/mocks/Unity/Indicators/qmldir 2014-08-20 08:39:09 +0000 | |||
1954 | +++ tests/mocks/Unity/Indicators/qmldir 2014-10-15 19:48:28 +0000 | |||
1955 | @@ -3,5 +3,4 @@ | |||
1956 | 3 | typeinfo Indicators.qmltypes | 3 | typeinfo Indicators.qmltypes |
1957 | 4 | 4 | ||
1958 | 5 | IndicatorsModel 0.1 IndicatorsModel.qml | 5 | IndicatorsModel 0.1 IndicatorsModel.qml |
1959 | 6 | FakeMenuPage 0.1 FakeMenuPage.qml | ||
1960 | 7 | RootActionState 0.1 RootActionState.qml | 6 | RootActionState 0.1 RootActionState.qml |
1961 | 8 | 7 | ||
1962 | === modified file 'tests/mocks/Unity/Launcher/Launcher.qmltypes' | |||
1963 | --- tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-06-26 07:47:57 +0000 | |||
1964 | +++ tests/mocks/Unity/Launcher/Launcher.qmltypes 2014-10-15 19:48:28 +0000 | |||
1965 | @@ -85,6 +85,7 @@ | |||
1966 | 85 | Property { name: "recent"; type: "bool"; isReadonly: true } | 85 | Property { name: "recent"; type: "bool"; isReadonly: true } |
1967 | 86 | Property { name: "progress"; type: "int"; isReadonly: true } | 86 | Property { name: "progress"; type: "int"; isReadonly: true } |
1968 | 87 | Property { name: "count"; type: "int"; isReadonly: true } | 87 | Property { name: "count"; type: "int"; isReadonly: true } |
1969 | 88 | Property { name: "countVisible"; type: "bool"; isReadonly: true } | ||
1970 | 88 | Property { name: "focused"; type: "bool"; isReadonly: true } | 89 | Property { name: "focused"; type: "bool"; isReadonly: true } |
1971 | 89 | Property { | 90 | Property { |
1972 | 90 | name: "quickList" | 91 | name: "quickList" |
1973 | @@ -93,6 +94,14 @@ | |||
1974 | 93 | isPointer: true | 94 | isPointer: true |
1975 | 94 | } | 95 | } |
1976 | 95 | Signal { | 96 | Signal { |
1977 | 97 | name: "nameChanged" | ||
1978 | 98 | Parameter { name: "name"; type: "string" } | ||
1979 | 99 | } | ||
1980 | 100 | Signal { | ||
1981 | 101 | name: "iconChanged" | ||
1982 | 102 | Parameter { name: "icon"; type: "string" } | ||
1983 | 103 | } | ||
1984 | 104 | Signal { | ||
1985 | 96 | name: "pinnedChanged" | 105 | name: "pinnedChanged" |
1986 | 97 | Parameter { name: "pinned"; type: "bool" } | 106 | Parameter { name: "pinned"; type: "bool" } |
1987 | 98 | } | 107 | } |
1988 | @@ -113,6 +122,10 @@ | |||
1989 | 113 | Parameter { name: "count"; type: "int" } | 122 | Parameter { name: "count"; type: "int" } |
1990 | 114 | } | 123 | } |
1991 | 115 | Signal { | 124 | Signal { |
1992 | 125 | name: "countVisibleChanged" | ||
1993 | 126 | Parameter { name: "countVisible"; type: "bool" } | ||
1994 | 127 | } | ||
1995 | 128 | Signal { | ||
1996 | 116 | name: "focusedChanged" | 129 | name: "focusedChanged" |
1997 | 117 | Parameter { name: "focused"; type: "bool" } | 130 | Parameter { name: "focused"; type: "bool" } |
1998 | 118 | } | 131 | } |
1999 | 119 | 132 | ||
2000 | === modified file 'tests/mocks/Unity/Unity.qmltypes' | |||
2001 | --- tests/mocks/Unity/Unity.qmltypes 2014-09-01 12:18:53 +0000 | |||
2002 | +++ tests/mocks/Unity/Unity.qmltypes 2014-10-15 19:48:28 +0000 | |||
2003 | @@ -30,6 +30,25 @@ | |||
2004 | 30 | Parameter { name: "row"; type: "int" } | 30 | Parameter { name: "row"; type: "int" } |
2005 | 31 | Parameter { name: "role"; type: "int" } | 31 | Parameter { name: "role"; type: "int" } |
2006 | 32 | } | 32 | } |
2007 | 33 | Method { | ||
2008 | 34 | name: "setCount" | ||
2009 | 35 | Parameter { name: "count"; type: "int" } | ||
2010 | 36 | } | ||
2011 | 37 | Method { | ||
2012 | 38 | name: "resultModel" | ||
2013 | 39 | type: "ResultsModel*" | ||
2014 | 40 | Parameter { name: "row"; type: "int" } | ||
2015 | 41 | } | ||
2016 | 42 | Method { | ||
2017 | 43 | name: "setLayout" | ||
2018 | 44 | Parameter { name: "row"; type: "int" } | ||
2019 | 45 | Parameter { name: "layout"; type: "string" } | ||
2020 | 46 | } | ||
2021 | 47 | Method { | ||
2022 | 48 | name: "setHeaderLink" | ||
2023 | 49 | Parameter { name: "row"; type: "int" } | ||
2024 | 50 | Parameter { name: "headerLink"; type: "string" } | ||
2025 | 51 | } | ||
2026 | 33 | } | 52 | } |
2027 | 34 | Component { | 53 | Component { |
2028 | 35 | name: "PreviewModel" | 54 | name: "PreviewModel" |
2029 | @@ -66,6 +85,10 @@ | |||
2030 | 66 | exports: ["Unity/FakeResultsModel 0.2", "Unity/ResultsModel 0.2"] | 85 | exports: ["Unity/FakeResultsModel 0.2", "Unity/ResultsModel 0.2"] |
2031 | 67 | isCreatable: false | 86 | isCreatable: false |
2032 | 68 | exportMetaObjectRevisions: [0, 0] | 87 | exportMetaObjectRevisions: [0, 0] |
2033 | 88 | Method { | ||
2034 | 89 | name: "setResultCount" | ||
2035 | 90 | Parameter { name: "result_count"; type: "int" } | ||
2036 | 91 | } | ||
2037 | 69 | } | 92 | } |
2038 | 70 | Component { | 93 | Component { |
2039 | 71 | name: "Scope" | 94 | name: "Scope" |
2040 | @@ -76,6 +99,15 @@ | |||
2041 | 76 | name: "performQuery" | 99 | name: "performQuery" |
2042 | 77 | Parameter { name: "query"; type: "string" } | 100 | Parameter { name: "query"; type: "string" } |
2043 | 78 | } | 101 | } |
2044 | 102 | Signal { name: "refreshed" } | ||
2045 | 103 | Method { | ||
2046 | 104 | name: "setId" | ||
2047 | 105 | Parameter { name: "id"; type: "string" } | ||
2048 | 106 | } | ||
2049 | 107 | Method { | ||
2050 | 108 | name: "setName" | ||
2051 | 109 | Parameter { name: "name"; type: "string" } | ||
2052 | 110 | } | ||
2053 | 79 | Method { | 111 | Method { |
2054 | 80 | name: "setSearchInProgress" | 112 | name: "setSearchInProgress" |
2055 | 81 | Parameter { name: "inProg"; type: "bool" } | 113 | Parameter { name: "inProg"; type: "bool" } |
2056 | 82 | 114 | ||
2057 | === modified file 'tests/plugins/Unity/Indicators/CMakeLists.txt' | |||
2058 | --- tests/plugins/Unity/Indicators/CMakeLists.txt 2013-12-10 14:22:43 +0000 | |||
2059 | +++ tests/plugins/Unity/Indicators/CMakeLists.txt 2014-10-15 19:48:28 +0000 | |||
2060 | @@ -40,3 +40,4 @@ | |||
2061 | 40 | indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp) | 40 | indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp) |
2062 | 41 | indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp) | 41 | indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp) |
2063 | 42 | indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml) | 42 | indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml) |
2064 | 43 | indicator_test(sharedunitymenumodeltest ADDITIONAL_LIBS IndicatorsQml) | ||
2065 | 43 | 44 | ||
2066 | === added file 'tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp' | |||
2067 | --- tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 1970-01-01 00:00:00 +0000 | |||
2068 | +++ tests/plugins/Unity/Indicators/sharedunitymenumodeltest.cpp 2014-10-15 19:48:28 +0000 | |||
2069 | @@ -0,0 +1,102 @@ | |||
2070 | 1 | /* | ||
2071 | 2 | * Copyright 2014 Canonical Ltd. | ||
2072 | 3 | * | ||
2073 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2074 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2075 | 6 | * the Free Software Foundation; version 3. | ||
2076 | 7 | * | ||
2077 | 8 | * This program is distributed in the hope that it will be useful, | ||
2078 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2079 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2080 | 11 | * GNU Lesser General Public License for more details. | ||
2081 | 12 | * | ||
2082 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2083 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2084 | 15 | * | ||
2085 | 16 | */ | ||
2086 | 17 | |||
2087 | 18 | #include "sharedunitymenumodel.h" | ||
2088 | 19 | #include "unitymenumodelcache.h" | ||
2089 | 20 | |||
2090 | 21 | #include <QtTest> | ||
2091 | 22 | #include <unitymenumodel.h> | ||
2092 | 23 | |||
2093 | 24 | class SharedUnityMenuModelTest : public QObject | ||
2094 | 25 | { | ||
2095 | 26 | Q_OBJECT | ||
2096 | 27 | |||
2097 | 28 | SharedUnityMenuModel* createFullModel(const QByteArray& testId) | ||
2098 | 29 | { | ||
2099 | 30 | SharedUnityMenuModel* model = new SharedUnityMenuModel; | ||
2100 | 31 | model->setBusName("com.canonical." + testId); | ||
2101 | 32 | model->setMenuObjectPath("/com/canonical/" + testId); | ||
2102 | 33 | QVariantMap actions; | ||
2103 | 34 | actions["test"] = QString("/com/canonical/%1/actions").arg(QString(testId)); | ||
2104 | 35 | model->setActions(actions); | ||
2105 | 36 | |||
2106 | 37 | return model; | ||
2107 | 38 | } | ||
2108 | 39 | |||
2109 | 40 | private Q_SLOTS: | ||
2110 | 41 | |||
2111 | 42 | void testCreateModel() | ||
2112 | 43 | { | ||
2113 | 44 | QSharedPointer<SharedUnityMenuModel> model(createFullModel("test1")); | ||
2114 | 45 | QVERIFY(model->model() != nullptr); | ||
2115 | 46 | } | ||
2116 | 47 | |||
2117 | 48 | void testDifferentDataCreatesDifferentModels() | ||
2118 | 49 | { | ||
2119 | 50 | QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); | ||
2120 | 51 | QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test2")); | ||
2121 | 52 | |||
2122 | 53 | QVERIFY(model1->model() != model2->model()); | ||
2123 | 54 | } | ||
2124 | 55 | |||
2125 | 56 | void testSameDataCreatesSameModels() | ||
2126 | 57 | { | ||
2127 | 58 | QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); | ||
2128 | 59 | QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); | ||
2129 | 60 | |||
2130 | 61 | QCOMPARE(model1->model(), model2->model()); | ||
2131 | 62 | } | ||
2132 | 63 | |||
2133 | 64 | void testSharedOwnership() | ||
2134 | 65 | { | ||
2135 | 66 | QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); | ||
2136 | 67 | QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); | ||
2137 | 68 | |||
2138 | 69 | QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true); | ||
2139 | 70 | model1.clear(); | ||
2140 | 71 | QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true); | ||
2141 | 72 | model2.clear(); | ||
2142 | 73 | QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), false); | ||
2143 | 74 | } | ||
2144 | 75 | |||
2145 | 76 | // Tests that changing cached model data does not change the model path of others | ||
2146 | 77 | void testLP1328646() | ||
2147 | 78 | { | ||
2148 | 79 | QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); | ||
2149 | 80 | QSharedPointer<SharedUnityMenuModel> model2(createFullModel("test1")); | ||
2150 | 81 | |||
2151 | 82 | model2->setMenuObjectPath("/com/canonical/LP1328646"); | ||
2152 | 83 | |||
2153 | 84 | QVERIFY(model1->model() != model2->model()); | ||
2154 | 85 | QCOMPARE(model1->model()->menuObjectPath(), QByteArray("/com/canonical/test1")); | ||
2155 | 86 | QCOMPARE(model2->model()->menuObjectPath(), QByteArray("/com/canonical/LP1328646")); | ||
2156 | 87 | } | ||
2157 | 88 | |||
2158 | 89 | // Tests that the cache is recreated if deleted. | ||
2159 | 90 | void testDeletedCache() | ||
2160 | 91 | { | ||
2161 | 92 | QSharedPointer<SharedUnityMenuModel> model1(createFullModel("test1")); | ||
2162 | 93 | |||
2163 | 94 | QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), true); | ||
2164 | 95 | delete UnityMenuModelCache::singleton(); | ||
2165 | 96 | QCOMPARE(UnityMenuModelCache::singleton()->contains("/com/canonical/test1"), false); | ||
2166 | 97 | } | ||
2167 | 98 | |||
2168 | 99 | }; | ||
2169 | 100 | |||
2170 | 101 | QTEST_GUILESS_MAIN(SharedUnityMenuModelTest) | ||
2171 | 102 | #include "sharedunitymenumodeltest.moc" | ||
2172 | 0 | 103 | ||
2173 | === modified file 'tests/qmltests/CMakeLists.txt' | |||
2174 | --- tests/qmltests/CMakeLists.txt 2014-10-01 13:22:00 +0000 | |||
2175 | +++ tests/qmltests/CMakeLists.txt 2014-10-15 19:48:28 +0000 | |||
2176 | @@ -19,9 +19,9 @@ | |||
2177 | 19 | set(qmltest_DEFAULT_NO_ADD_TEST TRUE) | 19 | set(qmltest_DEFAULT_NO_ADD_TEST TRUE) |
2178 | 20 | set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C") | 20 | set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "LC_ALL=C") |
2179 | 21 | 21 | ||
2183 | 22 | add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single") | 22 | add_qml_test(. Shell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2184 | 23 | add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin") | 23 | add_qml_test(. ShellWithPin ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single-pin:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2185 | 24 | add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full") | 24 | add_qml_test(. TabletShell ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/full:${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2186 | 25 | add_qml_test(Components Background) | 25 | add_qml_test(Components Background) |
2187 | 26 | add_qml_test(Components Carousel) | 26 | add_qml_test(Components Carousel) |
2188 | 27 | add_qml_test(Components DraggingArea) | 27 | add_qml_test(Components DraggingArea) |
2189 | @@ -72,14 +72,13 @@ | |||
2190 | 72 | add_qml_test(Notifications Notifications) | 72 | add_qml_test(Notifications Notifications) |
2191 | 73 | add_qml_test(Notifications VisualSnapDecisionsQueue) | 73 | add_qml_test(Notifications VisualSnapDecisionsQueue) |
2192 | 74 | add_qml_test(Panel ActiveCallHint) | 74 | add_qml_test(Panel ActiveCallHint) |
2197 | 75 | add_qml_test(Panel IndicatorRow) | 75 | add_qml_test(Panel IndicatorRow ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2198 | 76 | add_qml_test(Panel Indicators) | 76 | add_qml_test(Panel Indicators ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2199 | 77 | add_qml_test(Panel MenuContent) | 77 | add_qml_test(Panel MenuContent ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2200 | 78 | add_qml_test(Panel Panel) | 78 | add_qml_test(Panel Panel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2201 | 79 | add_qml_test(Panel SearchIndicator) | 79 | add_qml_test(Panel SearchIndicator) |
2202 | 80 | add_qml_test(Panel/Indicators DefaultIndicatorWidget ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") | 80 | add_qml_test(Panel/Indicators DefaultIndicatorWidget ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2203 | 81 | add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") | 81 | add_qml_test(Panel/Indicators DefaultIndicatorPage ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") |
2204 | 82 | add_qml_test(Panel/Indicators CachedUnityMenuModel ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/QMenuModel") | ||
2205 | 83 | # These MenuItemFactory tests need the test/mocks/ to come before plugins/ | 82 | # These MenuItemFactory tests need the test/mocks/ to come before plugins/ |
2206 | 84 | add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) | 83 | add_qml_test(Panel/Indicators MenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) |
2207 | 85 | add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) | 84 | add_qml_test(Panel/Indicators MessageMenuItemFactory IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks ${qmltest_DEFAULT_IMPORT_PATHS}) |
2208 | 86 | 85 | ||
2209 | === modified file 'tests/qmltests/Greeter/tst_Clock.qml' | |||
2210 | --- tests/qmltests/Greeter/tst_Clock.qml 2014-05-01 14:25:18 +0000 | |||
2211 | +++ tests/qmltests/Greeter/tst_Clock.qml 2014-10-15 19:48:28 +0000 | |||
2212 | @@ -19,7 +19,7 @@ | |||
2213 | 19 | import ".." | 19 | import ".." |
2214 | 20 | import "../../../qml/Greeter" | 20 | import "../../../qml/Greeter" |
2215 | 21 | import Ubuntu.Components 0.1 | 21 | import Ubuntu.Components 0.1 |
2217 | 22 | import QMenuModel 0.1 | 22 | import Unity.Indicators 0.1 as Indicators |
2218 | 23 | import Unity.Test 0.1 as UT | 23 | import Unity.Test 0.1 as UT |
2219 | 24 | 24 | ||
2220 | 25 | Rectangle { | 25 | Rectangle { |
2221 | @@ -36,56 +36,73 @@ | |||
2222 | 36 | } | 36 | } |
2223 | 37 | } | 37 | } |
2224 | 38 | 38 | ||
2232 | 39 | UnityMenuModel { | 39 | function updateDatetimeModelTime(label) { |
2233 | 40 | id: menuModel | 40 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.datetime", |
2234 | 41 | modelData: [{ | 41 | "/com/canonical/indicator/datetime/phone", |
2235 | 42 | "rowData": { | 42 | "/com/canonical/indicator/datetime", |
2236 | 43 | "actionState": { "label": Qt.formatTime(new Date("October 13, 1975 11:13:00")) } | 43 | [{ |
2237 | 44 | } | 44 | "rowData": { |
2238 | 45 | }] | 45 | "actionState": { "label": label } |
2239 | 46 | } | ||
2240 | 47 | }]); | ||
2241 | 46 | } | 48 | } |
2242 | 47 | 49 | ||
2243 | 48 | UT.UnityTestCase { | 50 | UT.UnityTestCase { |
2244 | 49 | name: "Clock" | 51 | name: "Clock" |
2245 | 52 | when: windowShown | ||
2246 | 50 | 53 | ||
2247 | 51 | function init() { | 54 | function init() { |
2270 | 52 | var cachedModel = findChild(clock, "timeModel"); | 55 | updateDatetimeModelTime(Qt.formatTime(new Date("October 13, 1975 12:14:00"))); |
2271 | 53 | verify(cachedModel !== undefined); | 56 | clock.visible = true; |
2272 | 54 | cachedModel.model = menuModel; | 57 | } |
2273 | 55 | } | 58 | |
2274 | 56 | 59 | // Test that the date portion of the clock updates with custom value. | |
2275 | 57 | function test_customDate() { | 60 | // Time portion is controlled by indicators |
2276 | 58 | var dateObj = new Date("October 13, 1975 11:13:00") | 61 | function test_updateDate() { |
2277 | 59 | var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate) | 62 | var dateLabel = findChild(clock, "dateLabel"); |
2278 | 60 | var timeString = Qt.formatTime(dateObj) | 63 | var timeLabel = findChild(clock, "timeLabel"); |
2279 | 61 | 64 | ||
2280 | 62 | clock.currentDate = dateObj | 65 | var timeString = Qt.formatTime(new Date("October 13, 1975 12:14:00")); |
2281 | 63 | var dateLabel = findChild(clock, "dateLabel") | 66 | |
2282 | 64 | compare(dateLabel.text, dateString, "Not the expected date") | 67 | // initial date. |
2283 | 65 | var timeLabel = findChild(clock, "timeLabel") | 68 | var dateObj = new Date("October 13, 1975 11:13:00"); |
2284 | 66 | compare(timeLabel.text, timeString, "Not the expected time") | 69 | var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate); |
2285 | 67 | } | 70 | clock.currentDate = dateObj; |
2286 | 68 | 71 | ||
2287 | 69 | function test_dateUpdate() { | 72 | compare(dateLabel.text, dateString, "Not the expected date"); |
2288 | 70 | var dateObj = new Date("October 13, 1975 11:13:00") | 73 | compare(timeLabel.text, timeString, "Time should come from indicators"); |
2289 | 71 | var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate) | 74 | |
2290 | 72 | var timeString = Qt.formatTime(dateObj) | 75 | // update date. |
2291 | 73 | 76 | var dateObj2 = new Date("October 14, 1976 13:15:00"); | |
2292 | 77 | var dateString2 = Qt.formatDate(dateObj2, Qt.DefaultLocaleLongDate); | ||
2293 | 78 | clock.currentDate = dateObj2; | ||
2294 | 79 | |||
2295 | 80 | compare(dateLabel.text, dateString2, "Not the expected date"); | ||
2296 | 81 | compare(timeLabel.text,timeString, "Time should come from indicators"); | ||
2297 | 82 | } | ||
2298 | 83 | |||
2299 | 84 | // Test that the date portion of the clock updates with custom value. | ||
2300 | 85 | // Time portion is controlled by indicators | ||
2301 | 86 | function test_updateTime() { | ||
2302 | 87 | var timeLabel = findChild(clock, "timeLabel"); | ||
2303 | 88 | |||
2304 | 89 | var timeString1 = Qt.formatTime(new Date("October 13, 1975 11:15:00")); | ||
2305 | 90 | var timeString2 = Qt.formatTime(new Date("October 14, 1976 12:16:00")); | ||
2306 | 91 | |||
2307 | 92 | updateDatetimeModelTime(timeString1); | ||
2308 | 93 | compare(timeLabel.text, timeString1, "Time should come from indicators"); | ||
2309 | 94 | |||
2310 | 95 | updateDatetimeModelTime(timeString2); | ||
2311 | 96 | compare(timeLabel.text, timeString2, "Time should come from indicators"); | ||
2312 | 97 | } | ||
2313 | 98 | |||
2314 | 99 | function test_indicatorDisconnect() { | ||
2315 | 74 | clock.visible = false | 100 | clock.visible = false |
2316 | 75 | var timeModel = findInvisibleChild(clock, "timeModel") | 101 | var timeModel = findInvisibleChild(clock, "timeModel") |
2317 | 76 | |||
2318 | 77 | compare(timeModel.menuObjectPath, "", "Clock shouldn't be connected to Indicators when not visible.") | 102 | compare(timeModel.menuObjectPath, "", "Clock shouldn't be connected to Indicators when not visible.") |
2319 | 78 | 103 | ||
2320 | 79 | clock.currentDate = dateObj | ||
2321 | 80 | |||
2322 | 81 | var dateLabel = findChild(clock, "dateLabel") | ||
2323 | 82 | compare(dateLabel.text, dateString, "Not the expected date") | ||
2324 | 83 | var timeLabel = findChild(clock, "timeLabel") | ||
2325 | 84 | compare(timeLabel.text, timeString, "Not the expected time") | ||
2326 | 85 | |||
2327 | 86 | clock.visible = true | 104 | clock.visible = true |
2330 | 87 | 105 | verify(timeModel.menuObjectPath !== "", "Should be connected to Indicators.") | |
2329 | 88 | verify(timeModel.menuObjectPath != "", "Should be connected to Indicators.") | ||
2331 | 89 | } | 106 | } |
2332 | 90 | } | 107 | } |
2333 | 91 | } | 108 | } |
2334 | 92 | 109 | ||
2335 | === removed file 'tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml' | |||
2336 | --- tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 2014-08-20 09:16:28 +0000 | |||
2337 | +++ tests/qmltests/Panel/Indicators/tst_CachedUnityMenuModel.qml 1970-01-01 00:00:00 +0000 | |||
2338 | @@ -1,137 +0,0 @@ | |||
2339 | 1 | /* | ||
2340 | 2 | * Copyright 2014 Canonical Ltd. | ||
2341 | 3 | * | ||
2342 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2343 | 5 | * it under the terms of the GNU General Public License as published by | ||
2344 | 6 | * the Free Software Foundation; version 3. | ||
2345 | 7 | * | ||
2346 | 8 | * This program is distributed in the hope that it will be useful, | ||
2347 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2348 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2349 | 11 | * GNU General Public License for more details. | ||
2350 | 12 | * | ||
2351 | 13 | * You should have received a copy of the GNU General Public License | ||
2352 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2353 | 15 | */ | ||
2354 | 16 | |||
2355 | 17 | import QtQuick 2.0 | ||
2356 | 18 | import QtTest 1.0 | ||
2357 | 19 | import Unity.Test 0.1 as UT | ||
2358 | 20 | import QMenuModel 0.1 | ||
2359 | 21 | import Unity.Indicators 0.1 as Indicators | ||
2360 | 22 | import "../../../../qml/Panel/Indicators" | ||
2361 | 23 | |||
2362 | 24 | Item { | ||
2363 | 25 | id: root | ||
2364 | 26 | width: units.gu(40) | ||
2365 | 27 | height: units.gu(70) | ||
2366 | 28 | |||
2367 | 29 | Component { | ||
2368 | 30 | id: model | ||
2369 | 31 | CachedUnityMenuModel {} | ||
2370 | 32 | } | ||
2371 | 33 | |||
2372 | 34 | UT.UnityTestCase { | ||
2373 | 35 | name: "CachedUnityMenuModel" | ||
2374 | 36 | when: windowShown | ||
2375 | 37 | |||
2376 | 38 | function cleanup() { | ||
2377 | 39 | doGC(); | ||
2378 | 40 | } | ||
2379 | 41 | |||
2380 | 42 | function doGC() { | ||
2381 | 43 | // need to put some wait cycles here to get gc going properly. | ||
2382 | 44 | wait(10); | ||
2383 | 45 | gc(); | ||
2384 | 46 | wait(10); | ||
2385 | 47 | } | ||
2386 | 48 | |||
2387 | 49 | function test_createDifferent() { | ||
2388 | 50 | var cachedObject = model.createObject(null, | ||
2389 | 51 | { | ||
2390 | 52 | "busName": "com.canonical.test1", | ||
2391 | 53 | "menuObjectPath": "/com/canonical/test1", | ||
2392 | 54 | "actionsObjectPath": "/com/canonical/test1" | ||
2393 | 55 | }); | ||
2394 | 56 | |||
2395 | 57 | var cachedObject2 = model.createObject(null, | ||
2396 | 58 | { | ||
2397 | 59 | "busName": "com.canonical.test2", | ||
2398 | 60 | "menuObjectPath": "/com/canonical/test2", | ||
2399 | 61 | "actionsObjectPath": "/com/canonical/test2" | ||
2400 | 62 | }); | ||
2401 | 63 | |||
2402 | 64 | verify(cachedObject.model !== cachedObject2.model); | ||
2403 | 65 | } | ||
2404 | 66 | |||
2405 | 67 | function test_createSame() { | ||
2406 | 68 | var cachedObject = model.createObject(null, | ||
2407 | 69 | { | ||
2408 | 70 | "busName": "com.canonical.test3", | ||
2409 | 71 | "menuObjectPath": "/com/canonical/test3", | ||
2410 | 72 | "actionsObjectPath": "/com/canonical/test3" | ||
2411 | 73 | }); | ||
2412 | 74 | |||
2413 | 75 | var cachedObject2 = model.createObject(null, | ||
2414 | 76 | { | ||
2415 | 77 | "busName": "com.canonical.test3", | ||
2416 | 78 | "menuObjectPath": "/com/canonical/test3", | ||
2417 | 79 | "actionsObjectPath": "/com/canonical/test3" | ||
2418 | 80 | }); | ||
2419 | 81 | |||
2420 | 82 | verify(cachedObject.model === cachedObject2.model); | ||
2421 | 83 | } | ||
2422 | 84 | |||
2423 | 85 | // Tests that changing cached model data does not change the model path of others | ||
2424 | 86 | function test_lp1328646() { | ||
2425 | 87 | var cachedObject = model.createObject(null, | ||
2426 | 88 | { | ||
2427 | 89 | "busName": "com.canonical.test4", | ||
2428 | 90 | "menuObjectPath": "/com/canonical/test4", | ||
2429 | 91 | "actionsObjectPath": "/com/canonical/test4" | ||
2430 | 92 | }); | ||
2431 | 93 | |||
2432 | 94 | var cachedObject2 = model.createObject(null, | ||
2433 | 95 | { | ||
2434 | 96 | "busName": "com.canonical.test4", | ||
2435 | 97 | "menuObjectPath": "/com/canonical/test4", | ||
2436 | 98 | "actionsObjectPath": "/com/canonical/test4" | ||
2437 | 99 | }); | ||
2438 | 100 | |||
2439 | 101 | cachedObject.menuObjectPath = "/com/canonical/test5"; | ||
2440 | 102 | compare(cachedObject.model.menuObjectPath, "/com/canonical/test5"); | ||
2441 | 103 | compare(cachedObject2.model.menuObjectPath, "/com/canonical/test4"); | ||
2442 | 104 | |||
2443 | 105 | verify(cachedObject.model !== cachedObject2.model); | ||
2444 | 106 | } | ||
2445 | 107 | |||
2446 | 108 | function createAndDestroy(test) { | ||
2447 | 109 | var cachedObject = model.createObject(null, | ||
2448 | 110 | { | ||
2449 | 111 | "busName": "com.canonical."+test, | ||
2450 | 112 | "menuObjectPath": "/com/canonical/"+test, | ||
2451 | 113 | "actionsObjectPath": "/com/canonical/"+test | ||
2452 | 114 | }); | ||
2453 | 115 | var cachedObject2 = model.createObject(null, | ||
2454 | 116 | { | ||
2455 | 117 | "busName": "com.canonical."+test, | ||
2456 | 118 | "menuObjectPath": "/com/canonical/"+test, | ||
2457 | 119 | "actionsObjectPath": "/com/canonical/"+test | ||
2458 | 120 | }); | ||
2459 | 121 | cachedObject.destroy(); | ||
2460 | 122 | return cachedObject2; | ||
2461 | 123 | } | ||
2462 | 124 | |||
2463 | 125 | function test_destroyAllDeletesModel() { | ||
2464 | 126 | createAndDestroy("test6"); | ||
2465 | 127 | doGC(); | ||
2466 | 128 | compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test6"), false); | ||
2467 | 129 | } | ||
2468 | 130 | |||
2469 | 131 | function test_destroyPartialKeepsModel() { | ||
2470 | 132 | var model = createAndDestroy("test7"); | ||
2471 | 133 | doGC(); | ||
2472 | 134 | compare(Indicators.UnityMenuModelCache.contains("/com/canonical/test7"), true); | ||
2473 | 135 | } | ||
2474 | 136 | } | ||
2475 | 137 | } | ||
2476 | 138 | 0 | ||
2477 | === modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml' | |||
2478 | --- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-09-29 10:24:58 +0000 | |||
2479 | +++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml 2014-10-15 19:48:28 +0000 | |||
2480 | @@ -17,7 +17,7 @@ | |||
2481 | 17 | import QtQuick 2.0 | 17 | import QtQuick 2.0 |
2482 | 18 | import QtTest 1.0 | 18 | import QtTest 1.0 |
2483 | 19 | import Unity.Test 0.1 as UT | 19 | import Unity.Test 0.1 as UT |
2485 | 20 | import QMenuModel 0.1 | 20 | import Unity.Indicators 0.1 as Indicators |
2486 | 21 | import "../../../../qml/Panel/Indicators" | 21 | import "../../../../qml/Panel/Indicators" |
2487 | 22 | 22 | ||
2488 | 23 | Item { | 23 | Item { |
2489 | @@ -25,18 +25,14 @@ | |||
2490 | 25 | width: units.gu(40) | 25 | width: units.gu(40) |
2491 | 26 | height: units.gu(70) | 26 | height: units.gu(70) |
2492 | 27 | 27 | ||
2494 | 28 | DefaultIndicatorPage { | 28 | DefaultIndicatorPage { |
2495 | 29 | id: page | 29 | id: page |
2496 | 30 | |||
2497 | 31 | anchors.fill: parent | 30 | anchors.fill: parent |
2498 | 32 | 31 | ||
2499 | 33 | menuModel: UnityMenuModel {} | ||
2500 | 34 | busName: "test" | ||
2501 | 35 | actionsObjectPath: "test" | ||
2502 | 36 | menuObjectPath: "test" | ||
2503 | 37 | |||
2504 | 38 | identifier: "test-indicator" | 32 | identifier: "test-indicator" |
2506 | 39 | rootMenuType: "com.canonical.indicator.root" | 33 | busName: "com.caninical.indicator.test" |
2507 | 34 | actionsObjectPath: "/com/canonical/indicator/test" | ||
2508 | 35 | menuObjectPath: "/com/canonical/indicator/test" | ||
2509 | 40 | } | 36 | } |
2510 | 41 | 37 | ||
2511 | 42 | property var fullMenuData: [{ | 38 | property var fullMenuData: [{ |
2512 | @@ -113,29 +109,30 @@ | |||
2513 | 113 | "submenu": [] | 109 | "submenu": [] |
2514 | 114 | }]; // end row 1 | 110 | }]; // end row 1 |
2515 | 115 | 111 | ||
2516 | 112 | function initializeMenuData(data) { | ||
2517 | 113 | Indicators.UnityMenuModelCache.setCachedModelData("com.canonical.indicator.test", | ||
2518 | 114 | "/com/canonical/indicator/test", | ||
2519 | 115 | "/com/canonical/indicator/test", | ||
2520 | 116 | data); | ||
2521 | 117 | } | ||
2522 | 118 | |||
2523 | 116 | UT.UnityTestCase { | 119 | UT.UnityTestCase { |
2524 | 117 | name: "DefaultIndicatorPage" | 120 | name: "DefaultIndicatorPage" |
2525 | 118 | 121 | ||
2526 | 119 | function init() { | 122 | function init() { |
2530 | 120 | var mainMenu = findChild(page, "mainMenu"); | 123 | initializeMenuData([]); |
2528 | 121 | page.menuModel.modelData = []; | ||
2529 | 122 | verify(mainMenu.model !== null); | ||
2531 | 123 | } | 124 | } |
2532 | 124 | 125 | ||
2533 | 125 | function test_reloadData() { | 126 | function test_reloadData() { |
2534 | 126 | var mainMenu = findChild(page, "mainMenu"); | 127 | var mainMenu = findChild(page, "mainMenu"); |
2535 | 127 | 128 | ||
2547 | 128 | page.menuModel.modelData = []; | 129 | tryCompare(mainMenu, "count", 0); |
2548 | 129 | tryCompare(mainMenu, "count", 0); | 130 | |
2549 | 130 | 131 | initializeMenuData(fullMenuData); | |
2550 | 131 | page.menuModel.modelData = fullMenuData; | 132 | tryCompare(mainMenu, "count", 3); |
2551 | 132 | tryCompare(mainMenu, "count", 3); | 133 | |
2552 | 133 | 134 | initializeMenuData([]); | |
2553 | 134 | page.menuModel.modelData = []; | 135 | tryCompare(mainMenu, "count", 0); |
2543 | 135 | tryCompare(mainMenu, "count", 0); | ||
2544 | 136 | |||
2545 | 137 | page.menuModel.modelData = fullMenuData; | ||
2546 | 138 | tryCompare(mainMenu, "count", 3); | ||
2554 | 139 | } | 136 | } |
2555 | 140 | 137 | ||
2556 | 141 | function test_traverse_rootMenuType_data() { | 138 | function test_traverse_rootMenuType_data() { |
2557 | @@ -147,7 +144,7 @@ | |||
2558 | 147 | 144 | ||
2559 | 148 | function test_traverse_rootMenuType(data) { | 145 | function test_traverse_rootMenuType(data) { |
2560 | 149 | page.rootMenuType = data.rootMenuType; | 146 | page.rootMenuType = data.rootMenuType; |
2562 | 150 | page.menuModel.modelData = fullMenuData; | 147 | initializeMenuData(fullMenuData); |
2563 | 151 | 148 | ||
2564 | 152 | var mainMenu = findChild(page, "mainMenu"); | 149 | var mainMenu = findChild(page, "mainMenu"); |
2565 | 153 | tryCompare(mainMenu, "count", data.expectedCount); | 150 | tryCompare(mainMenu, "count", data.expectedCount); |
2566 | 154 | 151 | ||
2567 | === modified file 'tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml' | |||
2568 | --- tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-07-03 13:46:51 +0000 | |||
2569 | +++ tests/qmltests/Panel/Indicators/tst_DefaultIndicatorWidget.qml 2014-10-15 19:48:28 +0000 | |||
2570 | @@ -33,7 +33,6 @@ | |||
2571 | 33 | top: parent.top | 33 | top: parent.top |
2572 | 34 | } | 34 | } |
2573 | 35 | 35 | ||
2574 | 36 | menuModel: UnityMenuModel {} | ||
2575 | 37 | busName: "test" | 36 | busName: "test" |
2576 | 38 | actionsObjectPath: "test" | 37 | actionsObjectPath: "test" |
2577 | 39 | deviceMenuObjectPath: "test" | 38 | deviceMenuObjectPath: "test" |
2578 | @@ -48,13 +47,6 @@ | |||
2579 | 48 | name: "DefaultIndicatorWidget" | 47 | name: "DefaultIndicatorWidget" |
2580 | 49 | when: windowShown | 48 | when: windowShown |
2581 | 50 | 49 | ||
2582 | 51 | function init() { | ||
2583 | 52 | widget.rootActionState.icons = []; | ||
2584 | 53 | widget.rootActionState.leftLabel = ""; | ||
2585 | 54 | widget.rootActionState.rightLabel = ""; | ||
2586 | 55 | waitForRendering(widget) | ||
2587 | 56 | } | ||
2588 | 57 | |||
2589 | 58 | // FIXME: add tests | 50 | // FIXME: add tests |
2590 | 59 | } | 51 | } |
2591 | 60 | } | 52 | } |
2592 | 61 | 53 | ||
2593 | === modified file 'tests/qmltests/Panel/tst_IndicatorItem.qml' | |||
2594 | --- tests/qmltests/Panel/tst_IndicatorItem.qml 2014-01-07 14:29:23 +0000 | |||
2595 | +++ tests/qmltests/Panel/tst_IndicatorItem.qml 2014-10-15 19:48:28 +0000 | |||
2596 | @@ -43,7 +43,7 @@ | |||
2597 | 43 | 43 | ||
2598 | 44 | function test_empty() { | 44 | function test_empty() { |
2599 | 45 | compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible."); | 45 | compare(indicatorItem.indicatorVisible, false, "IndicatorItem should not be visible."); |
2601 | 46 | indicatorItem.widgetSource = "qrc:/tests/indciators/qml/fake_menu_widget1.qml"; | 46 | indicatorItem.widgetSource = "../../../qml/Panel/Indicators/DefaultIndicatorWidget.qml"; |
2602 | 47 | tryCompare(indicatorItem, "indicatorVisible", true); | 47 | tryCompare(indicatorItem, "indicatorVisible", true); |
2603 | 48 | } | 48 | } |
2604 | 49 | } | 49 | } |
2605 | 50 | 50 | ||
2606 | === modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml' | |||
2607 | --- tests/qmltests/Panel/tst_IndicatorRow.qml 2014-03-03 11:55:00 +0000 | |||
2608 | +++ tests/qmltests/Panel/tst_IndicatorRow.qml 2014-10-15 19:48:28 +0000 | |||
2609 | @@ -30,15 +30,6 @@ | |||
2610 | 30 | width: units.gu(40) | 30 | width: units.gu(40) |
2611 | 31 | height: units.gu(60) | 31 | height: units.gu(60) |
2612 | 32 | 32 | ||
2613 | 33 | function init_test() | ||
2614 | 34 | { | ||
2615 | 35 | indicatorModel.load("test1"); | ||
2616 | 36 | |||
2617 | 37 | indicatorRow.state = "initial"; | ||
2618 | 38 | indicatorRow.setCurrentItemIndex(-1); | ||
2619 | 39 | indicatorRow.unitProgress = 0.0; | ||
2620 | 40 | } | ||
2621 | 41 | |||
2622 | 42 | PanelBackground { | 33 | PanelBackground { |
2623 | 43 | anchors.fill: indicatorRow | 34 | anchors.fill: indicatorRow |
2624 | 44 | } | 35 | } |
2625 | @@ -63,20 +54,33 @@ | |||
2626 | 63 | name: "IndicatorRow" | 54 | name: "IndicatorRow" |
2627 | 64 | when: windowShown | 55 | when: windowShown |
2628 | 65 | 56 | ||
2629 | 57 | function init() { | ||
2630 | 58 | indicatorModel.load("test1"); | ||
2631 | 59 | |||
2632 | 60 | indicatorRow.state = "initial"; | ||
2633 | 61 | indicatorRow.setCurrentItemIndex(-1); | ||
2634 | 62 | indicatorRow.unitProgress = 0.0; | ||
2635 | 63 | } | ||
2636 | 64 | |||
2637 | 66 | function get_indicator_item(index) { | 65 | function get_indicator_item(index) { |
2638 | 67 | return findChild(indicatorRow.row, "item" + index); | 66 | return findChild(indicatorRow.row, "item" + index); |
2639 | 68 | } | 67 | } |
2640 | 69 | 68 | ||
2641 | 70 | function test_set_current_item() { | 69 | function test_set_current_item() { |
2642 | 71 | init_test(); | ||
2643 | 72 | indicatorRow.setCurrentItemIndex(0); | 70 | indicatorRow.setCurrentItemIndex(0); |
2645 | 73 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake1", "Incorrect item at position 0"); | 71 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
2646 | 72 | "indicator-fake1", | ||
2647 | 73 | "Incorrect item at position 0"); | ||
2648 | 74 | 74 | ||
2649 | 75 | indicatorRow.setCurrentItemIndex(1); | 75 | indicatorRow.setCurrentItemIndex(1); |
2651 | 76 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake2", "Incorrect item at position 1"); | 76 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
2652 | 77 | "indicator-fake2", | ||
2653 | 78 | "Incorrect item at position 1"); | ||
2654 | 77 | 79 | ||
2655 | 78 | indicatorRow.setCurrentItemIndex(2); | 80 | indicatorRow.setCurrentItemIndex(2); |
2657 | 79 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), "indicator-fake3", "Incorrect item at position 2"); | 81 | compare(indicatorRow.indicatorsModel.data(indicatorRow.currentItemIndex, Indicators.IndicatorsModelRole.Identifier), |
2658 | 82 | "indicator-fake3", | ||
2659 | 83 | "Incorrect item at position 2"); | ||
2660 | 80 | } | 84 | } |
2661 | 81 | 85 | ||
2662 | 82 | function test_highlight_data() { | 86 | function test_highlight_data() { |
2663 | @@ -93,8 +97,6 @@ | |||
2664 | 93 | } | 97 | } |
2665 | 94 | 98 | ||
2666 | 95 | function test_highlight(data) { | 99 | function test_highlight(data) { |
2667 | 96 | init_test(); | ||
2668 | 97 | |||
2669 | 98 | indicatorRow.unitProgress = data.progress; | 100 | indicatorRow.unitProgress = data.progress; |
2670 | 99 | indicatorRow.setCurrentItemIndex(data.index); | 101 | indicatorRow.setCurrentItemIndex(data.index); |
2671 | 100 | 102 | ||
2672 | @@ -119,8 +121,6 @@ | |||
2673 | 119 | } | 121 | } |
2674 | 120 | 122 | ||
2675 | 121 | function test_opacity(data) { | 123 | function test_opacity(data) { |
2676 | 122 | init_test(); | ||
2677 | 123 | |||
2678 | 124 | indicatorRow.unitProgress = data.progress; | 124 | indicatorRow.unitProgress = data.progress; |
2679 | 125 | indicatorRow.setCurrentItemIndex(data.index); | 125 | indicatorRow.setCurrentItemIndex(data.index); |
2680 | 126 | 126 | ||
2681 | @@ -145,8 +145,6 @@ | |||
2682 | 145 | } | 145 | } |
2683 | 146 | 146 | ||
2684 | 147 | function test_dimmed(data) { | 147 | function test_dimmed(data) { |
2685 | 148 | init_test(); | ||
2686 | 149 | |||
2687 | 150 | indicatorRow.unitProgress = data.progress; | 148 | indicatorRow.unitProgress = data.progress; |
2688 | 151 | indicatorRow.setCurrentItemIndex(data.index); | 149 | indicatorRow.setCurrentItemIndex(data.index); |
2689 | 152 | 150 | ||
2690 | 153 | 151 | ||
2691 | === modified file 'tests/qmltests/Panel/tst_Indicators.qml' | |||
2692 | --- tests/qmltests/Panel/tst_Indicators.qml 2014-07-30 16:01:09 +0000 | |||
2693 | +++ tests/qmltests/Panel/tst_Indicators.qml 2014-10-15 19:48:28 +0000 | |||
2694 | @@ -158,6 +158,7 @@ | |||
2695 | 158 | function init_invisible_indicator(identifier) { | 158 | function init_invisible_indicator(identifier) { |
2696 | 159 | tryCompareFunction(function() { return findChild(indicators, identifier+"-delegate") !== undefined }, true); | 159 | tryCompareFunction(function() { return findChild(indicators, identifier+"-delegate") !== undefined }, true); |
2697 | 160 | var item = findChild(indicators, identifier+"-delegate"); | 160 | var item = findChild(indicators, identifier+"-delegate"); |
2698 | 161 | verify(item !== null); | ||
2699 | 161 | 162 | ||
2700 | 162 | item.enabled = false; | 163 | item.enabled = false; |
2701 | 163 | } | 164 | } |
2702 | 164 | 165 | ||
2703 | === modified file 'tests/qmltests/Panel/tst_MenuContent.qml' | |||
2704 | --- tests/qmltests/Panel/tst_MenuContent.qml 2014-09-09 15:10:52 +0000 | |||
2705 | +++ tests/qmltests/Panel/tst_MenuContent.qml 2014-10-15 19:48:28 +0000 | |||
2706 | @@ -26,14 +26,6 @@ | |||
2707 | 26 | width: units.gu(40) | 26 | width: units.gu(40) |
2708 | 27 | height: units.gu(70) | 27 | height: units.gu(70) |
2709 | 28 | 28 | ||
2710 | 29 | property var indicator_status: { | ||
2711 | 30 | 'indicator-fake1-page': { 'started': false, 'reset': 0 }, | ||
2712 | 31 | 'indicator-fake2-page': { 'started': false, 'reset': 0 }, | ||
2713 | 32 | 'indicator-fake3-page': { 'started': false, 'reset': 0 }, | ||
2714 | 33 | 'indicator-fake4-page': { 'started': false, 'reset': 0 }, | ||
2715 | 34 | 'indicator-fake5-page': { 'started': false, 'reset': 0 } | ||
2716 | 35 | } | ||
2717 | 36 | |||
2718 | 37 | // Dummy objects | 29 | // Dummy objects |
2719 | 38 | Item { id: greeter } | 30 | Item { id: greeter } |
2720 | 39 | Item { id: handle } | 31 | Item { id: handle } |
2721 | 40 | 32 | ||
2722 | === modified file 'tests/qmltests/tst_Shell.qml' | |||
2723 | --- tests/qmltests/tst_Shell.qml 2014-10-13 15:42:40 +0000 | |||
2724 | +++ tests/qmltests/tst_Shell.qml 2014-10-15 19:48:28 +0000 | |||
2725 | @@ -25,14 +25,16 @@ | |||
2726 | 25 | import Ubuntu.Telephony 0.1 as Telephony | 25 | import Ubuntu.Telephony 0.1 as Telephony |
2727 | 26 | import Unity.Application 0.1 | 26 | import Unity.Application 0.1 |
2728 | 27 | import Unity.Connectivity 0.1 | 27 | import Unity.Connectivity 0.1 |
2729 | 28 | import Unity.Notifications 1.0 | ||
2730 | 28 | import Unity.Test 0.1 as UT | 29 | import Unity.Test 0.1 as UT |
2731 | 29 | import Powerd 0.1 | 30 | import Powerd 0.1 |
2732 | 30 | 31 | ||
2733 | 31 | import "../../qml" | 32 | import "../../qml" |
2734 | 32 | 33 | ||
2736 | 33 | Row { | 34 | Item { |
2737 | 34 | id: root | 35 | id: root |
2739 | 35 | spacing: 0 | 36 | width: units.gu(60) |
2740 | 37 | height: units.gu(71) | ||
2741 | 36 | 38 | ||
2742 | 37 | QtObject { | 39 | QtObject { |
2743 | 38 | id: applicationArguments | 40 | id: applicationArguments |
2744 | @@ -50,47 +52,43 @@ | |||
2745 | 50 | } | 52 | } |
2746 | 51 | } | 53 | } |
2747 | 52 | 54 | ||
2765 | 53 | Loader { | 55 | Row { |
2766 | 54 | id: shellLoader | 56 | anchors.fill: parent |
2767 | 55 | 57 | Loader { | |
2768 | 56 | // Copied from Shell.qml | 58 | id: shellLoader |
2769 | 57 | property bool tablet: false | 59 | |
2770 | 58 | width: tablet ? units.gu(160) | 60 | property bool itemDestroyed: false |
2771 | 59 | : applicationArguments.hasGeometry() ? applicationArguments.width() | 61 | sourceComponent: Component { |
2772 | 60 | : units.gu(40) | 62 | property string indicatorProfile: "phone" |
2773 | 61 | height: tablet ? units.gu(100) | 63 | |
2774 | 62 | : applicationArguments.hasGeometry() ? applicationArguments.height() | 64 | Shell { |
2775 | 63 | : units.gu(71) | 65 | Component.onDestruction: { |
2776 | 64 | 66 | shellLoader.itemDestroyed = true; | |
2777 | 65 | property bool itemDestroyed: false | 67 | } |
2761 | 66 | sourceComponent: Component { | ||
2762 | 67 | Shell { | ||
2763 | 68 | Component.onDestruction: { | ||
2764 | 69 | shellLoader.itemDestroyed = true; | ||
2778 | 70 | } | 68 | } |
2779 | 71 | } | 69 | } |
2780 | 72 | } | 70 | } |
2802 | 73 | } | 71 | |
2803 | 74 | 72 | Rectangle { | |
2804 | 75 | Rectangle { | 73 | color: "white" |
2805 | 76 | color: "white" | 74 | width: units.gu(30) |
2806 | 77 | width: units.gu(30) | 75 | height: shellLoader.height |
2807 | 78 | height: shellLoader.height | 76 | |
2808 | 79 | 77 | Column { | |
2809 | 80 | Column { | 78 | anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) } |
2810 | 81 | anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) } | 79 | spacing: units.gu(1) |
2811 | 82 | spacing: units.gu(1) | 80 | Row { |
2812 | 83 | Row { | 81 | anchors { left: parent.left; right: parent.right } |
2813 | 84 | anchors { left: parent.left; right: parent.right } | 82 | Button { |
2814 | 85 | Button { | 83 | text: "Show Greeter" |
2815 | 86 | text: "Show Greeter" | 84 | onClicked: { |
2816 | 87 | onClicked: { | 85 | if (shellLoader.status !== Loader.Ready) |
2817 | 88 | if (shellLoader.status !== Loader.Ready) | 86 | return; |
2818 | 89 | return; | 87 | |
2819 | 90 | 88 | var greeter = testCase.findChild(shellLoader.item, "greeter"); | |
2820 | 91 | var greeter = testCase.findChild(shellLoader.item, "greeter"); | 89 | if (!greeter.shown) { |
2821 | 92 | if (!greeter.shown) { | 90 | greeter.show(); |
2822 | 93 | greeter.show(); | 91 | } |
2823 | 94 | } | 92 | } |
2824 | 95 | } | 93 | } |
2825 | 96 | } | 94 | } |
2826 | @@ -98,6 +96,31 @@ | |||
2827 | 98 | } | 96 | } |
2828 | 99 | } | 97 | } |
2829 | 100 | 98 | ||
2830 | 99 | Component { | ||
2831 | 100 | id: mockNotification | ||
2832 | 101 | |||
2833 | 102 | QtObject { | ||
2834 | 103 | function invokeAction(actionId) { | ||
2835 | 104 | mockNotificationsModel.actionInvoked(actionId) | ||
2836 | 105 | } | ||
2837 | 106 | } | ||
2838 | 107 | } | ||
2839 | 108 | ListModel { | ||
2840 | 109 | id: mockNotificationsModel | ||
2841 | 110 | |||
2842 | 111 | signal actionInvoked(string actionId) | ||
2843 | 112 | |||
2844 | 113 | function getRaw(id) { | ||
2845 | 114 | return mockNotification.createObject(mockNotificationsModel) | ||
2846 | 115 | } | ||
2847 | 116 | |||
2848 | 117 | onActionInvoked: { | ||
2849 | 118 | if(actionId == "ok_id") { | ||
2850 | 119 | mockNotificationsModel.clear() | ||
2851 | 120 | } | ||
2852 | 121 | } | ||
2853 | 122 | } | ||
2854 | 123 | |||
2855 | 101 | SignalSpy { | 124 | SignalSpy { |
2856 | 102 | id: launcherShowDashHomeSpy | 125 | id: launcherShowDashHomeSpy |
2857 | 103 | signalName: "showDashHome" | 126 | signalName: "showDashHome" |
2858 | @@ -119,6 +142,12 @@ | |||
2859 | 119 | signalName: "unlockingAllModems" | 142 | signalName: "unlockingAllModems" |
2860 | 120 | } | 143 | } |
2861 | 121 | 144 | ||
2862 | 145 | SignalSpy { | ||
2863 | 146 | id: notificationActionSpy | ||
2864 | 147 | target: mockNotificationsModel | ||
2865 | 148 | signalName: "actionInvoked" | ||
2866 | 149 | } | ||
2867 | 150 | |||
2868 | 122 | Telephony.CallEntry { | 151 | Telephony.CallEntry { |
2869 | 123 | id: phoneCall | 152 | id: phoneCall |
2870 | 124 | phoneNumber: "+447812221111" | 153 | phoneNumber: "+447812221111" |
2871 | @@ -178,6 +207,65 @@ | |||
2872 | 178 | compare(ApplicationManager.count, 1) | 207 | compare(ApplicationManager.count, 1) |
2873 | 179 | } | 208 | } |
2874 | 180 | 209 | ||
2875 | 210 | function test_snapDecisionDismissalReturnsFocus() { | ||
2876 | 211 | var notifications = findChild(shell, "notificationList"); | ||
2877 | 212 | var app = ApplicationManager.startApplication("camera-app"); | ||
2878 | 213 | var stage = findChild(shell, "stage") | ||
2879 | 214 | // Open an application and focus | ||
2880 | 215 | waitUntilApplicationWindowIsFullyVisible(app); | ||
2881 | 216 | ApplicationManager.focusApplication(app); | ||
2882 | 217 | tryCompare(app.session.surface, "activeFocus", true); | ||
2883 | 218 | |||
2884 | 219 | notifications.model = mockNotificationsModel; | ||
2885 | 220 | |||
2886 | 221 | // FIXME: Hack: SortFilterProxyModelQML doesn't work with QML ListModels which we use | ||
2887 | 222 | // for mocking here (RoleType can't be found in the QML model). As we only need to show | ||
2888 | 223 | // one SnapDecision lets just disable the filtering and make appear any notification as a | ||
2889 | 224 | // SnapDecision. | ||
2890 | 225 | var snapDecisionProxyModel = findInvisibleChild(shell, "snapDecisionProxyModel"); | ||
2891 | 226 | snapDecisionProxyModel.filterRegExp = RegExp(""); | ||
2892 | 227 | |||
2893 | 228 | // Pop-up a notification | ||
2894 | 229 | addSnapDecisionNotification(); | ||
2895 | 230 | waitForRendering(shell); | ||
2896 | 231 | |||
2897 | 232 | // Make sure the notification really opened | ||
2898 | 233 | var notification = findChild(notifications, "notification" + (mockNotificationsModel.count - 1)); | ||
2899 | 234 | verify(notification !== undefined && notification != null, "notification wasn't found"); | ||
2900 | 235 | tryCompare(notification, "height", notification.implicitHeight) | ||
2901 | 236 | waitForRendering(notification); | ||
2902 | 237 | |||
2903 | 238 | // Make sure activeFocus went away from the app window | ||
2904 | 239 | tryCompare(app.session.surface, "activeFocus", false); | ||
2905 | 240 | tryCompare(stage, "interactive", false); | ||
2906 | 241 | |||
2907 | 242 | // Clicking the button should dismiss the notification and return focus | ||
2908 | 243 | var buttonAccept = findChild(notification, "notify_button0"); | ||
2909 | 244 | mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); | ||
2910 | 245 | |||
2911 | 246 | // Make sure we're back to normal | ||
2912 | 247 | tryCompare(app.session.surface, "activeFocus", true); | ||
2913 | 248 | compare(stage.interactive, true, "Stages not interactive again after modal notification has closed"); | ||
2914 | 249 | } | ||
2915 | 250 | |||
2916 | 251 | function addSnapDecisionNotification() { | ||
2917 | 252 | var n = { | ||
2918 | 253 | type: Notification.SnapDecision, | ||
2919 | 254 | hints: {"x-canonical-private-affirmative-tint": "true"}, | ||
2920 | 255 | summary: "Tom Ato", | ||
2921 | 256 | body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.", | ||
2922 | 257 | icon: "../graphics/avatars/funky.png", | ||
2923 | 258 | secondaryIcon: "../graphics/applicationIcons/facebook.png", | ||
2924 | 259 | actions: [{ id: "ok_id", label: "Ok"}, | ||
2925 | 260 | { id: "cancel_id", label: "Cancel"}, | ||
2926 | 261 | { id: "notreally_id", label: "Not really"}, | ||
2927 | 262 | { id: "noway_id", label: "messages:No way"}, | ||
2928 | 263 | { id: "nada_id", label: "messages:Nada"}] | ||
2929 | 264 | } | ||
2930 | 265 | |||
2931 | 266 | mockNotificationsModel.append(n) | ||
2932 | 267 | } | ||
2933 | 268 | |||
2934 | 181 | function test_leftEdgeDrag_data() { | 269 | function test_leftEdgeDrag_data() { |
2935 | 182 | return [ | 270 | return [ |
2936 | 183 | {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true}, | 271 | {tag: "without launcher", revealLauncher: false, swipeLength: units.gu(27), appHides: true, focusedApp: "dialer-app", launcherHides: true}, |
2937 | 184 | 272 | ||
2938 | === modified file 'tests/qmltests/tst_ShellWithPin.qml' | |||
2939 | --- tests/qmltests/tst_ShellWithPin.qml 2014-10-13 15:42:15 +0000 | |||
2940 | +++ tests/qmltests/tst_ShellWithPin.qml 2014-10-15 19:48:28 +0000 | |||
2941 | @@ -61,6 +61,8 @@ | |||
2942 | 61 | property bool itemDestroyed: false | 61 | property bool itemDestroyed: false |
2943 | 62 | sourceComponent: Component { | 62 | sourceComponent: Component { |
2944 | 63 | Shell { | 63 | Shell { |
2945 | 64 | property string indicatorProfile: "phone" | ||
2946 | 65 | |||
2947 | 64 | Component.onDestruction: { | 66 | Component.onDestruction: { |
2948 | 65 | shellLoader.itemDestroyed = true | 67 | shellLoader.itemDestroyed = true |
2949 | 66 | } | 68 | } |
2950 | 67 | 69 | ||
2951 | === modified file 'tests/qmltests/tst_TabletShell.qml' | |||
2952 | --- tests/qmltests/tst_TabletShell.qml 2014-10-09 13:05:21 +0000 | |||
2953 | +++ tests/qmltests/tst_TabletShell.qml 2014-10-15 19:48:28 +0000 | |||
2954 | @@ -57,6 +57,8 @@ | |||
2955 | 57 | property bool itemDestroyed: false | 57 | property bool itemDestroyed: false |
2956 | 58 | sourceComponent: Component { | 58 | sourceComponent: Component { |
2957 | 59 | Shell { | 59 | Shell { |
2958 | 60 | property string indicatorProfile: "phone" | ||
2959 | 61 | |||
2960 | 60 | Component.onDestruction: { | 62 | Component.onDestruction: { |
2961 | 61 | shellLoader.itemDestroyed = true | 63 | shellLoader.itemDestroyed = true |
2962 | 62 | } | 64 | } |
This should be covered by ApplicationWind ow/test_ forceActiveFocu sFollowsInterac tive