Commit 32dc8354 authored by Ronan Abhamon's avatar Ronan Abhamon

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

parent 91ddaaa6
......@@ -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"
......
......@@ -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 {' +
......
......@@ -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' },
......
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