on xenial help sign in
Fixed an error, added a test, and used long left edge swipe instead of a short one to back to apps scope and reset the search
4b51b2chandsome_feng
plugins/Unity/DashCommunicator/DashCommunicator.qmltypes+6
@@ -18,6 +18,9 @@ Module {
18 Parameter { name: "animate"; type: "bool" }
18 Parameter { name: "animate"; type: "bool" }
19 Parameter { name: "isSwipe"; type: "bool" }
19 Parameter { name: "isSwipe"; type: "bool" }
20 }
20 }
21+ Method {
22+ name: "resetAll"
23+ }
21 }
24 }
22 Component {
25 Component {
23 name: "DashCommunicatorService"
26 name: "DashCommunicatorService"
@@ -30,6 +33,9 @@ Module {
30 Parameter { name: "animate"; type: "bool" }
33 Parameter { name: "animate"; type: "bool" }
31 Parameter { name: "isSwipe"; type: "bool" }
34 Parameter { name: "isSwipe"; type: "bool" }
32 }
35 }
36+ Signal {
37+ name: "resetAllRequested"
38+ }
33 }
39 }
34 Component {
40 Component {
35 name: "QThread"
41 name: "QThread"
qml/Shell.qml+3−6
@@ -444,10 +444,13 @@ Item {
444
444
445 var animate = !LightDM.Greeter.active && !stages.shown
445 var animate = !LightDM.Greeter.active && !stages.shown
446 dash.setCurrentScope(0, animate, false)
446 dash.setCurrentScope(0, animate, false)
447+ dash.resetAll()
447 ApplicationManager.requestFocusApplication("unity8-dash")
448 ApplicationManager.requestFocusApplication("unity8-dash")
448 }
449 }
449
450
450 function showDash() {
451 function showDash() {
452+ dash.setCurrentScope(0, false, true);
453+ dash.resetAll();
451 if (greeter.notifyShowingDashFromDrag()) {
454 if (greeter.notifyShowingDashFromDrag()) {
452 launcher.fadeOut();
455 launcher.fadeOut();
453 }
456 }
@@ -516,12 +519,6 @@ Item {
516
519
517 onShowDashHome: showHome()
520 onShowDashHome: showHome()
518 onDash: showDash()
521 onDash: showDash()
519− onDashSwipeChanged: {
520− if (dashSwipe) {
521− dash.setCurrentScope(0, false, true)
522− dash.resetAll()
523− }
524− }
525 onLauncherApplicationSelected: {
522 onLauncherApplicationSelected: {
526 if (!tutorial.running) {
523 if (!tutorial.running) {
527 greeter.notifyAboutToFocusApp(appId);
524 greeter.notifyAboutToFocusApp(appId);
tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes+12
@@ -18,12 +18,18 @@ Module {
18 Parameter { name: "animate"; type: "bool" }
18 Parameter { name: "animate"; type: "bool" }
19 Parameter { name: "reset"; type: "bool" }
19 Parameter { name: "reset"; type: "bool" }
20 }
20 }
21+ Signal {
22+ name: "resetAllCalled"
23+ }
21 Method {
24 Method {
22 name: "setCurrentScope"
25 name: "setCurrentScope"
23 Parameter { name: "index"; type: "int" }
26 Parameter { name: "index"; type: "int" }
24 Parameter { name: "animate"; type: "bool" }
27 Parameter { name: "animate"; type: "bool" }
25 Parameter { name: "reset"; type: "bool" }
28 Parameter { name: "reset"; type: "bool" }
26 }
29 }
30+ Method {
31+ name: "resetAll"
32+ }
27 }
33 }
28 Component {
34 Component {
29 name: "DashCommunicatorService"
35 name: "DashCommunicatorService"
@@ -36,11 +42,17 @@ Module {
36 Parameter { name: "animate"; type: "bool" }
42 Parameter { name: "animate"; type: "bool" }
37 Parameter { name: "isSwipe"; type: "bool" }
43 Parameter { name: "isSwipe"; type: "bool" }
38 }
44 }
45+ Signal {
46+ name: "resetAllRequested"
47+ }
39 Method {
48 Method {
40 name: "mockSetCurrentScope"
49 name: "mockSetCurrentScope"
41 Parameter { name: "index"; type: "int" }
50 Parameter { name: "index"; type: "int" }
42 Parameter { name: "animate"; type: "bool" }
51 Parameter { name: "animate"; type: "bool" }
43 Parameter { name: "isSwipe"; type: "bool" }
52 Parameter { name: "isSwipe"; type: "bool" }
44 }
53 }
54+ Method {
55+ name: "mockResetAll"
56+ }
45 }
57 }
46}
58}
tests/mocks/Unity/DashCommunicator/dashcommunicator.cpp+5
@@ -35,3 +35,8 @@ void DashCommunicator::setCurrentScope(int index, bool animate, bool reset)
35{
35{
36 Q_EMIT setCurrentScopeCalled(index, animate, reset);
36 Q_EMIT setCurrentScopeCalled(index, animate, reset);
37}
37}
38+
39+void DashCommunicator::resetAll()
40+{
41+ Q_EMIT resetAllCalled();
42+}
tests/mocks/Unity/DashCommunicator/dashcommunicator.h+2
@@ -30,10 +30,12 @@ public:
30
30
31public Q_SLOTS:
31public Q_SLOTS:
32 void setCurrentScope(int index, bool animate, bool reset);
32 void setCurrentScope(int index, bool animate, bool reset);
33+ void resetAll();
33
34
34Q_SIGNALS:
35Q_SIGNALS:
35 // This mock just emits calls back to the QML api for the plugin to verify calls
36 // This mock just emits calls back to the QML api for the plugin to verify calls
36 void setCurrentScopeCalled(int index, bool animate, bool reset);
37 void setCurrentScopeCalled(int index, bool animate, bool reset);
38+ void resetAllCalled();
37};
39};
38
40
39#endif
41#endif
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.cpp+5
@@ -31,3 +31,8 @@ void DashCommunicatorService::mockSetCurrentScope(int index, bool animate, bool
31{
31{
32 Q_EMIT setCurrentScopeRequested(index, animate, isSwipe);
32 Q_EMIT setCurrentScopeRequested(index, animate, isSwipe);
33}
33}
34+
35+void DashCommunicatorService::mockResetAll()
36+{
37+ Q_EMIT resetAllRequested();
38+}
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.h+2
@@ -28,9 +28,11 @@ public:
28
28
29Q_SIGNALS:
29Q_SIGNALS:
30 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
30 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
31+ void resetAllRequested();
31
32
32public Q_SLOTS:
33public Q_SLOTS:
33 void mockSetCurrentScope(int index, bool animate, bool isSwipe);
34 void mockSetCurrentScope(int index, bool animate, bool isSwipe);
35+ void mockResetAll();
34};
36};
35
37
36#endif // DBUSUNITYSESSIONSERVICE_H
38#endif // DBUSUNITYSESSIONSERVICE_H
tests/qmltests/tst_Shell.qml+36
@@ -203,6 +203,11 @@ Rectangle {
203 signalName: "setCurrentScopeCalled"
203 signalName: "setCurrentScopeCalled"
204 }
204 }
205
205
206+ SignalSpy {
207+ id: resetAllSpy
208+ signalName: "resetAllCalled"
209+ }
210+
206 SignalSpy {
211 SignalSpy {
207 id: unlockAllModemsSpy
212 id: unlockAllModemsSpy
208 target: Connectivity
213 target: Connectivity
@@ -250,6 +255,7 @@ Rectangle {
250
255
251 sessionSpy.target = findChild(shell, "greeter")
256 sessionSpy.target = findChild(shell, "greeter")
252 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
257 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
258+ resetAllSpy.target = findInvisibleChild(shell, "dashCommunicator");
253
259
254 var launcher = findChild(shell, "launcher");
260 var launcher = findChild(shell, "launcher");
255 launcherShowDashHomeSpy.target = launcher;
261 launcherShowDashHomeSpy.target = launcher;
@@ -610,6 +616,34 @@ Rectangle {
610 compare(dashCommunicatorSpy.signalArguments[0][0], 0);
616 compare(dashCommunicatorSpy.signalArguments[0][0], 0);
611 }
617 }
612
618
619+ function test_leftSwipeOrBFBCausesResetAllEmission() {
620+ loadShell("phone");
621+ swipeAwayGreeter();
622+
623+ resetAllSpy.clear();
624+
625+ //Only long left edge swipe or BFB click on the launcher causes the signal emission
626+ dragLauncherIntoView();
627+ compare(resetAllSpy.count, 0);
628+
629+ //Click the dash icon on the launcher
630+ var launcher = findChild(shell, "launcher");
631+ var dashIcon = findChild(launcher, "dashItem");
632+ verify(dashIcon != undefined);
633+ mouseClick(dashIcon);
634+
635+ compare(resetAllSpy.count, 1);
636+
637+ resetAllSpy.clear();
638+
639+ //Long left edge swipe
640+ swipeFromLeftEdge(units.gu(27));
641+
642+ compare(resetAllSpy.count, 1);
643+
644+ resetAllSpy.clear();
645+ }
646+
613 function test_showInputMethod() {
647 function test_showInputMethod() {
614 loadShell("phone");
648 loadShell("phone");
615 swipeAwayGreeter();
649 swipeAwayGreeter();
@@ -1079,6 +1113,8 @@ Rectangle {
1079 var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
1113 var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
1080 dismissTimer.interval = 60 * 60 * 1000;
1114 dismissTimer.interval = 60 * 60 * 1000;
1081
1115
1116+ launcherShowDashHomeSpy.clear();
1117+
1082 dragLauncherIntoView();
1118 dragLauncherIntoView();
1083
1119
1084 // Emulate a tap with a finger, where the touch position drifts during the tap.
1120 // Emulate a tap with a finger, where the touch position drifts during the tap.