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
commit4b51b2cb788b33149e7b30adcf8754e43fbaf667 authorhandsome_feng <445865575@qq.com> dateThu 23 Apr 2015, 11:02 (12 years ago) parent1318fcb
8 files changed+71−6
plugins/Unity/DashCommunicator/DashCommunicator.qmltypes+6 qml/Shell.qml+3−6 tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes+12 tests/mocks/Unity/DashCommunicator/dashcommunicator.cpp+5 tests/mocks/Unity/DashCommunicator/dashcommunicator.h+2 tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.cpp+5 tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.h+2 tests/qmltests/tst_Shell.qml+36
plugins/Unity/DashCommunicator/DashCommunicator.qmltypes+6
@@ -18,6 +18,9 @@ Module {
1818 Parameter { name: "animate"; type: "bool" }
1919 Parameter { name: "isSwipe"; type: "bool" }
2020 }
21+ Method {
22+ name: "resetAll"
23+ }
2124 }
2225 Component {
2326 name: "DashCommunicatorService"
@@ -30,6 +33,9 @@ Module {
3033 Parameter { name: "animate"; type: "bool" }
3134 Parameter { name: "isSwipe"; type: "bool" }
3235 }
36+ Signal {
37+ name: "resetAllRequested"
38+ }
3339 }
3440 Component {
3541 name: "QThread"
qml/Shell.qml+3−6
@@ -444,10 +444,13 @@ Item {
444444
445445 var animate = !LightDM.Greeter.active && !stages.shown
446446 dash.setCurrentScope(0, animate, false)
447+ dash.resetAll()
447448 ApplicationManager.requestFocusApplication("unity8-dash")
448449 }
449450
450451 function showDash() {
452+ dash.setCurrentScope(0, false, true);
453+ dash.resetAll();
451454 if (greeter.notifyShowingDashFromDrag()) {
452455 launcher.fadeOut();
453456 }
@@ -516,12 +519,6 @@ Item {
516519
517520 onShowDashHome: showHome()
518521 onDash: showDash()
519− onDashSwipeChanged: {
520− if (dashSwipe) {
521− dash.setCurrentScope(0, false, true)
522− dash.resetAll()
523− }
524− }
525522 onLauncherApplicationSelected: {
526523 if (!tutorial.running) {
527524 greeter.notifyAboutToFocusApp(appId);
tests/mocks/Unity/DashCommunicator/DashCommunicator.qmltypes+12
@@ -18,12 +18,18 @@ Module {
1818 Parameter { name: "animate"; type: "bool" }
1919 Parameter { name: "reset"; type: "bool" }
2020 }
21+ Signal {
22+ name: "resetAllCalled"
23+ }
2124 Method {
2225 name: "setCurrentScope"
2326 Parameter { name: "index"; type: "int" }
2427 Parameter { name: "animate"; type: "bool" }
2528 Parameter { name: "reset"; type: "bool" }
2629 }
30+ Method {
31+ name: "resetAll"
32+ }
2733 }
2834 Component {
2935 name: "DashCommunicatorService"
@@ -36,11 +42,17 @@ Module {
3642 Parameter { name: "animate"; type: "bool" }
3743 Parameter { name: "isSwipe"; type: "bool" }
3844 }
45+ Signal {
46+ name: "resetAllRequested"
47+ }
3948 Method {
4049 name: "mockSetCurrentScope"
4150 Parameter { name: "index"; type: "int" }
4251 Parameter { name: "animate"; type: "bool" }
4352 Parameter { name: "isSwipe"; type: "bool" }
4453 }
54+ Method {
55+ name: "mockResetAll"
56+ }
4557 }
4658}
tests/mocks/Unity/DashCommunicator/dashcommunicator.cpp+5
@@ -35,3 +35,8 @@ void DashCommunicator::setCurrentScope(int index, bool animate, bool reset)
3535{
3636 Q_EMIT setCurrentScopeCalled(index, animate, reset);
3737}
38+
39+void DashCommunicator::resetAll()
40+{
41+ Q_EMIT resetAllCalled();
42+}
tests/mocks/Unity/DashCommunicator/dashcommunicator.h+2
@@ -30,10 +30,12 @@ public:
3030
3131public Q_SLOTS:
3232 void setCurrentScope(int index, bool animate, bool reset);
33+ void resetAll();
3334
3435Q_SIGNALS:
3536 // This mock just emits calls back to the QML api for the plugin to verify calls
3637 void setCurrentScopeCalled(int index, bool animate, bool reset);
38+ void resetAllCalled();
3739};
3840
3941#endif
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.cpp+5
@@ -31,3 +31,8 @@ void DashCommunicatorService::mockSetCurrentScope(int index, bool animate, bool
3131{
3232 Q_EMIT setCurrentScopeRequested(index, animate, isSwipe);
3333}
34+
35+void DashCommunicatorService::mockResetAll()
36+{
37+ Q_EMIT resetAllRequested();
38+}
tests/mocks/Unity/DashCommunicator/dashcommunicatorservice.h+2
@@ -28,9 +28,11 @@ public:
2828
2929Q_SIGNALS:
3030 void setCurrentScopeRequested(int index, bool animate, bool isSwipe);
31+ void resetAllRequested();
3132
3233public Q_SLOTS:
3334 void mockSetCurrentScope(int index, bool animate, bool isSwipe);
35+ void mockResetAll();
3436};
3537
3638#endif // DBUSUNITYSESSIONSERVICE_H
tests/qmltests/tst_Shell.qml+36
@@ -203,6 +203,11 @@ Rectangle {
203203 signalName: "setCurrentScopeCalled"
204204 }
205205
206+ SignalSpy {
207+ id: resetAllSpy
208+ signalName: "resetAllCalled"
209+ }
210+
206211 SignalSpy {
207212 id: unlockAllModemsSpy
208213 target: Connectivity
@@ -250,6 +255,7 @@ Rectangle {
250255
251256 sessionSpy.target = findChild(shell, "greeter")
252257 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
258+ resetAllSpy.target = findInvisibleChild(shell, "dashCommunicator");
253259
254260 var launcher = findChild(shell, "launcher");
255261 launcherShowDashHomeSpy.target = launcher;
@@ -610,6 +616,34 @@ Rectangle {
610616 compare(dashCommunicatorSpy.signalArguments[0][0], 0);
611617 }
612618
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+
613647 function test_showInputMethod() {
614648 loadShell("phone");
615649 swipeAwayGreeter();
@@ -1079,6 +1113,8 @@ Rectangle {
10791113 var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
10801114 dismissTimer.interval = 60 * 60 * 1000;
10811115
1116+ launcherShowDashHomeSpy.clear();
1117+
10821118 dragLauncherIntoView();
10831119
10841120 // Emulate a tap with a finger, where the touch position drifts during the tap.