Clean up qmltest code
authorCharles Yin <yinyunqiao@gmail.com>
Wed, 18 Apr 2012 11:01:57 +0000 (21:01 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 19 Apr 2012 02:55:38 +0000 (04:55 +0200)
1. Remove qmlviewer related code from TestCase.qml
2. util.wrapper is no longer used

Change-Id: I17d9198a7871762da07a790700d69504b8226c48
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/imports/testlib/TestCase.qml
src/imports/testlib/main.cpp

index 371bba9..41e1686 100644 (file)
@@ -66,10 +66,7 @@ Item {
     // other test failed which this one depends on).
     property bool optional: false
 
-    // Property that is set to true when the main window is shown.
-    // We need to set the property value in an odd way to handle
-    // both qmlviewer and the QtQuickTest module test wrapper.
-    property bool windowShown: util.wrapper ? qtest.windowShown : false
+    property bool windowShown: qtest.windowShown
 
     // Internal private state.  Identifiers prefixed with qtest are reserved.
     property bool qtest_prevWhen: true
@@ -688,15 +685,6 @@ Item {
         }
     }
 
-    // The test framework will set util.windowShown when the
-    // window is actually shown.  If we are running with qmlviewer,
-    // then this won't happen.  So we use a timer instead.
-    Timer {
-        id: qtest_windowShowTimer
-        interval: 100
-        repeat: false
-        onTriggered: { windowShown = true }
-    }
 
     Component.onCompleted: {
         qtest.hasTestCase = true;
@@ -724,9 +712,6 @@ Item {
         if (optional)
             TestLogger.log_optional_test(qtest_testId)
         qtest_prevWhen = when
-        var isQmlViewer = util.wrapper ? false : true
-        if (isQmlViewer)
-            qtest_windowShowTimer.running = true
         if (when && !completed && !running)
             qtest_run()
     }
index 18039e7..459d34f 100644 (file)
@@ -62,7 +62,6 @@ class QuickTestUtil : public QObject
 {
     Q_OBJECT
     Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged)
-    Q_PROPERTY(bool wrapper READ wrapper NOTIFY wrapperChanged)
     Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged)
 public:
     QuickTestUtil(QObject *parent = 0)
@@ -75,15 +74,10 @@ public:
     {
         return QTest::printAvailableFunctions;
     }
-    bool wrapper() const
-    {
-        return true;
-    }
     int dragThreshold() const { return qApp->styleHints()->startDragDistance(); }
 
 Q_SIGNALS:
     void printAvailableFunctionsChanged();
-    void wrapperChanged();
     void dragThresholdChanged();
 
 public Q_SLOTS:
@@ -91,7 +85,6 @@ public Q_SLOTS:
     QQmlV8Handle typeName(const QVariant& v) const
     {
         QString name(v.typeName());
-        //qDebug() << "type:" << name  << " string value:" << v.toString() << " value:" << v;
         if (v.canConvert<QObject*>()) {
             QQmlType *type = 0;
             const QMetaObject *mo = v.value<QObject*>()->metaObject();