Merge lp:~fginther/sudoku-app/wipe-storage-before-testing into lp:sudoku-app
- wipe-storage-before-testing
- Merge into trunk
Proposed by
Francis Ginther
Status: | Merged |
---|---|
Merged at revision: | 111 |
Proposed branch: | lp:~fginther/sudoku-app/wipe-storage-before-testing |
Merge into: | lp:sudoku-app |
Diff against target: |
428 lines (+105/-44) 5 files modified
components/SudokuBlocksGrid.qml (+15/-19) components/SudokuButtonsGrid.qml (+4/-1) js/localStorage.js (+1/-0) sudoku-app.qml (+52/-24) tests/autopilot/sudoku_app/tests/__init__.py (+33/-0) |
To merge this branch: | bzr merge lp:~fginther/sudoku-app/wipe-storage-before-testing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Sudoku Touch developers | Pending | ||
Review via email: mp+183227@code.launchpad.net |
Commit message
Wipe local storage before running test.
Description of the change
Wipe local storage before running test.
PLEASE DO NOT APPROVE, USING THIS TO GATHER JENKINS FEEDBACK.
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'components/SudokuBlocksGrid.qml' |
2 | --- components/SudokuBlocksGrid.qml 2013-08-21 12:35:38 +0000 |
3 | +++ components/SudokuBlocksGrid.qml 2013-08-30 16:17:49 +0000 |
4 | @@ -1,7 +1,6 @@ |
5 | import QtQuick 2.0 |
6 | import Ubuntu.Components 0.1 |
7 | import Ubuntu.Components.Popups 0.1 |
8 | - |
9 | import "../js/SudokuCU.js" as SudokuCU |
10 | |
11 | Column { |
12 | @@ -36,7 +35,7 @@ |
13 | property var solution; |
14 | property bool alreadyCreated: mainView.alreadyCreated; |
15 | property bool checkIfCheating: false; |
16 | - property real blockSize: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/10: units.gu(50)/10; |
17 | + property real blockSize: mainView.width/mainView.height < 0.6 ? mainView.width/10: units.gu(50)/10; |
18 | |
19 | // ********* SCORES ENGINE VARIABLES *************** |
20 | |
21 | @@ -216,13 +215,17 @@ |
22 | } |
23 | } |
24 | mainView.alreadyCreated = true; |
25 | - gameTimer.restart(); |
26 | + if (gameTimer.running == true) |
27 | + gameTimer.restart(); |
28 | + else |
29 | + gameTimer.start(); |
30 | resetScore(); |
31 | } |
32 | |
33 | function checkIfGameFinished() { |
34 | //print (checkIfAllFieldsFilled()); |
35 | //print (checkIfAllFieldsCorrect()); |
36 | + //print("game finished") |
37 | return checkIfAllFieldsFilled() && checkIfAllFieldsCorrect(); |
38 | } |
39 | |
40 | @@ -255,6 +258,7 @@ |
41 | interval: 1000; |
42 | onTriggered: { |
43 | gameSeconds++; |
44 | + //print(gameSeconds, numberOfActions, numberOfHints, calculateScore()) |
45 | } |
46 | } |
47 | |
48 | @@ -286,6 +290,9 @@ |
49 | randomnumber += 17; |
50 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
51 | break; |
52 | + case 4: |
53 | + PopupUtils.open(newGameComponent); |
54 | + break; |
55 | } |
56 | } |
57 | |
58 | @@ -322,7 +329,7 @@ |
59 | SudokuDialogButton{ |
60 | id: clearButton |
61 | buttonText: i18n.tr("Clear") |
62 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth*2/3: units.gu(50)*2/3 |
63 | + width: mainView.width/mainView.height < 0.6 ? mainView.width*2/3: units.gu(50)*2/3 |
64 | size: units.gu(5) |
65 | //anchors.left: parent.left; |
66 | //anchors.horizontalCenter: parent |
67 | @@ -381,7 +388,8 @@ |
68 | |
69 | if (checkIfGameFinished()) { |
70 | gameFinishedRectangle.visible = true; |
71 | - Settings.insertNewScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
72 | + //Settings.insertNewScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
73 | + mainView.insertNewGameScore(currentUserId, sudokuBlocksGrid.calculateScore()) |
74 | gameFinishedText.text = i18n.tr("You are a cheat... \nBut we give you\n") |
75 | + sudokuBlocksGrid.calculateScore() |
76 | + " " + i18n.tr("points.") |
77 | @@ -390,19 +398,7 @@ |
78 | print (sudokuBlocksGrid.numberOfHints) |
79 | print (sudokuBlocksGrid.gameSeconds) |
80 | print (sudokuBlocksGrid.gameDifficulty) |
81 | - var allScores = Settings.getAllScores() |
82 | - highscoresModel.clear(); |
83 | - highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>"); |
84 | - for(var i = 0; i < allScores.length; i++) { |
85 | - var rowItem = allScores[i]; |
86 | - print("ROW ",rowItem) |
87 | - var firstName = Settings.getUserFirstName(rowItem[0]); |
88 | - var lastName = Settings.getUserLastName(rowItem[0]); |
89 | - //res.push([dbItem.first_name, dbItem.last_name, dbItem.score]) |
90 | - highscoresModel.append({'firstname': firstName, |
91 | - 'lastname': lastName, |
92 | - 'score': rowItem[1] }); |
93 | - } |
94 | + |
95 | winTimer.restart(); |
96 | } |
97 | } |
98 | @@ -413,7 +409,7 @@ |
99 | |
100 | SudokuDialogButton{ |
101 | buttonText: i18n.tr("Cancel") |
102 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth*2/3: units.gu(50)*2/3 |
103 | + width: mainView.width/mainView.height < 0.6 ? mainView.width*2/3: units.gu(50)*2/3 |
104 | size: units.gu(5) |
105 | //anchors.left: parent.left; |
106 | //anchors.horizontalCenter: parent |
107 | |
108 | === modified file 'components/SudokuButtonsGrid.qml' |
109 | --- components/SudokuButtonsGrid.qml 2013-08-21 12:35:38 +0000 |
110 | +++ components/SudokuButtonsGrid.qml 2013-08-30 16:17:49 +0000 |
111 | @@ -54,7 +54,7 @@ |
112 | buttonText: "0"; |
113 | //width: units.gu(5); |
114 | //height: units.gu(5); |
115 | - size: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/10: units.gu(50)/10; |
116 | + size: mainView.width/mainView.height < 0.6 ? mainView.width/10: units.gu(50)/10; |
117 | //color: defaultColor; |
118 | //border.width: 0 |
119 | //border.color: defaultBorderColor |
120 | @@ -143,6 +143,9 @@ |
121 | randomnumber += 17; |
122 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
123 | break; |
124 | + case 4: |
125 | + PopupUtils.open(newGameComponent); |
126 | + break; |
127 | } |
128 | } |
129 | |
130 | |
131 | === modified file 'js/localStorage.js' |
132 | --- js/localStorage.js 2013-07-09 14:04:43 +0000 |
133 | +++ js/localStorage.js 2013-08-30 16:17:49 +0000 |
134 | @@ -1,5 +1,6 @@ |
135 | // Database operations file. Borrowed from |
136 | // UbuntuPhoneRedditApp |
137 | +//.import QtQuick.LocalStorage 2.0 as LocalStorage |
138 | |
139 | function getDatabase() { |
140 | return LocalStorage.openDatabaseSync("SudokuTouch", "1.0", "StorageDatabase", 1000000); |
141 | |
142 | === modified file 'sudoku-app.qml' |
143 | --- sudoku-app.qml 2013-08-23 14:51:04 +0000 |
144 | +++ sudoku-app.qml 2013-08-30 16:17:49 +0000 |
145 | @@ -14,10 +14,7 @@ |
146 | objectName: "sudoku" |
147 | applicationName: "sudoku-app" |
148 | |
149 | - property real pageWidth: units.gu(40); |
150 | - property real pageHeight: units.gu(71); |
151 | - |
152 | - property real blockDistance: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/200: units.gu(60)/200; |
153 | + property real blockDistance: mainView.width/mainView.height < 0.6 ? mainView.width/200: units.gu(50)/200; |
154 | property bool alreadyCreated: false; |
155 | property bool gridLoaded: false; |
156 | property int currentUserId: -1; |
157 | @@ -28,8 +25,8 @@ |
158 | |
159 | property int editUserId : -1; |
160 | |
161 | - width: units.gu(40); |
162 | - height: units.gu(71); |
163 | + width: units.gu(41); |
164 | + height: units.gu(70); |
165 | |
166 | //headerColor: sudokuBlocksGrid.headerColor |
167 | //backgroundColor: sudokuBlocksGrid.backgroundColor |
168 | @@ -184,6 +181,26 @@ |
169 | Settings.setSetting("currentUserId", currentUserId) |
170 | } |
171 | |
172 | + function insertNewGameScore(userId, score) { |
173 | + Settings.insertNewScore(userId, score) |
174 | + } |
175 | + |
176 | + function updatehighScores() { |
177 | + var allScores = Settings.getAllScores() |
178 | + highscoresModel.clear(); |
179 | + highscoresHeaderText = i18n.tr("<b>Best scores for all players</b>"); |
180 | + for(var i = 0; i < allScores.length; i++) { |
181 | + var rowItem = allScores[i]; |
182 | + print("ROW ",rowItem) |
183 | + var firstName = Settings.getUserFirstName(rowItem[0]); |
184 | + var lastName = Settings.getUserLastName(rowItem[0]); |
185 | + //res.push([dbItem.first_name, dbItem.last_name, dbItem.score]) |
186 | + highscoresModel.append({'firstname': firstName, |
187 | + 'lastname': lastName, |
188 | + 'score': rowItem[1] }); |
189 | + } |
190 | + } |
191 | + |
192 | function revealHint() { |
193 | if(disableHints.checked) |
194 | { |
195 | @@ -245,8 +262,6 @@ |
196 | } |
197 | |
198 | function newSize(widthn, heightn) { |
199 | - pageWidth = widthn; |
200 | - pageHeight = heightn; |
201 | width = widthn |
202 | height = heightn |
203 | //print(height," x ", width); |
204 | @@ -320,7 +335,7 @@ |
205 | objectName: "easyGameButton" |
206 | buttonText: i18n.tr("Easy") |
207 | opacity: 0.8 |
208 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/4: units.gu(50)/4; |
209 | + width: mainView.width/mainView.height < 0.6 ? mainView.width/4: units.gu(50)/4; |
210 | height: width |
211 | onTriggered: { |
212 | //print("EASY") |
213 | @@ -328,6 +343,7 @@ |
214 | randomnumber += 31; |
215 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
216 | PopupUtils.close(newGameDialogue) |
217 | + sudokuBlocksGrid.gameDifficulty = 0 |
218 | toolbar.opened = false; |
219 | } |
220 | } |
221 | @@ -336,7 +352,7 @@ |
222 | objectName: "moderateGameButton" |
223 | buttonText: i18n.tr("Moderate") |
224 | opacity: 0.8 |
225 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/4: units.gu(50)/4; |
226 | + width: mainView.width/mainView.height < 0.6 ? mainView.width/4: units.gu(50)/4; |
227 | height: width |
228 | onTriggered: { |
229 | //print("EASY") |
230 | @@ -344,6 +360,7 @@ |
231 | randomnumber += 26; |
232 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
233 | PopupUtils.close(newGameDialogue) |
234 | + sudokuBlocksGrid.gameDifficulty = 1 |
235 | toolbar.opened = false; |
236 | } |
237 | } |
238 | @@ -352,7 +369,7 @@ |
239 | objectName: "hardGameButton" |
240 | buttonText: i18n.tr("Hard") |
241 | opacity: 0.8 |
242 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/4: units.gu(50)/4; |
243 | + width: mainView.width/mainView.height < 0.6 ? mainView.width/4: units.gu(50)/4; |
244 | height: width |
245 | onTriggered: { |
246 | //print("EASY") |
247 | @@ -360,6 +377,7 @@ |
248 | randomnumber += 21; |
249 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
250 | PopupUtils.close(newGameDialogue) |
251 | + sudokuBlocksGrid.gameDifficulty = 2 |
252 | toolbar.opened = false; |
253 | } |
254 | } |
255 | @@ -368,7 +386,7 @@ |
256 | objectName: "ultrahardGameButton" |
257 | buttonText: i18n.tr("Ultra\nHard") |
258 | opacity: 0.8 |
259 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/4: units.gu(50)/4; |
260 | + width: mainView.width/mainView.height < 0.6 ? mainView.width/4: units.gu(50)/4; |
261 | height: width |
262 | onTriggered: { |
263 | //print("EASY") |
264 | @@ -376,6 +394,7 @@ |
265 | randomnumber += 17; |
266 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
267 | PopupUtils.close(newGameDialogue) |
268 | + sudokuBlocksGrid.gameDifficulty = 3 |
269 | toolbar.opened = false; |
270 | } |
271 | } |
272 | @@ -384,7 +403,7 @@ |
273 | |
274 | SudokuDialogButton{ |
275 | buttonText: i18n.tr("Cancel") |
276 | - width: mainView.width/mainView.height < 0.6 ? mainView.pageWidth*2/3: units.gu(50)*2/3 |
277 | + width: mainView.width/mainView.height < 0.6 ? mainView.width*2/3: units.gu(50)*2/3 |
278 | size: units.gu(5) |
279 | buttonColor: sudokuBlocksGrid.dialogButtonColor1 |
280 | textColor: sudokuBlocksGrid.dialogButtonTextColor |
281 | @@ -460,6 +479,9 @@ |
282 | { |
283 | currentUserId = Settings.getSetting("currentUserId") |
284 | } |
285 | + if (difficultySelector.selectedIndex == 4) { |
286 | + PopupUtils.open(newGameComponent) |
287 | + } |
288 | |
289 | } |
290 | |
291 | @@ -502,6 +524,9 @@ |
292 | randomnumber += 17; |
293 | sudokuBlocksGrid.createNewGame(81 - randomnumber); |
294 | break; |
295 | + case 4: |
296 | + PopupUtils.open(newGameComponent); |
297 | + break; |
298 | } |
299 | } |
300 | |
301 | @@ -516,11 +541,11 @@ |
302 | height: units.gu(15); |
303 | z: 100; |
304 | visible: false; |
305 | - x: mainView.pageWidth / 2 - width/2; |
306 | - y: mainView.pageHeight / 2 - height/2; |
307 | + //x: mainView.width / 2 - width/2; |
308 | + //y: mainView.weight / 2 - height/2; |
309 | //anchors.verticalCenter: mainView.verticalCenter; |
310 | //anchors.horizontalCenter: mainView.verticalCenter; |
311 | - //anchors.centerIn: mainView; |
312 | + anchors.centerIn: parent; |
313 | //y: units.gu(5); |
314 | Label { |
315 | id: gameFinishedText; |
316 | @@ -528,6 +553,7 @@ |
317 | color: sudokuBlocksGrid.defaultHintColor; |
318 | anchors.centerIn: parent; |
319 | fontSize: "large"; |
320 | + horizontalAlignment: Text.AlignHCenter |
321 | } |
322 | } |
323 | |
324 | @@ -590,17 +616,19 @@ |
325 | |
326 | Grid { |
327 | id: informationRow; |
328 | - y: 7*mainView.pageHeight/10; |
329 | + //y: 7*mainView.pageHeight/10; |
330 | //x: units.dp(8); |
331 | //width: mainView.pageWidth - units.dp(8); |
332 | anchors.horizontalCenter: parent.horizontalCenter |
333 | + anchors.top: parent.top |
334 | + anchors.topMargin: 9*sudokuBlocksGrid.blockSize + 35*sudokuBlocksGrid.blockDistance |
335 | columns: 3 |
336 | columnSpacing: mainView.width/mainView.height < 0.6 ? mainView.width/6 : units.gu(50)/6 |
337 | UbuntuShape { |
338 | id: redFlag |
339 | color: sudokuBlocksGrid.defaultNotAllowedColor |
340 | - width: mainView.width/mainView.height < 0.6 ? 2*mainView.pageWidth/10: 2*units.gu(50)/10 |
341 | - height: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/10: units.gu(50)/10 |
342 | + width: mainView.width/mainView.height < 0.6 ? 2*mainView.width/10: 2*units.gu(50)/10 |
343 | + height: mainView.width/mainView.height < 0.6 ? mainView.width/10: units.gu(50)/10 |
344 | //border.color: defaultBorderColor |
345 | //radius: "medium" |
346 | Label { |
347 | @@ -620,8 +648,8 @@ |
348 | id: blueFlag |
349 | color: sudokuBlocksGrid.defaultStartingColor |
350 | //border.color: defaultBorderColor |
351 | - width: mainView.width/mainView.height < 0.6 ? 2*mainView.pageWidth/10: 2*units.gu(50)/10 |
352 | - height: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/10: units.gu(50)/10 |
353 | + width: mainView.width/mainView.height < 0.6 ? 2*mainView.width/10: 2*units.gu(50)/10 |
354 | + height: mainView.width/mainView.height < 0.6 ? mainView.width/10: units.gu(50)/10 |
355 | //radius: "medium"; |
356 | Label { |
357 | id: blueFlagText |
358 | @@ -641,8 +669,8 @@ |
359 | id: orangeFlag |
360 | color: sudokuBlocksGrid.defaultHintColor |
361 | //border.color: defaultBorderColor |
362 | - width: mainView.width/mainView.height < 0.6 ? 2*mainView.pageWidth/10: 2*units.gu(50)/10 |
363 | - height: mainView.width/mainView.height < 0.6 ? mainView.pageWidth/10: units.gu(50)/10 |
364 | + width: mainView.width/mainView.height < 0.6 ? 2*mainView.width/10: 2*units.gu(50)/10 |
365 | + height: mainView.width/mainView.height < 0.6 ? mainView.width/10: units.gu(50)/10 |
366 | //radius: "medium"; |
367 | Label { |
368 | text: i18n.tr("Hinted blocks") |
369 | @@ -668,7 +696,7 @@ |
370 | Tab { |
371 | id: highscoresTab |
372 | objectName: "highscoresTab" |
373 | - title: i18n.tr("Best Scores") |
374 | + title: i18n.tr("Scores") |
375 | page: Page { |
376 | tools: ToolbarItems { |
377 | ToolbarButton { |
378 | |
379 | === modified file 'tests/autopilot/sudoku_app/tests/__init__.py' |
380 | --- tests/autopilot/sudoku_app/tests/__init__.py 2013-07-11 16:46:16 +0000 |
381 | +++ tests/autopilot/sudoku_app/tests/__init__.py 2013-08-30 16:17:49 +0000 |
382 | @@ -31,6 +31,7 @@ |
383 | local_location = "../../sudoku-app.qml" |
384 | |
385 | def setUp(self): |
386 | + self.clean_db() |
387 | self.pointing_device = Pointer(self.input_device_class.create()) |
388 | super(SudokuTestCase, self).setUp() |
389 | if os.path.exists(self.local_location): |
390 | @@ -51,6 +52,38 @@ |
391 | "--desktop_file_hint=/usr/share/applications/sudoku-app.desktop", |
392 | app_type='qt') |
393 | |
394 | + def find_db(self): |
395 | + dbs_path = os.path.expanduser("~/.local/share/Qt Project/QtQmlViewer/QML/OfflineStorage/Databases/") |
396 | + if not os.path.exists(dbs_path): |
397 | + return None |
398 | + |
399 | + files = [ f for f in os.listdir(dbs_path) if os.path.splitext(f)[1] == ".ini" ] |
400 | + for f in files: |
401 | + ini_path = os.path.join(dbs_path, f) |
402 | + with open(ini_path) as ini: |
403 | + for line in ini: |
404 | + if "=" in line: |
405 | + key, val = line.strip().split("=") |
406 | + if key == "Name" and val == "SudokuTouch": |
407 | + try: |
408 | + return ini_path.replace(".ini", ".sqlite") |
409 | + except OSError: |
410 | + pass |
411 | + return None |
412 | + |
413 | + def clean_db(self): |
414 | + path = self.find_db() |
415 | + if path is None: |
416 | + self.launch_and_quit_app() |
417 | + path = self.find_db() |
418 | + if path is None: |
419 | + self.assertNotEquals(path, None) |
420 | + |
421 | + try: |
422 | + os.remove(path) |
423 | + except OSError: |
424 | + pass |
425 | + |
426 | @property |
427 | def main_window(self): |
428 | return MainWindow(self.app) |
FAILED: Continuous integration, rev:114 91.189. 93.70:8080/ job/sudoku- app-ci/ 15/ 91.189. 93.70:8080/ job/generic- mediumtests/ 110 91.189. 93.70:8080/ job/sudoku- app-precise- amd64-ci/ 15 91.189. 93.70:8080/ job/sudoku- app-quantal- amd64-ci/ 15 91.189. 93.70:8080/ job/sudoku- app-raring- amd64-ci/ 15 91.189. 93.70:8080/ job/sudoku- app-saucy- amd64-ci/ 15
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/sudoku- app-ci/ 15/rebuild
http://