Title: [119275] trunk/Source/WebKit/qt
Revision
119275
Author
[email protected]
Date
2012-06-01 13:22:27 -0700 (Fri, 01 Jun 2012)

Log Message

[Qt] Fix QObject bridge tests in Qt5 after (not so) recent QVariant changes
https://bugs.webkit.org/show_bug.cgi?id=88127

Reviewed by Noam Rosenthal.

We were checking for invalid QVariants in a very odd way. Since in Qt5 the
userType of invalid changed to not be Void, this broke the tests for QtWebKit
with Qt5. Replace those checks with QVariant::isValid() calls.

* tests/qobjectbridge/tst_qobjectbridge.cpp:
(tst_QObjectBridge::evalJS):
(tst_QObjectBridge::evalJSV):

Modified Paths

Diff

Modified: trunk/Source/WebKit/qt/ChangeLog (119274 => 119275)


--- trunk/Source/WebKit/qt/ChangeLog	2012-06-01 20:20:33 UTC (rev 119274)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-06-01 20:22:27 UTC (rev 119275)
@@ -1,5 +1,20 @@
 2012-06-01  Caio Marcelo de Oliveira Filho  <[email protected]>
 
+        [Qt] Fix QObject bridge tests in Qt5 after (not so) recent QVariant changes
+        https://bugs.webkit.org/show_bug.cgi?id=88127
+
+        Reviewed by Noam Rosenthal.
+
+        We were checking for invalid QVariants in a very odd way. Since in Qt5 the
+        userType of invalid changed to not be Void, this broke the tests for QtWebKit
+        with Qt5. Replace those checks with QVariant::isValid() calls.
+
+        * tests/qobjectbridge/tst_qobjectbridge.cpp:
+        (tst_QObjectBridge::evalJS):
+        (tst_QObjectBridge::evalJSV):
+
+2012-06-01  Caio Marcelo de Oliveira Filho  <[email protected]>
+
         [Qt] Move QObject bridge related tests from tst_qwebframe to tst_qobjectbridge
         https://bugs.webkit.org/show_bug.cgi?id=88117
 

Modified: trunk/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp (119274 => 119275)


--- trunk/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp	2012-06-01 20:20:33 UTC (rev 119274)
+++ trunk/Source/WebKit/qt/tests/qobjectbridge/tst_qobjectbridge.cpp	2012-06-01 20:22:27 UTC (rev 119275)
@@ -656,9 +656,8 @@
 private:
     QString evalJS(const QString& s)
     {
-        // Convert an undefined return variant to the string "undefined"
         QVariant ret = evalJSV(s);
-        if (ret.userType() == QMetaType::Void)
+        if (!ret.isValid())
             return "undefined";
         return ret.toString();
     }
@@ -678,7 +677,6 @@
         // As a special measure, if we get an exception we set the type to 'error'
         // (in ecma, an Error object has typeof object, but qtscript has a convenience function)
         // Similarly, an array is an object, but we'd prefer to have a type of 'array'
-        // Also, consider a QMetaType::Void QVariant to be undefined
         QString escaped = s;
         escaped.replace('\'', "\\'"); // Don't preescape your single quotes!
         QString code("var retvalue; "
@@ -695,7 +693,7 @@
         evalJS(code.arg(escaped));
 
         QVariant ret = evalJSV("retvalue");
-        if (ret.userType() != QMetaType::Void)
+        if (ret.isValid())
             type = evalJS("typevalue");
         else {
             ret = QString("undefined");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to