Merge lp:~townsend/unity/fix-lp1168019 into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Christopher Townsend
Approved revision: 3481
Merged at revision: 3478
Proposed branch: lp:~townsend/unity/fix-lp1168019
Merge into: lp:unity
Diff against target: 101 lines (+36/-1)
4 files modified
dash/DashView.cpp (+9/-0)
tests/CMakeLists.txt (+2/-0)
tests/data/unity/scopes/commands.scope (+8/-0)
tests/test_dashview.cpp (+17/-1)
To merge this branch: bzr merge lp:~townsend/unity/fix-lp1168019
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+182189@code.launchpad.net

Commit message

Do not display the scope bar at the bottom when the Command "Lens" is opened as it's not really not a Lens/Scope.

Description of the change

= Issue =
The Command "Lens" is not really a lens and as such, the scope bar at the bottom should not be visible when the Command "Lens" is opened.

= Fix =
Add logic to detect when the command lens is opened and if so, set the scope bar to invisible.

= Test =
Add unit test to ensure that the scope bar is indeed invisible when the command lens is active.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~townsend/unity/fix-lp1168019 updated
3480. By Christopher Townsend on 2013-08-27

Add a dummy Commands scope since Jenkins does not have a commands.scope already installed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~townsend/unity/fix-lp1168019 updated
3481. By Christopher Townsend on 2013-08-27

Update tests/CMakeLists.txt to include the new mock commands.scope.
Add back in the testscope4.scope and update the test to check for 5 scopes.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Finally figured out what was causing the Jenkins failures. I believe the amd64 ci failure last posted by jenkins is not caused by my MP. Globally approving this.

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2013-07-18 20:04:23 +0000
3+++ dash/DashView.cpp 2013-08-27 15:51:23 +0000
4@@ -1262,6 +1262,15 @@
5 return;
6 }
7
8+ if (IsCommandLensOpen() && scope_bar_->IsVisible())
9+ {
10+ scope_bar_->SetVisible(false);
11+ }
12+ else if (!scope_bar_->IsVisible())
13+ {
14+ scope_bar_->SetVisible(true);
15+ }
16+
17 if (active_scope_view_.IsValid())
18 active_scope_view_->SetVisible(false);
19
20
21=== modified file 'tests/CMakeLists.txt'
22--- tests/CMakeLists.txt 2013-08-01 05:01:01 +0000
23+++ tests/CMakeLists.txt 2013-08-27 15:51:23 +0000
24@@ -24,6 +24,8 @@
25 ${CMAKE_BINARY_DIR}/tests/data/unity/scopes/testscope3.scope)
26 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/unity/scopes/testscope4.scope
27 ${CMAKE_BINARY_DIR}/tests/data/unity/scopes/testscope4.scope)
28+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/unity/scopes/commands.scope
29+ ${CMAKE_BINARY_DIR}/tests/data/unity/scopes/commands.scope)
30 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/unity/sounds/brownnoise.mp3
31 ${CMAKE_BINARY_DIR}/tests/data/unity/sounds/brownnoise.mp3 COPYONLY)
32 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/data/unity/sounds/pinknoise.mp3
33
34=== added file 'tests/data/unity/scopes/commands.scope'
35--- tests/data/unity/scopes/commands.scope 1970-01-01 00:00:00 +0000
36+++ tests/data/unity/scopes/commands.scope 2013-08-27 15:51:23 +0000
37@@ -0,0 +1,8 @@
38+[Scope]
39+DBusName=com.canonical.Unity.Test.Scope
40+DBusPath=/com/canonical/unity/scope/commands
41+Icon=
42+Type=commands
43+Name=Commands
44+Description=This is an Ubuntu search plugin that enables information from local binaries to be searched and displayed in the Dash. If you do not wish to search this content source, you can disable this search plugin.
45+SearchHint=Run a command
46
47=== modified file 'tests/test_dashview.cpp'
48--- tests/test_dashview.cpp 2013-03-21 11:36:49 +0000
49+++ tests/test_dashview.cpp 2013-08-27 15:51:23 +0000
50@@ -28,6 +28,7 @@
51 #include <NuxCore/ObjectPtr.h>
52
53 #include "dash/DashView.h"
54+#include "dash/ScopeBar.h"
55 #include "dash/ApplicationStarter.h"
56 #include "unity-shared/DashStyle.h"
57 #include "unity-shared/PanelStyle.h"
58@@ -51,6 +52,7 @@
59 "testscope2.scope",
60 "testscope3.scope",
61 "testscope4.scope",
62+ "commands.scope",
63 NULL };
64
65 }
66@@ -79,6 +81,7 @@
67 }
68
69 using DashView::scope_views_;
70+ using DashView::scope_bar_;
71 };
72
73 protected:
74@@ -93,7 +96,7 @@
75 Scopes::Ptr scopes(new MockGSettingsScopes(scopes_default));
76 nux::ObjectPtr<MockDashView> view(new MockDashView(scopes, application_starter_));
77
78- EXPECT_EQ(view->scope_views_.size(), 4) << "Error: Incorrect number of scope views (" << view->scope_views_.size() << " != 4)";
79+ EXPECT_EQ(view->scope_views_.size(), 5) << "Error: Incorrect number of scope views (" << view->scope_views_.size() << " != 5)";
80 }
81
82
83@@ -112,5 +115,18 @@
84 scopes->GetScopeAtIndex(0)->activated.emit(result, NOT_HANDLED, glib::HintsMap());
85 }
86
87+TEST_F(TestDashView, TestScopeBarIsInvisibleWithCommandScope)
88+{
89+ ScopeBar scope_bar;
90+ Scopes::Ptr scopes(new MockGSettingsScopes(scopes_default));
91+ nux::ObjectPtr<MockDashView> view(new MockDashView(scopes, application_starter_));
92+
93+ ASSERT_TRUE(view->scope_bar_->IsVisible());
94+
95+ view->scope_bar_->Activate("commands.scope");
96+
97+ EXPECT_FALSE(view->scope_bar_->IsVisible());
98+}
99+
100 }
101 }