Commit 63482c17 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Dialog/ConfirmDialog): add spec file to test exit statuses

parent 83946431
import QtQuick 2.7
import QtTest 1.1
// ===================================================================
TestCase {
id: testCase
name: 'ConfirmDialogTests'
function createDialog () {
var component = Qt.createComponent(
'./ConfirmDialog.qml'
)
if (component.status !== Component.Ready) {
if(component.status === Component.Error) {
fail('Error:' + component.errorString())
} else {
fail('Dialog not ready.')
}
}
var dialog = component.createObject(testCase)
dialog.closing.connect(dialog.destroy.bind(dialog))
return dialog
}
function test_exitStatusViaButtons_data () {
return [
{ button: 0, expectedStatus: 0 },
{ button: 1, expectedStatus: 1 },
]
}
function test_exitStatusViaButtons (data) {
var dialog = createDialog()
dialog.exitStatus.connect(function (status) {
compare(status, data.expectedStatus)
})
dialog.show()
mouseClick(dialog.buttons[data.button])
}
function test_exitStatusViaClose () {
var dialog = createDialog()
dialog.exitStatus.connect(function (status) {
compare(status, 0)
})
dialog.close()
}
}
......@@ -21,7 +21,7 @@ function openWindow (window, parent, options) {
if (component.status !== Component.Ready) {
console.debug('Window not ready.')
if(component.status === Component.Error) {
if (component.status === Component.Error) {
console.debug('Error:' + component.errorString())
}
return // Error.
......
......@@ -17,7 +17,7 @@ TestCase {
{ input: 'foo_bar', output: 'fooBar' },
{ input: 'george_abitbol', output: 'georgeAbitbol' },
{ input: 'billTremendousAndHubert', output: 'billTremendousAndHubert' },
{ input: 'foo_bAr_BAZ', output: 'fooBArBAZ' },
{ input: 'foo_bAr_BAZ', output: 'fooBArBAZ' }
]
}
......
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