aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/testlib
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-04-05 10:17:34 +1000
committerQt by Nokia <qt-info@nokia.com>2012-04-05 05:14:56 +0200
commit82a048c3cff06dd6e9a97a72d235decb1a39e1c3 (patch)
treed10fa98238eb3b59d0752ec5dfb120ed6db07213 /src/imports/testlib
parent95cb2a1b5caf7d7158dd1176380c1458ea22b54f (diff)
Fix some issues with init_data() for qmltest
1. should not use hasOwnProperty, replace it with 'in' 2. the default init_data() method is unnessary 3. when init_data() returns empty, the test function should run in non data driven mode Change-Id: I8cb19d3499b285d07c8b3d04abd9ddf33b1c5395 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/imports/testlib')
-rw-r--r--src/imports/testlib/TestCase.qml13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 694c01a710..371bba9fde 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -475,7 +475,6 @@ Item {
function cleanupTestCase() {}
function init() {}
function cleanup() {}
- function init_data() {}
function qtest_runInternal(prop, arg) {
try {
@@ -609,7 +608,7 @@ Item {
}
qtest_results.functionName = prop
- if (!testCase.hasOwnProperty(datafunc))
+ if (!(datafunc in testCase))
datafunc = "init_data";
if (datafunc in testCase) {
@@ -629,9 +628,13 @@ Item {
qtest_runFunction(prop, row)
qtest_results.dataTag = ""
}
- if (!haveData && datafunc != "init_data")
- qtest_results.warn("no data supplied for " + prop + "() by " + datafunc + "()"
- , util.callerFile(), util.callerLine());
+ if (!haveData) {
+ if (datafunc === "init_data")
+ qtest_runFunction(prop, null, isBenchmark)
+ else
+ qtest_results.warn("no data supplied for " + prop + "() by " + datafunc + "()"
+ , util.callerFile(), util.callerLine());
+ }
qtest_results.clearTestTable()
}
} else if (isBenchmark) {