@@ -46,7 +46,7 @@ IndicatorTest {
46 IndicatorsBar {
46 IndicatorsBar {
47 id: indicatorsBar
47 id: indicatorsBar
48 height: expanded ? units.gu(7) : units.gu(3)
48 height: expanded ? units.gu(7) : units.gu(3)
49− width: units.gu(30)
49+ width: units.gu(widthSlider.value)
50 anchors.centerIn: parent
50 anchors.centerIn: parent
51 indicatorsModel: root.indicatorsModel
51 indicatorsModel: root.indicatorsModel
52 interactive: expanded && height === units.gu(7)
52 interactive: expanded && height === units.gu(7)
@@ -79,6 +79,14 @@ IndicatorTest {
79 onClicked: indicatorsBar.expanded = !indicatorsBar.expanded
79 onClicked: indicatorsBar.expanded = !indicatorsBar.expanded
84+ Layout.fillWidth: true
82 Rectangle {
90 Rectangle {
83 Layout.preferredHeight: units.dp(1);
91 Layout.preferredHeight: units.dp(1);
84 Layout.fillWidth: true;
92 Layout.fillWidth: true;
@@ -114,6 +122,7 @@ IndicatorTest {
114 when: windowShown
122 when: windowShown
116 function init() {
124 function init() {
125+ widthSlider.value = 30;
117 indicatorsBar.expanded = false;
126 indicatorsBar.expanded = false;
118 wait_for_expansion_to_settle();
127 wait_for_expansion_to_settle();
@@ -220,5 +229,21 @@ IndicatorTest {
220 tryCompareFunction(function() { return dataItem.width > 0.0; }, true);
229 tryCompareFunction(function() { return dataItem.width > 0.0; }, true);
233+ // Rough test that resizing the IndicatorsBar has the items reposition correctly
234+ function test_widthChangeRepositionsItems() {
235+ var lastItemIndex = root.originalModelData.length-1;
236+ var dataItem = findChild(indicatorsBar, root.originalModelData[lastItemIndex]["identifier"] + "-panelItem");
237+ verify(dataItem !== null);
239+ var mappedPosition = indicatorsBar.mapFromItem(dataItem, dataItem.width/2, dataItem.height/2);
240+ var oldDistanceFromRightEdge = indicatorsBar.width - mappedPosition.x;
242+ widthSlider.value = 50;
243+ mappedPosition = indicatorsBar.mapFromItem(dataItem, dataItem.width/2, dataItem.height/2);
244+ var newDistanceFromRightEdge = indicatorsBar.width - mappedPosition.x;
246+ compare(newDistanceFromRightEdge, oldDistanceFromRightEdge);