Merge lp:~daker/ubuntu-ui-toolkit/fix.1341559 into lp:ubuntu-ui-toolkit/staging

Proposed by Adnane Belmadiaf on 2017-02-17
Status: Merged
Approved by: Christian Dywan on 2017-02-21
Approved revision: 2177
Merged at revision: 2175
Proposed branch: lp:~daker/ubuntu-ui-toolkit/fix.1341559
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 50 lines (+16/-0)
3 files modified
components.api (+1/-0)
src/imports/Components/1.3/OptionSelector.qml (+6/-0)
tests/unit/visual/tst_optionselector.13.qml (+9/-0)
To merge this branch: bzr merge lp:~daker/ubuntu-ui-toolkit/fix.1341559
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2017-02-21
Christian Dywan (community) 2017-02-17 Approve on 2017-02-21
Review via email: mp+317568@code.launchpad.net

Commit message

Add count prop to OptionSelector

Description of the change

Add count prop to OptionSelector

To post a comment you must log in.
Christian Dywan (kalikiana) wrote :

Can we have a unit test in tests/unit/visual/tst_optionselector.13.qml verifying that the count is correct?

review: Needs Fixing
2175. By Adnane Belmadiaf on 2017-02-20

Fix components.api

2176. By Adnane Belmadiaf on 2017-02-20

Add test for the OptionSelector count prop

Christian Dywan (kalikiana) wrote :

Looks good! Let's see if Jenkins agrees.

review: Approve
Christian Dywan (kalikiana) wrote :

@@ -731,6 +731,7 @@ Ubuntu.Components.OptionSelector 1.0 0.1
 Ubuntu.Components.OptionSelector 1.3: Empty
     property bool colourImage
     property double containerHeight
+ readonly property int count
     property bool currentlyExpanded
     property Component delegate
     property bool expanded
@@ -740,7 +741,6 @@ Ubuntu.Components.OptionSelector 1.3: Em
     property var model
     property bool multiSelection
     property int selectedIndex
- readonly property int count
 Ubuntu.Components.OptionSelectorDelegate 1.0 0.1: Empty
     property color assetColour
     property bool colourImage
Differences in API. Did you forget to update components.api?

review: Needs Fixing
2177. By Adnane Belmadiaf on 2017-02-21

Fix components.api

Christian Dywan (kalikiana) wrote :

Sweet! Thanks for fixing!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2017-01-26 11:59:45 +0000
3+++ components.api 2017-02-21 14:57:14 +0000
4@@ -731,6 +731,7 @@
5 Ubuntu.Components.OptionSelector 1.3: Empty
6 property bool colourImage
7 property double containerHeight
8+ readonly property int count
9 property bool currentlyExpanded
10 property Component delegate
11 property bool expanded
12
13=== modified file 'src/imports/Components/1.3/OptionSelector.qml'
14--- src/imports/Components/1.3/OptionSelector.qml 2016-08-22 10:18:57 +0000
15+++ src/imports/Components/1.3/OptionSelector.qml 2017-02-21 14:57:14 +0000
16@@ -155,6 +155,12 @@
17 }
18
19 /*!
20+ \qmlproperty int count
21+ This property holds the number of items in the OptionSelector.
22+ */
23+ property alias count: list.count
24+
25+ /*!
26 \qmlproperty int selectedIndex
27 The index of the currently selected element in our list.
28 */
29
30=== modified file 'tests/unit/visual/tst_optionselector.13.qml'
31--- tests/unit/visual/tst_optionselector.13.qml 2016-09-19 11:13:19 +0000
32+++ tests/unit/visual/tst_optionselector.13.qml 2017-02-21 14:57:14 +0000
33@@ -183,8 +183,17 @@
34 function test_custom_data() {
35 return test_arrow_select_data()
36 }
37+
38 function test_custom(data) {
39 test_arrow_select(data, customSelector, 2);
40 }
41+
42+ function test_count() {
43+ var selector = defaultSelector;
44+ sections.selectedIndex = 0;
45+ selector.forceActiveFocus();
46+ waitForRendering(selector);
47+ compare(selector.count, customModel.count);
48+ }
49 }
50 }

Subscribers

People subscribed via source and target branches