Commit 37e7954c authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): fix code style in spec files

parent 7b99d70d
...@@ -6,25 +6,6 @@ import QtTest 1.1 ...@@ -6,25 +6,6 @@ import QtTest 1.1
TestCase { TestCase {
id: testCase id: testCase
name: 'ConfirmDialogTests'
Component {
id: builder
Item {
ConfirmDialog {
id: confirmDialog
}
SignalSpy {
id: spy
signalName: 'exitStatus'
target: confirmDialog
}
}
}
function buildConfirmDialog () { function buildConfirmDialog () {
var container = builder.createObject(testCase) var container = builder.createObject(testCase)
verify(container) verify(container)
...@@ -35,6 +16,8 @@ TestCase { ...@@ -35,6 +16,8 @@ TestCase {
return container return container
} }
// -----------------------------------------------------------------
function test_exitStatusViaButtons_data () { function test_exitStatusViaButtons_data () {
return [ return [
{ button: 0, expectedStatus: 0 }, { button: 0, expectedStatus: 0 },
...@@ -52,6 +35,8 @@ TestCase { ...@@ -52,6 +35,8 @@ TestCase {
compare(spy.signalArguments[0][0], data.expectedStatus) compare(spy.signalArguments[0][0], data.expectedStatus)
} }
// -----------------------------------------------------------------
function test_exitStatusViaClose () { function test_exitStatusViaClose () {
var container = buildConfirmDialog() var container = buildConfirmDialog()
var dialog = container.data[0] var dialog = container.data[0]
...@@ -61,4 +46,23 @@ TestCase { ...@@ -61,4 +46,23 @@ TestCase {
spy.wait(100) spy.wait(100)
compare(spy.signalArguments[0][0], 0) compare(spy.signalArguments[0][0], 0)
} }
// -----------------------------------------------------------------
Component {
id: builder
Item {
ConfirmDialog {
id: confirmDialog
}
SignalSpy {
id: spy
signalName: 'exitStatus'
target: confirmDialog
}
}
}
} }
...@@ -6,6 +6,14 @@ import QtTest 1.1 ...@@ -6,6 +6,14 @@ import QtTest 1.1
Item { Item {
id: root id: root
function buildExclusiveButtons (defaultSelectedButton) {
var container = builder.createObject(root)
testCase.verify(container)
container.data[0].selectedButton = defaultSelectedButton
return container
}
// Avoid `Test 'XXX' has invalid size QSize(0, 0), resizing.` warning. // Avoid `Test 'XXX' has invalid size QSize(0, 0), resizing.` warning.
height: 100 height: 100
width: 300 width: 300
...@@ -35,17 +43,10 @@ Item { ...@@ -35,17 +43,10 @@ Item {
} }
} }
function buildExclusiveButtons (defaultSelectedButton) { // -----------------------------------------------------------------
var container = builder.createObject(root)
testCase.verify(container)
container.data[0].selectedButton = defaultSelectedButton
return container
}
TestCase { TestCase {
id: testCase id: testCase
name: 'ExclusiveButtonsTests'
when: windowShown when: windowShown
function test_signals_data () { function test_signals_data () {
......
...@@ -88,7 +88,7 @@ Rectangle { ...@@ -88,7 +88,7 @@ Rectangle {
{ x: item.x + item.width - 1, y: item.y }, { x: item.x + item.width - 1, y: item.y },
{ x: item.x, y: item.y + item.height - 1}, { x: item.x, y: item.y + item.height - 1},
{ x: item.x + item.width - 1, y: item.y + item.height - 1 }, { x: item.x + item.width - 1, y: item.y + item.height - 1 },
{ } // item center. { } // (x, y) = item center.
] ]
} }
......
...@@ -10,8 +10,6 @@ import './utils.js' as Utils ...@@ -10,8 +10,6 @@ import './utils.js' as Utils
TestCase { TestCase {
id: testCase id: testCase
name: 'UtilsTests'
// Test only if a confirm dialog can be opened. // Test only if a confirm dialog can be opened.
// The other tests are launched by `ConfirmDialog.spec.qml`. // The other tests are launched by `ConfirmDialog.spec.qml`.
function test_openConfirmDialog () { function test_openConfirmDialog () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment