Merge lp:~gordallott/unity/fix-wrong-horizontal-see-more-size into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 2148
Proposed branch: lp:~gordallott/unity/fix-wrong-horizontal-see-more-size
Merge into: lp:unity
Prerequisite: lp:~gordallott/unity/fix-standalone-dash-client-build
Diff against target: 159 lines (+38/-4)
6 files modified
manual-tests/Dash.txt (+13/-0)
plugins/unityshell/src/PlacesGroup.cpp (+16/-2)
plugins/unityshell/src/PlacesGroup.h (+2/-1)
plugins/unityshell/src/ResultView.h (+2/-0)
plugins/unityshell/src/ResultViewGrid.cpp (+1/-1)
standalone-clients/CMakeLists.txt (+4/-0)
To merge this branch: bzr merge lp:~gordallott/unity/fix-wrong-horizontal-see-more-size
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Alex Launi (community) Needs Fixing
Gord Allott Pending
Review via email: mp+96161@code.launchpad.net

This proposal supersedes a proposal from 2012-03-06.

Commit message

Fixes the incorrect item count in See x more results. see lp:934944

Description of the change

Fixes the attached bug, manual test supplied has instructions to test

No automatic test until I can figure out a nice way of doing it,
Feels like we need to run the AP tests with fake lenses to control the dash content
Which is entirely out of scope for this merge

To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

15 +#. Open the dash, navigate to a lens that uses a horizontal renderer

give an example. don't expect testers to know the code base this well. Say "open the ____ lens"

Secondly. AUTOMATE THIS. This one is super easy to automate. You're just counting!

review: Needs Fixing
Revision history for this message
Alex Launi (alexlauni) wrote :

But you're right. Being able to control dash content would be an ace feature. Something that is really needed.

Revision history for this message
Gord Allott (gordallott) wrote :

> 15 +#. Open the dash, navigate to a lens that uses a horizontal renderer
>
> give an example. don't expect testers to know the code base this well. Say
> "open the ____ lens"
>
>
> Secondly. AUTOMATE THIS. This one is super easy to automate. You're just
> counting!

The issue really is that i'm not confident that i can say this lens will definately, 100% of the time, have enough content to run the test, which is why i'm saying we need to run our ap tests with fake lenses that provide what we need before I'm really confident enough to automate this

Revision history for this message
Mirco Müller (macslow) wrote :

Code look fine, but I can't verify its correct functioning with the described manual-test. With the music lens I always get one item more (in the expanded result-view) than the "see x more" + visible items (collapsed result-view).

review: Needs Fixing
Revision history for this message
Mirco Müller (macslow) wrote :

