feat(utils.spec.qml): add test on openConfirmDialog

This commit is contained in:
Ronan Abhamon 2016-10-20 14:34:18 +02:00
parent 91ddaaa69c
commit 32dc83545e
3 changed files with 25 additions and 3 deletions

View file

@ -7,6 +7,7 @@
RESOURCES_FILE='resources.qrc'
TEST_RUNNER='qmltestrunner-qt5'
TEST_FILE_EXTENSION='spec.qml'
MODULES_PATH='./ui/modules'
RED='\e[1;31m'
GREEN='\e[1;32m'
@ -20,7 +21,7 @@ cd $SCRIPT_DIR/..
printf "${BLUE}Testing scripts lib...${NC}\n"
so_far_so_good=0
$TEST_RUNNER -input './ui/scripts/Utils/utils.spec.qml'
$TEST_RUNNER -import $MODULES_PATH -input './ui/scripts/Utils/utils.spec.qml'
if [[ $? == 0 ]]; then
printf "${GREEN}Done. No error found in scripts lib.\n"
@ -42,7 +43,7 @@ do
if [ -f $spec_qml_file ]; then
printf "${BLUE}Running unit qml tests of '${qml_file}'...${NC}\n"
$TEST_RUNNER -import './ui/modules/' -input "$spec_qml_file"
$TEST_RUNNER -import $MODULES_PATH -input "$spec_qml_file"
if [[ $? == 0 ]]; then
printf "${GREEN}All unit tests have succeeded for '${spec_qml_file}'.\n"

View file

@ -48,12 +48,14 @@ function openWindow (window, parent, options) {
}
object.show()
return object
}
// Display a simple ConfirmDialog component.
// Wrap the openWindow function.
function openConfirmDialog (parent, options) {
openWindow(
return openWindow(
'import QtQuick 2.7;' +
'import Common 1.0;' +
'ConfirmDialog {' +

View file

@ -12,6 +12,25 @@ TestCase {
name: 'UtilsTests'
// Test only if a confirm dialog can be opened.
// The other tests are launched by `ConfirmDialog.spec.qml`.
function test_openConfirmDialog () {
var dialog
try {
dialog = Utils.openConfirmDialog(testCase, {
descriptionText: '',
title: ''
})
} catch (e) {
fail(e)
}
dialog.close()
}
// -----------------------------------------------------------------
function test_snakeToCamel_data () {
return [
{ input: 'foo_bar', output: 'fooBar' },