Add file and lineno parameters to warn() method
authorCharles Yin <charles.yin@nokia.com>
Thu, 20 Oct 2011 05:27:37 +0000 (15:27 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 21 Oct 2011 06:47:29 +0000 (08:47 +0200)
Change-Id: I1ddfd4793a26a16bf85b72c50d84080cd0b26a87
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>

src/imports/testlib/TestCase.qml
src/qmltest/quicktestresult.cpp
src/qmltest/quicktestresult_p.h

index fd04c78..432f96c 100644 (file)
@@ -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) {
index 1924be0..7d8080f 100644 (file)
@@ -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)
index 8707b56..fdadf9c 100644 (file)
@@ -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);