Now the number of items correctly adds up... with the filters being expanded or not. Approved.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Dash.txt'
2--- manual-tests/Dash.txt 2012-03-20 21:25:06 +0000
3+++ manual-tests/Dash.txt 2012-03-21 11:20:30 +0000
4@@ -13,3 +13,16 @@
5 The text previously selected is pasted on the search bar at mouse pointer
6 position, if the operation is repeated the text is inserted where
7 the mouse pointer is.
8+
9+
10+Dash correct number of "see more" results with horizontal renderer
11+---------------------------
12+This test ensures a correct number of "see more" results in the dash when using a horizontal renderer
13+(see lp:934944)
14+
15+#. Open the dash, navigate to a lens that uses a horizontal renderer such as the gwibber lens or music lens
16+#. Ensure that a category in the results has a "See x more results" label
17+#. Expand category that has "See x more results" label
18+
19+Outcome
20+ The category will expand to show all the results, user should ensure that the X in "See x more categories" was valid.
21
22=== modified file 'plugins/unityshell/src/PlacesGroup.cpp'
23--- plugins/unityshell/src/PlacesGroup.cpp 2012-03-13 16:19:52 +0000
24+++ plugins/unityshell/src/PlacesGroup.cpp 2012-03-21 11:20:30 +0000
25@@ -22,6 +22,7 @@
26 #include <sigc++/sigc++.h>
27
28 #include <Nux/Nux.h>
29+#include <NuxCore/Logger.h>
30 #include <Nux/VLayout.h>
31 #include <Nux/HLayout.h>
32 #include <Nux/BaseWindow.h>
33@@ -45,6 +46,12 @@
34 #include "UBusMessages.h"
35 #include "Introspectable.h"
36
37+
38+namespace
39+{
40+nux::logging::Logger logger("unity.dash.placesgroup");
41+}
42+
43 namespace unity
44 {
45 namespace
46@@ -259,13 +266,20 @@
47 }
48
49 void
50-PlacesGroup::SetChildView(nux::View* view)
51+PlacesGroup::SetChildView(dash::ResultView* view)
52 {
53 debug::Introspectable *i = dynamic_cast<debug::Introspectable*>(view);
54 if (i)
55 AddChild(i);
56 _child_view = view;
57 _group_layout->AddView(_child_view, 1);
58+
59+ view->results_per_row.changed.connect([&] (int results_per_row)
60+ {
61+ _n_visible_items_in_unexpand_mode = results_per_row;
62+ RefreshLabel();
63+ });
64+
65 QueueDraw();
66 }
67
68@@ -296,6 +310,7 @@
69 }
70 else
71 {
72+ LOG_DEBUG(logger) << _n_total_items << " - " << _n_visible_items_in_unexpand_mode;
73 result_string = g_strdup_printf(g_dngettext(GETTEXT_PACKAGE,
74 "See one more result",
75 "See %d more results",
76@@ -440,7 +455,6 @@
77 void
78 PlacesGroup::SetCounts(guint n_visible_items_in_unexpand_mode, guint n_total_items)
79 {
80- _n_visible_items_in_unexpand_mode = n_visible_items_in_unexpand_mode;
81 _n_total_items = n_total_items;
82
83 Relayout();
84
85=== modified file 'plugins/unityshell/src/PlacesGroup.h'
86--- plugins/unityshell/src/PlacesGroup.h 2012-03-13 16:19:52 +0000
87+++ plugins/unityshell/src/PlacesGroup.h 2012-03-21 11:20:30 +0000
88@@ -32,6 +32,7 @@
89 #include "Introspectable.h"
90 #include "StaticCairoText.h"
91 #include "UBusWrapper.h"
92+#include "ResultView.h"
93
94 namespace nux
95 {
96@@ -55,7 +56,7 @@
97 nux::StaticCairoText* GetLabel();
98 nux::StaticCairoText* GetExpandLabel();
99
100- void SetChildView(nux::View* view);
101+ void SetChildView(dash::ResultView* view);
102 nux::View* GetChildView();
103
104 void SetChildLayout(nux::Layout* layout);
105
106=== modified file 'plugins/unityshell/src/ResultView.h'
107--- plugins/unityshell/src/ResultView.h 2012-02-28 01:41:34 +0000
108+++ plugins/unityshell/src/ResultView.h 2012-03-21 11:20:30 +0000
109@@ -58,6 +58,8 @@
110 void SetPreview(PreviewBase* preview, Result& related_result);
111
112 nux::Property<bool> expanded;
113+ nux::Property<int> results_per_row;
114+
115 sigc::signal<void, std::string const&> UriActivated;
116 sigc::signal<void, std::string const&> ChangePreview; // request a new preview, string is the uri
117
118
119=== modified file 'plugins/unityshell/src/ResultViewGrid.cpp'
120--- plugins/unityshell/src/ResultViewGrid.cpp 2012-02-17 16:48:25 +0000
121+++ plugins/unityshell/src/ResultViewGrid.cpp 2012-03-21 11:20:30 +0000
122@@ -273,6 +273,7 @@
123 PositionPreview();
124
125 mouse_over_index_ = GetIndexAtPosition(mouse_last_x_, mouse_last_y_);
126+ results_per_row = items_per_row;
127 }
128
129 void ResultViewGrid::PositionPreview()
130@@ -611,7 +612,6 @@
131 gPainter.PaintBackground(GfxContext, GetGeometry());
132
133 int items_per_row = GetItemsPerRow();
134-
135 uint total_rows = (!expanded) ? 0 : (results_.size() / items_per_row) + 1;
136
137 ResultView::ResultList::iterator it;
138
139=== modified file 'standalone-clients/CMakeLists.txt'
140--- standalone-clients/CMakeLists.txt 2012-02-24 17:17:14 +0000
141+++ standalone-clients/CMakeLists.txt 2012-03-21 11:20:30 +0000
142@@ -43,6 +43,8 @@
143 #
144 add_executable (dash
145 standalone_dash.cpp
146+ ${UNITY_SRC}/AbstractPlacesGroup.cpp
147+ ${UNITY_SRC}/AbstractPlacesGroup.h
148 ${UNITY_SRC}/BackgroundEffectHelper.cpp
149 ${UNITY_SRC}/BackgroundEffectHelper.h
150 ${UNITY_SRC}/BGHash.cpp
151@@ -101,6 +103,8 @@
152 ${UNITY_SRC}/LensBarIcon.h
153 ${UNITY_SRC}/LensView.cpp
154 ${UNITY_SRC}/LensView.h
155+ ${UNITY_SRC}/LensViewPrivate.cpp
156+ ${UNITY_SRC}/LensViewPrivate.h
157 ${UNITY_SRC}/OverlayRenderer.cpp
158 ${UNITY_SRC}/PreviewApplications.cpp
159 ${UNITY_SRC}/PreviewBase.cpp