diff options
| author | Nick Dedekind <nicholas.dedekind@gmail.com> | 2012-10-12 05:07:57 +0000 |
|---|---|---|
| committer | Tarmac <> | 2012-10-12 05:07:57 +0000 |
| commit | ff8d1ba3bbca92d6df65e7c32e95a23813046c71 (patch) | |
| tree | 0868ec7814fa22b292afa19fde801d3eee2be381 | |
| parent | 203a9d7e91e52d3863e8a1fc3995acbba14d53d9 (diff) | |
| parent | c6bd8301f4e399a82912d6ce0d0ff89bfe71ea24 (diff) | |
Fixed dash preview scrolling. (LP: #1056995). Fixes: https://bugs.launchpad.net/bugs/1056995. Approved by Brandon Schaefer.
(bzr r2831)
| -rw-r--r-- | dash/previews/MusicPreview.cpp | 3 | ||||
| -rw-r--r-- | dash/previews/Preview.cpp | 23 | ||||
| -rw-r--r-- | manual-tests/Preview.txt | 31 | ||||
| -rw-r--r-- | unity-shared/PreviewStyle.cpp | 2 |
4 files changed, 39 insertions, 20 deletions
diff --git a/dash/previews/MusicPreview.cpp b/dash/previews/MusicPreview.cpp index 81a17a8d7..01825d1df 100644 --- a/dash/previews/MusicPreview.cpp +++ b/dash/previews/MusicPreview.cpp @@ -210,9 +210,10 @@ void MusicPreview::SetupViews() } else // otherwise we add a grid layout. { - hint_actions_layout->AddSpace(0, 1); action_buttons_.clear(); actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_); + if (action_buttons_.size() < 2) + hint_actions_layout->AddSpace(0, 1); actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin()); } ///////////////////// diff --git a/dash/previews/Preview.cpp b/dash/previews/Preview.cpp index ddc90b298..e88b68365 100644 --- a/dash/previews/Preview.cpp +++ b/dash/previews/Preview.cpp @@ -256,17 +256,12 @@ nux::Layout* Preview::BuildGridActionsLayout(dash::Preview::ActionPtrList action { previews::Style& style = dash::previews::Style::Instance(); - nux::VLayout* actions_buffer_v = new nux::VLayout(); - actions_buffer_v->AddSpace(0, 1); nux::VLayout* actions_layout_v = new nux::VLayout(); actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions()); - uint rows = actions.size() / 2 + ((actions.size() % 2 > 0) ? 1 : 0); uint action_iter = 0; for (uint i = 0; i < rows; i++) { - nux::HLayout* actions_buffer_h = new nux::HLayout(); - actions_buffer_h->AddSpace(0, 1); nux::HLayout* actions_layout_h = new TabIteratorHLayout(tab_iterator_); actions_layout_h->SetSpaceBetweenChildren(style.GetSpaceBetweenActions()); @@ -282,25 +277,19 @@ nux::Layout* Preview::BuildGridActionsLayout(dash::Preview::ActionPtrList action button->activate.connect(sigc::mem_fun(this, &Preview::OnActionActivated)); buttons.push_back(button); - actions_layout_h->AddView(button, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN); + actions_layout_h->AddView(button, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN); } - actions_buffer_h->AddLayout(actions_layout_h, 0); - actions_layout_v->AddLayout(actions_buffer_h, 0, nux::MINOR_POSITION_TOP, nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN); + + actions_layout_v->AddLayout(actions_layout_h, 0, nux::MINOR_POSITION_RIGHT, nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN); } - actions_buffer_v->AddLayout(actions_layout_v, 0); - return actions_buffer_v; + return actions_layout_v; } nux::Layout* Preview::BuildVerticalActionsLayout(dash::Preview::ActionPtrList actions, std::list<nux::AbstractButton*>& buttons) { previews::Style& style = dash::previews::Style::Instance(); - nux::HLayout* actions_buffer_h = new nux::HLayout(); - actions_buffer_h->AddSpace(0, 1); - - nux::VLayout* actions_buffer_v = new nux::VLayout(); - actions_buffer_v->AddSpace(0, 1); nux::VLayout* actions_layout_v = new TabIteratorVLayout(tab_iterator_); actions_layout_v->SetSpaceBetweenChildren(style.GetSpaceBetweenActions()); @@ -319,10 +308,8 @@ nux::Layout* Preview::BuildVerticalActionsLayout(dash::Preview::ActionPtrList ac actions_layout_v->AddView(button, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL, 100.0f, nux::NUX_LAYOUT_BEGIN); } - actions_buffer_v->AddLayout(actions_layout_v, 0); - actions_buffer_h->AddLayout(actions_buffer_v, 0); - return actions_buffer_h; + return actions_layout_v; } void Preview::UpdateCoverArtImage(CoverArt* cover_art) diff --git a/manual-tests/Preview.txt b/manual-tests/Preview.txt index 59de71e12..10612c195 100644 --- a/manual-tests/Preview.txt +++ b/manual-tests/Preview.txt @@ -204,3 +204,34 @@ Actions: Expected result: The Dash navigation bar should not be seen through the preview. + +Preview Scrolling Drag +------------------------------ +This tests that a preview with a scrollbar can be scrolled by dragging the scrollbar. + +Setup: +#. Open dash. +#. Open Music Lens. +#. Open a preview for an album which has a scrollbar due to more tracks that can fit on screen. + +Actions: +#. Scroll down the tracks by dragging the scrollbar. + +Expected Result: + The scroll view will scroll down the list of tracks. + + +Preview Scrolling Mouse Wheel +------------------------------ +This tests that a preview with a scrollbar can be scrolled by using the mouse wheel. + +Setup: +#. Open dash. +#. Open Music Lens. +#. Open a preview for an album which has a scrollbar due to more tracks that can fit on screen. + +Actions: +#. Scroll down the tracks by using the mouse wheel. + +Expected Result: + The scroll view will scroll down the list of tracks. diff --git a/unity-shared/PreviewStyle.cpp b/unity-shared/PreviewStyle.cpp index bcfa52df7..689d80000 100644 --- a/unity-shared/PreviewStyle.cpp +++ b/unity-shared/PreviewStyle.cpp @@ -229,7 +229,7 @@ int Style::GetActionButtonHeight() const int Style::GetActionButtonMaximumWidth() const { - return 190; + return 175; } int Style::GetSpaceBetweenActions() const |
