diff options
author | Charles Yin <charles.yin@nokia.com> | 2011-10-20 15:27:37 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-21 08:47:29 +0200 |
commit | d5b86cd36f4c37335589bd5fc3809b47e3bc1944 (patch) | |
tree | 95a53370102ff680939c8244ae8e021e12d558fc /src | |
parent | de2cb161dc9102131be035c6d2b3eea0a29490a6 (diff) |
Add file and lineno parameters to warn() method
Change-Id: I1ddfd4793a26a16bf85b72c50d84080cd0b26a87
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 13 | ||||
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 4 | ||||
-rw-r--r-- | src/qmltest/quicktestresult_p.h | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index fd04c786a2..432f96ccf1 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -271,8 +271,8 @@ Item { } function compare(actual, expected, msg) { - var act = qtest_formatValue(actual) - var exp = qtest_formatValue(expected) + var act = testCase.qtest_formatValue(actual) + var exp = testCase.qtest_formatValue(expected) var success = qtest_compareInternal(actual, expected) if (msg === undefined) { @@ -297,8 +297,8 @@ Item { i += 50 } var actual = obj[prop] - var act = qtest_formatValue(actual) - var exp = qtest_formatValue(value) + var act = testCase.qtest_formatValue(actual) + var exp = testCase.qtest_formatValue(value) var success = qtest_compareInternal(actual, value) if (!qtest_results.compare(success, "property " + prop, act, exp, util.callerFile(), util.callerLine())) throw new Error("QtQuickTest::fail") @@ -348,7 +348,7 @@ Item { function warn(msg) { if (msg === undefined) msg = "" - qtest_results.warn(msg); + qtest_results.warn(msg, util.callerFile(), util.callerLine()); } function ignoreWarning(msg) { @@ -619,7 +619,8 @@ Item { qtest_results.dataTag = "" } if (!haveData) - qtest_results.warn("no data supplied for " + prop + "() by " + datafunc + "()") + qtest_results.warn("no data supplied for " + prop + "() by " + datafunc + "()" + , util.callerFile(), util.callerLine()); qtest_results.clearTestTable() } } else if (isBenchmark) { diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index 1924be0d26..7d8080fc08 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -430,9 +430,9 @@ bool QuickTestResult::expectFailContinue QTest::Continue, qtest_fixFile(file).toLatin1().constData(), line); } -void QuickTestResult::warn(const QString &message) +void QuickTestResult::warn(const QString &message, const QString &file, int line) { - QTestLog::warn(message.toLatin1().constData(), 0, 0); + QTestLog::warn(message.toLatin1().constData(), qtest_fixFile(file).toLatin1().constData(), line); } void QuickTestResult::ignoreWarning(const QString &message) diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index 8707b563e4..fdadf9c3a3 100644 --- a/src/qmltest/quicktestresult_p.h +++ b/src/qmltest/quicktestresult_p.h @@ -134,7 +134,7 @@ public Q_SLOTS: const QString &file, int line); bool expectFailContinue(const QString &tag, const QString &comment, const QString &file, int line); - void warn(const QString &message); + void warn(const QString &message, const QString &file, int line); void ignoreWarning(const QString &message); |