From 0b4a172582dfd3258cf5e426db0f5168061e7fca Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 19 Dec 2016 14:26:52 +0100 Subject: [PATCH] fix(ui/scripts/Utils/utils): Qt (5.7.1) crash when a variable in a js file is compared to null --- tests/ui/modules/Common/InvertedMouseArea.spec.qml | 8 ++++---- tests/ui/scripts/Utils/utils.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/ui/modules/Common/InvertedMouseArea.spec.qml b/tests/ui/modules/Common/InvertedMouseArea.spec.qml index 530d0cc06..5749234e9 100644 --- a/tests/ui/modules/Common/InvertedMouseArea.spec.qml +++ b/tests/ui/modules/Common/InvertedMouseArea.spec.qml @@ -3,7 +3,7 @@ import QtTest 1.1 import Utils 1.0 -// =================================================================== +// ============================================================================= Rectangle { id: root @@ -54,7 +54,7 @@ Rectangle { compare(spy.count, 0, '`pressed` signal was emitted') } - // --------------------------------------------------------------- + // ------------------------------------------------------------------------- function test_randomClickOutsideMouseArea () { Utils.times(50, function () { @@ -80,7 +80,7 @@ Rectangle { }) } - // --------------------------------------------------------------- + // ------------------------------------------------------------------------- function test_clickInsideMouseArea_data () { return [ @@ -98,7 +98,7 @@ Rectangle { compare(spy.count, 0, '`pressed` signal was emitted') } - // --------------------------------------------------------------- + // ------------------------------------------------------------------------- function test_clickOutsideMouseArea_data () { return [ diff --git a/tests/ui/scripts/Utils/utils.js b/tests/ui/scripts/Utils/utils.js index c8e59722a..a901d94f5 100644 --- a/tests/ui/scripts/Utils/utils.js +++ b/tests/ui/scripts/Utils/utils.js @@ -34,7 +34,7 @@ function connectOnce (signal, cb) { function encodeTextToQmlRichFormat (text, options) { var images = '' - if (options == null) { + if (!options) { options = {} } @@ -218,7 +218,7 @@ function setTimeout (parent, delay, cb) { // =================================================================== function _computeOptimizedCb (func, context) { - return (context != null) + return context ? (function () { return func.apply(context, arguments) }) : func