on xenial help sign in
Fixed code styling
commitdbcb48ce94e978408128d1bdb7815104fc41c793 authorNick Dedekind <nicholas.dedekind@gmail.com> dateTue 11 Jun 2013, 11:36 (13 years ago) parent1fe83ec
9 files changed+96−96
Dash/DashContent.qml+2−2 tests/qmltests/Dash/qml/FakeLensView.qml+21−21 tests/qmltests/Dash/qml/fake_generic_lensView.qml+1−1 tests/qmltests/Dash/qml/fake_lensView1.qml+1−1 tests/qmltests/Dash/qml/fake_lensView2.qml+1−1 tests/qmltests/Dash/qml/fake_lensView3.qml+1−1 tests/qmltests/Dash/qml/fake_lensView4.qml+1−1 tests/qmltests/Dash/tst_Dash.qml+15−15 tests/qmltests/Dash/tst_DashContent.qml+53−53
Dash/DashContent.qml+2−2
@@ -28,7 +28,7 @@ Item {
2828 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
2929 property alias currentIndex: dashContentList.currentIndex
3030
31− property LensDelegateMapper lens_mapper : LensDelegateMapper {}
31+ property LensDelegateMapper lensMapper : LensDelegateMapper {}
3232
3333 signal movementStarted()
3434 signal movementEnded()
@@ -115,7 +115,7 @@ Item {
115115 width: ListView.view.width
116116 height: ListView.view.height
117117 asynchronous: true
118− source: lens_mapper.map(lens.id)
118+ source: lensMapper.map(lens.id)
119119 onLoaded: {
120120 item.lens = Qt.binding(function() { return lens })
121121 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
tests/qmltests/Dash/qml/FakeLensView.qml+21−21
@@ -28,21 +28,21 @@ FocusScope {
2828 signal movementStarted
2929 signal positionedAtBeginning
3030
31− property alias back_color : back.color
31+ property alias backColor : back.color
3232
3333 onEndReached: {
34− if (shell != undefined && shell.lens_status != undefined) {
35− shell.lens_status[lens.id].endReached++;
34+ if (shell != undefined && shell.lensStatus != undefined) {
35+ shell.lensStatus[lens.id].endReached++;
3636 }
3737 }
3838 onMovementStarted: {
39− if (shell != undefined && shell.lens_status != undefined) {
40− shell.lens_status[lens.id].movementStarted++;
39+ if (shell != undefined && shell.lensStatus != undefined) {
40+ shell.lensStatus[lens.id].movementStarted++;
4141 }
4242 }
4343 onPositionedAtBeginning: {
44− if (shell != undefined && shell.lens_status != undefined) {
45− shell.lens_status[lens.id].positionedAtBeginning++;
44+ if (shell != undefined && shell.lensStatus != undefined) {
45+ shell.lensStatus[lens.id].positionedAtBeginning++;
4646 }
4747 }
4848
@@ -54,30 +54,30 @@ FocusScope {
5454
5555 function randomBg()
5656 {
57− var hex1=new Array("4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")
58− var bg="#"+hex1[Math.floor(Math.random()*hex1.length)]+
59− hex1[Math.floor(Math.random()*hex1.length)]+
60− hex1[Math.floor(Math.random()*hex1.length)]+
61− hex1[Math.floor(Math.random()*hex1.length)]+
62− hex1[Math.floor(Math.random()*hex1.length)]+
63− hex1[Math.floor(Math.random()*hex1.length)]
64− return bg
57+ var hex1=new Array("4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F")
58+ var bg="#"+hex1[Math.floor(Math.random()*hex1.length)]+
59+ hex1[Math.floor(Math.random()*hex1.length)]+
60+ hex1[Math.floor(Math.random()*hex1.length)]+
61+ hex1[Math.floor(Math.random()*hex1.length)]+
62+ hex1[Math.floor(Math.random()*hex1.length)]+
63+ hex1[Math.floor(Math.random()*hex1.length)]
64+ return bg
6565 }
6666
6767
6868 ListView {
69− id: list_view
69+ id: listView
7070 anchors.fill: parent
7171 model: lens ? lens.categories : null
7272 orientation: ListView.Vertical
7373
7474 delegate: Column {
7575 id: column
76− width: list_view.width
76+ width: listView.width
7777 height: childrenRect.height
7878
7979 Rectangle {
80− width: list_view.width
80+ width: listView.width
8181 height: units.gu(3)
8282 color: randomBg()
8383
@@ -90,17 +90,17 @@ FocusScope {
9090 }
9191 }
9292 GridView {
93− id: results_grid
93+ id: resultsGrid
9494 model: results
9595 cellWidth: units.gu(10); cellHeight: units.gu(10)
9696 height: childrenRect.height
97− width: list_view.width
97+ width: listView.width
9898 interactive: false
9999
100100 delegate: Component {
101101 id: resultDelegate
102102 Item {
103− width: results_grid.cellWidth; height: results_grid.cellHeight
103+ width: resultsGrid.cellWidth; height: resultsGrid.cellHeight
104104 Column {
105105 anchors.verticalCenter: parent.verticalCenter
106106 anchors.horizontalCenter: parent.horizontalCenter
tests/qmltests/Dash/qml/fake_generic_lensView.qml+1−1
@@ -20,5 +20,5 @@ FakeLensView {
2020 id: fake_generic_lensView
2121 objectName: "fake_generic_lensView"
2222
23− back_color: "#D0D0D0"
23+ backColor: "#D0D0D0"
2424}
tests/qmltests/Dash/qml/fake_lensView1.qml+1−1
@@ -20,5 +20,5 @@ FakeLensView {
2020 id: fake_lensView1
2121 objectName: "fake_lensView1"
2222
23− back_color: "#909090"
23+ backColor: "#909090"
2424}
tests/qmltests/Dash/qml/fake_lensView2.qml+1−1
@@ -20,5 +20,5 @@ FakeLensView {
2020 id: fake_lensView2
2121 objectName: "fake_lensView2"
2222
23− back_color: "#A0A0A0"
23+ backColor: "#A0A0A0"
2424}
tests/qmltests/Dash/qml/fake_lensView3.qml+1−1
@@ -20,5 +20,5 @@ FakeLensView {
2020 id: fake_lensView3
2121 objectName: "fake_lensView3"
2222
23− back_color: "#B0B0B0"
23+ backColor: "#B0B0B0"
2424}
tests/qmltests/Dash/qml/fake_lensView4.qml+1−1
@@ -20,5 +20,5 @@ FakeLensView {
2020 id: fake_lensView4
2121 objectName: "fake_lensView4"
2222
23− back_color: "#C0C0C0"
23+ backColor: "#C0C0C0"
2424}
tests/qmltests/Dash/tst_Dash.qml+15−15
@@ -34,7 +34,7 @@ Item {
3434 }
3535
3636 LensDelegateMapper {
37− id: lens_delegate_mapper
37+ id: lensDelegateMapper
3838 lensDelegateMapping: {
3939 "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
4040 "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
@@ -52,7 +52,7 @@ Item {
5252
5353 Component.onCompleted: {
5454 var dashContent = findChild(dash, "dashContent");
55− dashContent.lens_mapper = lens_delegate_mapper;
55+ dashContent.lensMapper = lensDelegateMapper;
5656 lenses = dashContent.lenses;
5757 }
5858
@@ -67,11 +67,11 @@ Item {
6767
6868 function get_lens_data() {
6969 return [
70− { tag: "MockLens1", visual_index: 0, should_be_visible: true },
71− { tag: "MockLens2", visual_index: -1, should_be_visible: false },
72− { tag: "MockLens3", visual_index: 1, should_be_visible: true },
73− { tag: "MockLens4", visual_index: 2, should_be_visible: true },
74− { tag: "MockLens5", visual_index: 3, should_be_visible: true },
70+ { tag: "MockLens1", visualIndex: 0, shouldBeVisible: true },
71+ { tag: "MockLens2", visualIndex: -1, shouldBeVisible: false },
72+ { tag: "MockLens3", visualIndex: 1, shouldBeVisible: true },
73+ { tag: "MockLens4", visualIndex: 2, shouldBeVisible: true },
74+ { tag: "MockLens5", visualIndex: 3, shouldBeVisible: true },
7575 ]
7676 }
7777
@@ -88,9 +88,9 @@ Item {
8888 var dashContent = findChild(dash, "dashContent");
8989 var current_index = dashContent.currentIndex;
9090
91− dash.setCurrentLens(data.tag, true, false);
92− compare(dashContent.currentIndex, data.should_be_visible ? data.visual_index : current_index);
93− compare(dashbar.currentIndex, data.should_be_visible ? data.visual_index : current_index);
91+ dash.setCurrentLens(data.tag, true /* animate */, false /* reset */);
92+ compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
93+ compare(dashbar.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
9494 }
9595
9696 function test_show_lens_on_load_data() {
@@ -98,7 +98,7 @@ Item {
9898 }
9999
100100 function test_show_lens_on_load(data) {
101− if (data.should_be_visible == false) {
101+ if (data.shouldBeVisible == false) {
102102 console.log("Not testing " + data.tag + ": not visible");
103103 return;
104104 }
@@ -106,7 +106,7 @@ Item {
106106
107107 var dashContentList = findChild(dash, "dashContentList");
108108 verify(dashContentList != undefined);
109− tryCompare(dashContentList, "currentIndex", data.visual_index);
109+ tryCompare(dashContentList, "currentIndex", data.visualIndex);
110110 }
111111
112112 function test_dash_bar_set_index_connection_data() {
@@ -114,7 +114,7 @@ Item {
114114 }
115115
116116 function test_dash_bar_set_index_connection(data) {
117− if (data.should_be_visible == false) {
117+ if (data.shouldBeVisible == false) {
118118 console.log("Not testing " + data.tag + ": not visible");
119119 return;
120120 }
@@ -126,8 +126,8 @@ Item {
126126 var dashContent = findChild(dash, "dashContent");
127127 var current_index = dashContent.currentIndex;
128128
129− dashbar.itemSelected(data.visual_index);
130− compare(dashContent.currentIndex, data.should_be_visible ? data.visual_index : current_index);
129+ dashbar.itemSelected(data.visualIndex);
130+ compare(dashContent.currentIndex, data.shouldBeVisible ? data.visualIndex : current_index);
131131 }
132132 }
133133}
tests/qmltests/Dash/tst_DashContent.qml+53−53
@@ -28,7 +28,7 @@ Item {
2828
2929 property ListModel searchHistory: ListModel {}
3030
31− property var lens_status: {
31+ property var lensStatus: {
3232 'MockLens1': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
3333 'MockLens2': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
3434 'MockLens3': { 'movementStarted': 0, 'positionedAtBeginning': 0 },
@@ -41,17 +41,17 @@ Item {
4141 }
4242
4343 DashContent {
44− id: dash_content
44+ id: dashContent
4545 anchors.fill: parent
4646
4747 model: lensesModel
4848 lenses : lensesModel
4949
50− lens_mapper : lens_delegate_mapper
50+ lensMapper : lensDelegateMapper
5151 }
5252
5353 LensDelegateMapper {
54− id: lens_delegate_mapper
54+ id: lensDelegateMapper
5555 lensDelegateMapping: {
5656 "MockLens1": "../tests/qmltests/Dash/qml/fake_lensView1.qml",
5757 "MockLens2": "../tests/qmltests/Dash/qml/fake_lensView2.qml",
@@ -62,37 +62,37 @@ Item {
6262 }
6363
6464 function clear_lens_status() {
65− lens_status["MockLens1"].movementStarted = 0;
66− lens_status["MockLens1"].positionedAtBeginning = 0;
65+ lensStatus["MockLens1"].movementStarted = 0;
66+ lensStatus["MockLens1"].positionedAtBeginning = 0;
6767
68− lens_status["MockLens2"].movementStarted = 0;
69− lens_status["MockLens2"].positionedAtBeginning = 0;
68+ lensStatus["MockLens2"].movementStarted = 0;
69+ lensStatus["MockLens2"].positionedAtBeginning = 0;
7070
71− lens_status["MockLens3"].movementStarted = 0;
72− lens_status["MockLens3"].positionedAtBeginning = 0;
71+ lensStatus["MockLens3"].movementStarted = 0;
72+ lensStatus["MockLens3"].positionedAtBeginning = 0;
7373
74− lens_status["MockLens4"].movementStarted = 0;
75− lens_status["MockLens4"].positionedAtBeginning = 0;
74+ lensStatus["MockLens4"].movementStarted = 0;
75+ lensStatus["MockLens4"].positionedAtBeginning = 0;
7676
77− lens_status["MockLens5"].movementStarted = 0;
78− lens_status["MockLens5"].positionedAtBeginning = 0;
77+ lensStatus["MockLens5"].movementStarted = 0;
78+ lensStatus["MockLens5"].positionedAtBeginning = 0;
7979 }
8080
8181 SignalSpy {
82− id: lensLoaded_spy
83− target: dash_content
82+ id: lensLoadedSpy
83+ target: dashContent
8484 signalName: "lensLoaded"
8585 }
8686
8787 SignalSpy {
88− id: movementStarted_spy
89− target: dash_content
88+ id: movementStartedSpy
89+ target: dashContent
9090 signalName: "movementStarted"
9191 }
9292
9393 SignalSpy {
94− id: contentEndReached_spy
95− target: dash_content
94+ id: contentEndReachedSpy
95+ target: dashContent
9696 signalName: "contentEndReached"
9797 }
9898
@@ -101,13 +101,13 @@ Item {
101101 when: windowShown
102102
103103 function init() {
104− lensLoaded_spy.clear();
105− movementStarted_spy.clear();
106− contentEndReached_spy.clear()
104+ lensLoadedSpy.clear();
105+ movementStartedSpy.clear();
106+ contentEndReachedSpy.clear()
107107 clear_lens_status();
108108
109109 // clear, wait for dahs to empty and load lenses.
110− var dashContentList = findChild(dash_content, "dashContentList");
110+ var dashContentList = findChild(dashContent, "dashContentList");
111111 verify(dashContentList != undefined)
112112 lensesModel.clear();
113113 tryCompare(dashContentList, "count", 0);
@@ -115,47 +115,47 @@ Item {
115115 }
116116
117117 function test_movement_started_signal() {
118− dash_content.setCurrentLensAtIndex(3, true, false);
118+ dashContent.setCurrentLensAtIndex(3, true, false);
119119
120− var dashContentList = findChild(dash_content, "dashContentList");
120+ var dashContentList = findChild(dashContent, "dashContentList");
121121 verify(dashContentList != undefined)
122− tryCompare(lensLoaded_spy, "count", 5);
122+ tryCompare(lensLoadedSpy, "count", 5);
123123
124124 dashContentList.movementStarted();
125− compare(movementStarted_spy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
126− compare(lens_status["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");
127− compare(lens_status["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");
128− compare(lens_status["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");
129− compare(lens_status["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");
130− compare(lens_status["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");
125+ compare(movementStartedSpy.count, 1, "DashContent should have emitted movementStarted signal when content list did.");
126+ compare(lensStatus["MockLens1"].movementStarted, 1, "MockLens1 should have emitted movementStarted signal when content list did.");
127+ compare(lensStatus["MockLens2"].movementStarted, 1, "MockLens2 should have emitted movementStarted signal when content list did.");
128+ compare(lensStatus["MockLens3"].movementStarted, 1, "MockLens3 should have emitted movementStarted signal when content list did.");
129+ compare(lensStatus["MockLens4"].movementStarted, 1, "MockLens4 should have emitted movementStarted signal when content list did.");
130+ compare(lensStatus["MockLens5"].movementStarted, 1, "MockLens5 should have emitted movementStarted signal when content list did.");
131131 }
132132
133133 function test_positioned_at_beginning_signal() {
134− dash_content.setCurrentLensAtIndex(3, true, false);
134+ dashContent.setCurrentLensAtIndex(3, true, false);
135135
136− tryCompare(lensLoaded_spy, "count", 5);
136+ tryCompare(lensLoadedSpy, "count", 5);
137137
138− dash_content.positionedAtBeginning();
139− compare(lens_status["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
140− compare(lens_status["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
141− compare(lens_status["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
142− compare(lens_status["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
143− compare(lens_status["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
138+ dashContent.positionedAtBeginning();
139+ compare(lensStatus["MockLens1"].positionedAtBeginning, 1, "MockLens1 should have emitted positionedAtBeginning signal when DashContent did.");
140+ compare(lensStatus["MockLens2"].positionedAtBeginning, 1, "MockLens2 should have emitted positionedAtBeginning signal when DashContent did.");
141+ compare(lensStatus["MockLens3"].positionedAtBeginning, 1, "MockLens3 should have emitted positionedAtBeginning signal when DashContent did.");
142+ compare(lensStatus["MockLens4"].positionedAtBeginning, 1, "MockLens4 should have emitted positionedAtBeginning signal when DashContent did.");
143+ compare(lensStatus["MockLens5"].positionedAtBeginning, 1, "MockLens5 should have emitted positionedAtBeginning signal when DashContent did.");
144144 }
145145
146146 function test_lens_loaded() {
147− tryCompare(lensLoaded_spy, "count", 5);
147+ tryCompare(lensLoadedSpy, "count", 5);
148148 }
149149
150150 function test_content_end_reached() {
151− var dashContentList = findChild(dash_content, "dashContentList");
151+ var dashContentList = findChild(dashContent, "dashContentList");
152152 verify(dashContentList != undefined);
153− tryCompare(lensLoaded_spy, "count", 5);
153+ tryCompare(lensLoadedSpy, "count", 5);
154154
155− dash_content.setCurrentLensAtIndex(0, true, false);
155+ dashContent.setCurrentLensAtIndex(0, true, false);
156156 dashContentList.currentItem.item.endReached();
157157
158− compare(contentEndReached_spy.count, 1);
158+ compare(contentEndReachedSpy.count, 1);
159159 }
160160
161161 // This tests that setting the current lens index will end up at the correct index even if
@@ -164,19 +164,19 @@ Item {
164164 verify(lensesModel.loaded == false);
165165
166166 // next index is 1 if current is -1, otherwise it's current + 1
167− var next_index = ((dash_content.currentIndex == -1 ? 0 : dash_content.currentIndex) + 1) % 5
167+ var next_index = ((dashContent.currentIndex == -1 ? 0 : dashContent.currentIndex) + 1) % 5
168168
169− dash_content.setCurrentLensAtIndex(next_index, true, false);
170− tryCompare(dash_content, "currentIndex", next_index);
169+ dashContent.setCurrentLensAtIndex(next_index, true, false);
170+ tryCompare(dashContent, "currentIndex", next_index);
171171 verify(lensesModel.loaded == true);
172172
173173 // test greater than lens count.
174− dash_content.setCurrentLensAtIndex(lensesModel.count, true, false);
175− compare(dash_content.currentIndex, 4);
174+ dashContent.setCurrentLensAtIndex(lensesModel.count, true, false);
175+ compare(dashContent.currentIndex, 4);
176176 }
177177
178178 function get_current_item_object_name() {
179− var dashContentList = findChild(dash_content, "dashContentList");
179+ var dashContentList = findChild(dashContent, "dashContentList");
180180 verify(dashContentList != undefined);
181181
182182 if (dashContentList.currentItem != undefined) {
@@ -198,7 +198,7 @@ Item {
198198 }
199199
200200 function test_lens_mapping(data) {
201− dash_content.setCurrentLensAtIndex(data.index, true, false);
201+ dashContent.setCurrentLensAtIndex(data.index, true, false);
202202 tryCompareFunction(get_current_item_object_name, data.objectName)
203203 }
204204