diff options
| author | Omer Akram <om26er@ubuntu.com> | 2012-08-24 04:20:55 +0500 |
|---|---|---|
| committer | Omer Akram <om26er@ubuntu.com> | 2012-08-24 04:20:55 +0500 |
| commit | 311bec43577e0258d813d7118b4cd9379f8fef29 (patch) | |
| tree | 4cab434b23e5a26ba577f822069c964d62eb6a4b | |
| parent | 9e49e875d857e04acb3ae5b8a03dfd53e71c4a43 (diff) | |
| parent | 48ba090145bca7ff634663ea02b877e5acca0f26 (diff) | |
fix conflicts
(bzr r2616.5.2)
| -rwxr-xr-x | dash/CoverflowResultView.cpp | 3 | ||||
| -rw-r--r-- | dash/DashView.cpp | 7 | ||||
| -rw-r--r-- | dash/FilterExpanderLabel.cpp | 19 | ||||
| -rw-r--r-- | dash/FilterExpanderLabel.h | 2 | ||||
| -rw-r--r-- | dash/FilterRatingsButton.cpp | 3 | ||||
| -rw-r--r-- | manual-tests/Panel.txt | 16 | ||||
| -rw-r--r-- | services/panel-service.c | 1 | ||||
| -rw-r--r-- | tests/autopilot/unity/emulators/dash.py | 20 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_dash.py | 64 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_hud.py | 31 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_panel.py | 10 |
11 files changed, 139 insertions, 37 deletions
diff --git a/dash/CoverflowResultView.cpp b/dash/CoverflowResultView.cpp index 65ae8fdd4..c73b4e109 100755 --- a/dash/CoverflowResultView.cpp +++ b/dash/CoverflowResultView.cpp @@ -85,6 +85,7 @@ CoverflowResultItem::CoverflowResultItem(Result& result, CoverflowResultView *pa static const int element_size = style.GetTileHeight(); icon_texture_ = new IconTexture(icon_name.c_str(), element_size, true); + icon_texture_->SinkReference(); icon_texture_->LoadIcon(); icon_texture_->texture_updated.connect([&] (nux::BaseTexture *texture) @@ -96,7 +97,7 @@ CoverflowResultItem::CoverflowResultItem(Result& result, CoverflowResultView *pa CoverflowResultItem::~CoverflowResultItem() { - + icon_texture_->UnReference(); } std::string CoverflowResultItem::Uri() diff --git a/dash/DashView.cpp b/dash/DashView.cpp index 27474b6ce..fb6bde6dd 100644 --- a/dash/DashView.cpp +++ b/dash/DashView.cpp @@ -29,6 +29,7 @@ #include <UnityCore/GLibWrapper.h> #include <UnityCore/RadioOptionFilter.h> +#include "FilterExpanderLabel.h" #include "unity-shared/DashStyle.h" #include "unity-shared/KeyboardUtil.h" #include "unity-shared/UnitySettings.h" @@ -969,9 +970,11 @@ nux::Area* DashView::FindKeyFocusArea(unsigned int key_symbol, if (active_lens_view_->filter_bar() && active_lens_view_->fscroll_view() && active_lens_view_->fscroll_view()->IsVisible()) { - for (auto filter : active_lens_view_->filter_bar()->GetLayout()->GetChildren()) + for (auto child : active_lens_view_->filter_bar()->GetLayout()->GetChildren()) { - tabs.push_back(filter); + FilterExpanderLabel* filter = dynamic_cast<FilterExpanderLabel*>(child); + if (filter) + tabs.push_back(filter->expander_view()); } } diff --git a/dash/FilterExpanderLabel.cpp b/dash/FilterExpanderLabel.cpp index 7665be425..8d47b000a 100644 --- a/dash/FilterExpanderLabel.cpp +++ b/dash/FilterExpanderLabel.cpp @@ -96,7 +96,6 @@ FilterExpanderLabel::FilterExpanderLabel(std::string const& label, NUX_FILE_LINE { expanded.changed.connect(sigc::mem_fun(this, &FilterExpanderLabel::DoExpandChange)); BuildLayout(); - SetAcceptKeyNavFocusOnMouseDown(false); separator_ = new HSeparator; separator_->SinkReference(); @@ -227,11 +226,6 @@ void FilterExpanderLabel::BuildLayout() expander_view_->key_nav_focus_activate.connect(key_expand); cairo_label_->mouse_click.connect(mouse_expand); expand_icon_->mouse_click.connect(mouse_expand); - key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) - { - if(has_focus) - nux::GetWindowCompositor().SetKeyFocusArea(expander_view_); - }); QueueRelayout(); NeedRedraw(); @@ -304,7 +298,7 @@ void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& GfxContext, bool forc // bool FilterExpanderLabel::AcceptKeyNavFocus() { - return true; + return false; } // @@ -317,9 +311,18 @@ std::string FilterExpanderLabel::GetName() const void FilterExpanderLabel::AddProperties(GVariantBuilder* builder) { + bool content_has_focus = false; + auto focus_area = nux::GetWindowCompositor().GetKeyFocusArea(); + + if (focus_area && contents_) + content_has_focus = focus_area->IsChildOf(contents_.GetPointer()); + unity::variant::BuilderWrapper wrapper(builder); - wrapper.add("expander-has-focus", expander_view_->HasKeyFocus()); + wrapper.add("expander-has-focus", (expander_view_ && expander_view_->HasKeyFocus())) + .add("expanded", expanded()) + .add(GetAbsoluteGeometry()) + .add("content-has-focus", content_has_focus); } } // namespace dash diff --git a/dash/FilterExpanderLabel.h b/dash/FilterExpanderLabel.h index f769b4aaa..e970ca79b 100644 --- a/dash/FilterExpanderLabel.h +++ b/dash/FilterExpanderLabel.h @@ -63,6 +63,8 @@ public: virtual void SetFilter(Filter::Ptr const& filter) = 0; virtual std::string GetFilterType() = 0; + nux::View* expander_view() const { return expander_view_; } + nux::Property<bool> expanded; nux::Property<bool> draw_separator; diff --git a/dash/FilterRatingsButton.cpp b/dash/FilterRatingsButton.cpp index 22419a7c0..503e8eeb1 100644 --- a/dash/FilterRatingsButton.cpp +++ b/dash/FilterRatingsButton.cpp @@ -51,13 +51,14 @@ FilterRatingsButton::FilterRatingsButton(NUX_FILE_LINE_DECL) key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) { - if (has_focus && direction != nux::KEY_NAV_NONE) + if (has_focus) focused_star_ = 0; else if (!has_focus) focused_star_ = -1; QueueDraw(); }); + key_nav_focus_activate.connect([&](nux::Area*) { filter_->rating = static_cast<float>(focused_star_+1)/num_stars; }); key_down.connect(sigc::mem_fun(this, &FilterRatingsButton::OnKeyDown)); } diff --git a/manual-tests/Panel.txt b/manual-tests/Panel.txt index dbe89dd39..d36af4588 100644 --- a/manual-tests/Panel.txt +++ b/manual-tests/Panel.txt @@ -20,22 +20,6 @@ Expected Result: Once all the maximized windows are closed, restored or not visible, the panel should go back to its defined opacity. -Panel Double Clicks -------------------- -This test shows how the double click over the top panel should work. - -Setup: - -Actions: -#. Start with a clear screen -#. Open a window and maximize it -#. Double-click on the top-panel grab area (the empty area between the menus and - the indicators). - -Expected Result: - The maximized window should restore. If no maximized window is available on - the current workspace, nothing should happen. - Menu Color ---------- This test shows the color of the menus using the Ambiance theme: diff --git a/services/panel-service.c b/services/panel-service.c index 8b4ae5634..d988a3df5 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -109,6 +109,7 @@ static const gchar * indicator_order[][2] = { {"libappmenu.so", NULL}, /* indicator-appmenu" */ {"libapplication.so", NULL}, /* indicator-application" */ {"libprintersmenu.so", NULL}, /* indicator-printers */ + {"libsyncindicator.so", NULL}, /* indicator-sync */ {"libapplication.so", "gsd-keyboard-xkb"}, /* keyboard layout selector */ {"libmessaging.so", NULL}, /* indicator-messages */ {"libpower.so", NULL}, /* indicator-power */ diff --git a/tests/autopilot/unity/emulators/dash.py b/tests/autopilot/unity/emulators/dash.py index d3047176d..86c747f4b 100644 --- a/tests/autopilot/unity/emulators/dash.py +++ b/tests/autopilot/unity/emulators/dash.py @@ -332,6 +332,26 @@ class FilterBar(UnityIntrospectionObject): class FilterExpanderLabel(UnityIntrospectionObject): """A label that expands into a filter within a filter bar.""" + def ensure_expanded(self): + """Expand the filter expander label, if it's not already""" + if not self.expanded: + tx = x + width / 2 + ty = y + height / 2 + m = Mouse() + m.move(tx, ty) + m.click() + self.expanded.wait_for(True) + + def ensure_collapsed(self): + """Collapse the filter expander label, if it's not already""" + if self.expanded: + tx = x + width / 2 + ty = y + height / 2 + m = Mouse() + m.move(tx, ty) + m.click() + self.expanded.wait_for(False) + class CoverArt(UnityIntrospectionObject): """A view which can be used to show a texture, or generate one using a thumbnailer.""" diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py index 245c1524a..ab4c5b489 100644 --- a/tests/autopilot/unity/tests/test_dash.py +++ b/tests/autopilot/unity/tests/test_dash.py @@ -184,7 +184,7 @@ class DashKeyNavTests(DashTestCase): current_focused_icon = lensbar.focused_lens_icon - self.keyboard.press_and_release("Right"); + self.keyboard.press_and_release("Right") self.assertThat(lensbar.focused_lens_icon, Eventually(NotEquals(current_focused_icon))) self.keyboard.press_and_release("Left") @@ -196,17 +196,35 @@ class DashKeyNavTests(DashTestCase): for i in range(self.dash.get_num_rows()): self.keyboard.press_and_release("Down") - self.keyboard.press_and_release("Right"); + self.keyboard.press_and_release("Right") lensbar = self.dash.view.get_lensbar() focused_icon = lensbar.focused_lens_icon - self.keyboard.press_and_release("Enter"); + self.keyboard.press_and_release("Enter") self.assertThat(lensbar.active_lens, Eventually(Equals(focused_icon))) # lensbar should lose focus after activation. - # TODO this should be a different test to make sure focus - # returns to the correct place. self.assertThat(lensbar.focused_lens_icon, Eventually(Equals(""))) + + def test_focus_returns_to_searchbar(self): + """This test makes sure that the focus is returned to the searchbar of the newly + activated lens.""" + self.dash.ensure_visible() + + for i in range(self.dash.get_num_rows()): + self.keyboard.press_and_release("Down") + self.keyboard.press_and_release("Right") + lensbar = self.dash.view.get_lensbar() + focused_icon = lensbar.focused_lens_icon + self.keyboard.press_and_release("Enter") + + self.assertThat(lensbar.active_lens, Eventually(Equals(focused_icon))) + self.assertThat(lensbar.focused_lens_icon, Eventually(Equals(""))) + + # Now we make sure if the newly activated lens searchbar have the focus. + self.keyboard.type("HasFocus") + + self.assertThat(self.dash.search_string, Eventually(Equals("HasFocus"))) def test_category_header_keynav(self): """ Tests that a category header gets focus when 'down' is pressed after the @@ -284,6 +302,34 @@ class DashKeyNavTests(DashTestCase): category = lens.get_focused_category() self.assertIsNot(category, None) + def test_bottom_up_keynav_with_filter_bar(self): + """This test makes sure that bottom-up key navigation works well + in the dash filter bar. + """ + self.dash.reveal_application_lens() + lens = self.dash.get_current_lens() + + filter_bar = lens.get_filterbar() + filter_bar.ensure_expanded() + + # Tab to fist filter expander + self.keyboard.press_and_release('Tab') + self.assertThat(lambda: filter_bar.get_focused_filter(), Eventually(NotEquals(None))) + old_focused_filter = filter_bar.get_focused_filter() + old_focused_filter.ensure_expanded() + + # Tab to the next filter expander + self.keyboard.press_and_release('Tab') + self.assertThat(lambda: filter_bar.get_focused_filter(), Eventually(NotEquals(None))) + new_focused_filter = filter_bar.get_focused_filter() + self.assertNotEqual(old_focused_filter, new_focused_filter) + new_focused_filter.ensure_expanded() + + # Move the focus up. + self.keyboard.press_and_release("Up") + self.assertThat(lambda: filter_bar.get_focused_filter(), Eventually(Equals(None))) + self.assertThat(old_focused_filter.content_has_focus, Eventually(Equals(True))) + class DashClipboardTests(DashTestCase): """Test the Unity clipboard""" @@ -516,8 +562,8 @@ class DashBorderTests(DashTestCase): if (self.dash.view.form_factor != "desktop"): self.skip("Not in desktop form-factor.") - x = self.dash.view.x + self.dash.view.width + self.dash.view.right_border_width / 2; - y = self.dash.view.y + self.dash.view.height / 2; + x = self.dash.view.x + self.dash.view.width + self.dash.view.right_border_width / 2 + y = self.dash.view.y + self.dash.view.height / 2 self.mouse.move(x, y) self.mouse.click() @@ -531,8 +577,8 @@ class DashBorderTests(DashTestCase): if (self.dash.view.form_factor != "desktop"): self.skip("Not in desktop form-factor.") - x = self.dash.view.x + self.dash.view.width / 2; - y = self.dash.view.y + self.dash.view.height + self.dash.view.bottom_border_height / 2; + x = self.dash.view.x + self.dash.view.width / 2 + y = self.dash.view.y + self.dash.view.height + self.dash.view.bottom_border_height / 2 self.mouse.move(x, y) self.mouse.click() diff --git a/tests/autopilot/unity/tests/test_hud.py b/tests/autopilot/unity/tests/test_hud.py index f682768b3..14a151418 100644 --- a/tests/autopilot/unity/tests/test_hud.py +++ b/tests/autopilot/unity/tests/test_hud.py @@ -247,6 +247,20 @@ class HudBehaviorTests(HudTestsBase): self.mouse.click() self.assertThat(self.hud.visible, Eventually(Equals(False))) + + def test_hud_closes_click_after_text_removed(self): + """Clicking outside of the hud after a search text has been entered and + then removed from the searchbox will make it close.""" + + self.hud.ensure_visible() + self.keyboard.type("Test") + self.keyboard.press_and_release("Escape") + + (x,y,w,h) = self.hud.view.geometry + self.mouse.move(w/2, h+50) + self.mouse.click() + + self.assertThat(self.hud.visible, Eventually(Equals(False))) def test_alt_f4_close_hud(self): """Hud must close on alt+F4.""" @@ -277,6 +291,23 @@ class HudBehaviorTests(HudTestsBase): self.addCleanup(self.close_all_app, "System Settings") self.assertThat(self.hud.visible, Eventually(Equals(False))) + + def test_hud_closes_on_escape(self): + """Hud must close on escape after searchbox is cleared""" + self.hud.ensure_visible() + + self.keyboard.type("ThisText") + self.keyboard.press_and_release("Escape") + self.keyboard.press_and_release("Escape") + + self.assertThat(self.hud.visible, Eventually(Equals(False))) + + def test_hud_closes_on_escape_shrunk(self): + """Hud must close when escape key is pressed""" + self.hud.ensure_visible() + self.keyboard.press_and_release("Escape") + + self.assertThat(self.hud.visible, Eventually(Equals(False))) def test_alt_arrow_keys_not_eaten(self): """Tests that Alt+ArrowKey events are correctly passed to the diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py index d73a847ce..1d31f81be 100644 --- a/tests/autopilot/unity/tests/test_panel.py +++ b/tests/autopilot/unity/tests/test_panel.py @@ -628,6 +628,16 @@ class PanelWindowButtonsTests(PanelTestsBase): self.keyboard.type("World") self.assertThat(self.hud.search_string, Eventually(Equals("HelloWorld"))) + + def test_double_click_unmaximize_window(self): + """Double clicking the grab area must unmaximize a maximized window.""" + gedit_win = self.open_new_application_window("Text Editor", maximized=True) + + self.panel.move_mouse_over_grab_area() + self.mouse.click() + self.mouse.click() + + self.assertThat(self.panel.title, Eventually(Equals(gedit_win.application.name))) class PanelHoverTests(PanelTestsBase): |
