diff --git a/tests/ui/scripts/utils.js b/tests/ui/scripts/utils.js index 9b1592518..b64b996c6 100644 --- a/tests/ui/scripts/utils.js +++ b/tests/ui/scripts/utils.js @@ -10,44 +10,44 @@ // // If exitHandler is used, window must implement exitStatus signal. function openWindow (window, parent, options) { - var object + var object - if (options && options.isString) { - object = Qt.createQmlObject(window, parent) - } else { - var component = Qt.createComponent( - 'qrc:/ui/views/' + window + '.qml' - ) + if (options && options.isString) { + object = Qt.createQmlObject(window, parent) + } else { + var component = Qt.createComponent( + 'qrc:/ui/views/' + window + '.qml' + ) - if (component.status !== Component.Ready) { - console.debug('Window not ready.') - if(component.status === Component.Error) { - console.debug('Error:' + component.errorString()) - } - return // Error. - } - - object = component.createObject(parent) + if (component.status !== Component.Ready) { + console.debug('Window not ready.') + if(component.status === Component.Error) { + console.debug('Error:' + component.errorString()) + } + return // Error. } - console.debug('Open window.') + object = component.createObject(parent) + } - object.closing.connect(function () { - console.debug('Destroy window.') - object.destroy() - }) - object.exitStatus.connect(function (status) { - console.debug('Exit status: ' + status) - }) + console.debug('Open window.') - if (options && options.exitHandler) { - object.exitStatus.connect( - // Bind to access parent properties. - options.exitHandler.bind(parent) - ) - } + object.closing.connect(function () { + console.debug('Destroy window.') + object.destroy() + }) + object.exitStatus.connect(function (status) { + console.debug('Exit status: ' + status) + }) - object.show() + if (options && options.exitHandler) { + object.exitStatus.connect( + // Bind to access parent properties. + options.exitHandler.bind(parent) + ) + } + + object.show() } // ------------------------------------------------------------------- @@ -55,24 +55,24 @@ function openWindow (window, parent, options) { // Display a simple ConfirmDialog component. // Wrap the openWindow function. function openConfirmDialog (parent, options) { - openWindow( - 'import QtQuick 2.7;' + - 'import \'qrc:/ui/Linphone/Dialog\';' + - 'ConfirmDialog {' + - 'descriptionText: \'' + options.descriptionText + '\';' + - 'title: \'' + options.title + '\'' + - '}', - parent, { - isString: true, - exitHandler: options.exitHandler - } - ) + openWindow( + 'import QtQuick 2.7;' + + 'import \'qrc:/ui/modules/Linphone/Dialog\';' + + 'ConfirmDialog {' + + 'descriptionText: \'' + options.descriptionText + '\';' + + 'title: \'' + options.title + '\'' + + '}', + parent, { + isString: true, + exitHandler: options.exitHandler + } + ) } // ------------------------------------------------------------------- function snakeToCamel (s) { - return s.replace(/(\_\w)/g, function (matches) { - return matches[1].toUpperCase() - }) + return s.replace(/(\_\w)/g, function (matches) { + return matches[1].toUpperCase() + }) }