tests/auto/bic/tst_bic.cpp
branchRCL_3
changeset 14 c0432d11811c
parent 4 3b1da2848fc7
child 30 5dc02b23752f
--- a/tests/auto/bic/tst_bic.cpp	Wed Apr 21 12:15:23 2010 +0300
+++ b/tests/auto/bic/tst_bic.cpp	Wed Apr 21 20:15:53 2010 +0300
@@ -59,6 +59,8 @@
     tst_Bic();
     QBic::Info getCurrentInfo(const QString &libName);
 
+    QHash<QString, QBic::Info> cachedCurrentInfo;
+
 private slots:
     void initTestCase_data();
     void initTestCase();
@@ -119,6 +121,9 @@
     bic.addBlacklistedClass(QLatin1String("QAtomic"));
     bic.addBlacklistedClass(QLatin1String("QBasicAtomic"));
     bic.addBlacklistedClass(QLatin1String("QRegion::QRegionData"));
+    bic.addBlacklistedClass(QLatin1String("QtConcurrent::ThreadEngineSemaphore"));
+    bic.addBlacklistedClass(QLatin1String("QDrawPixmaps::Data"));
+    bic.addBlacklistedClass(QLatin1String("QS60Style"));
 
     /* Jambi-related classes in Designer */
     bic.addBlacklistedClass(QLatin1String("QDesignerLanguageExtension"));
@@ -138,17 +143,22 @@
 
     QTest::newRow("QtCore") << "QtCore";
     QTest::newRow("QtGui") << "QtGui";
-    QTest::newRow("QtScript") << "QtScript";
-    QTest::newRow("QtSql") << "QtSql";
-    QTest::newRow("QtSvg") << "QtSvg";
+
+    QTest::newRow("Qt3Support") << "Qt3Support";
+    QTest::newRow("QtDBus") << "QtDBus";
+    QTest::newRow("QtDesigner") << "QtDesigner";
+    QTest::newRow("QtMultimedia") << "QtMultimedia";
     QTest::newRow("QtNetwork") << "QtNetwork";
     QTest::newRow("QtOpenGL") << "QtOpenGL";
+    QTest::newRow("QtScript") << "QtScript";
+    QTest::newRow("QtScriptTools") << "QtScriptTools";
+    QTest::newRow("QtSql") << "QtSql";
+    QTest::newRow("QtSvg") << "QtSvg";
+    QTest::newRow("QtTest") << "QtTest";
+    QTest::newRow("QtWebKit") << "QtWebKit";
     QTest::newRow("QtXml") << "QtXml";
     QTest::newRow("QtXmlPatterns") << "QtXmlPatterns";
-    QTest::newRow("Qt3Support") << "Qt3Support";
-    QTest::newRow("QtTest") << "QtTest";
-    QTest::newRow("QtDBus") << "QtDBus";
-    QTest::newRow("QtDesigner") << "QtDesigner";
+    QTest::newRow("phonon") << "phonon";
 }
 
 void tst_Bic::initTestCase()
@@ -166,60 +176,49 @@
     QSKIP("Test not implemented for this compiler/platform", SkipAll);
 #else
 
-    QString archFileName400;
-    QString archFileName410;
-    QString archFileName420;
-    QString archFileName430;
-
 #if defined Q_OS_LINUX && defined Q_WS_X11
 # if defined(__powerpc__) && !defined(__powerpc64__)
-    archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-ppc32.txt";
-    archFileName410 = SRCDIR "data/%1.4.1.0.linux-gcc-ppc32.txt";
-    archFileName420 = SRCDIR "data/%1.4.2.0.linux-gcc-ppc32.txt";
+#  define FILESUFFIX "linux-gcc-ppc32"
 # elif defined(__amd64__)
-    archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-amd64.txt";
+#  define FILESUFFIX "linux-gcc-amd64"
 # elif defined(__i386__)
-    archFileName400 = SRCDIR "data/%1.4.0.0.linux-gcc-ia32.txt";
-    archFileName410 = SRCDIR "data/%1.4.1.0.linux-gcc-ia32.txt";
-    archFileName420 = SRCDIR "data/%1.4.2.0.linux-gcc-ia32.txt";
-    archFileName430 = SRCDIR "data/%1.4.3.0.linux-gcc-ia32.txt";
+#  define FILESUFFIX "linux-gcc-ia32"
 # endif
-#elif defined Q_OS_AIX
-    if (sizeof(void*) == 4)
-        archFileName400 = SRCDIR "data/%1.4.0.0.aix-gcc-power32.txt";
 #elif defined Q_OS_MAC && defined(__powerpc__)
-    archFileName400 = SRCDIR "data/%1.4.0.0.macx-gcc-ppc32.txt";
-    archFileName410 = SRCDIR "data/%1.4.1.0.macx-gcc-ppc32.txt";
-    archFileName420 = SRCDIR "data/%1.4.2.0.macx-gcc-ppc32.txt";
+#  define FILESUFFIX "macx-gcc-ppc32"
 #elif defined Q_OS_MAC && defined(__i386__)
-    archFileName410 = SRCDIR "data/%1.4.1.0.macx-gcc-ia32.txt";
-    archFileName420 = SRCDIR "data/%1.4.2.0.macx-gcc-ia32.txt";
+#  define FILESUFFIX "macx-gcc-ia32"
+#elif defined Q_OS_MAC && defined(__amd64__)
+#  define FILESUFFIX "macx-gcc-amd64";
 #elif defined Q_OS_WIN && defined Q_CC_GNU
-    archFileName410 = SRCDIR "data/%1.4.1.0.win32-gcc-ia32.txt";
-    archFileName420 = SRCDIR "data/%1.4.2.0.win32-gcc-ia32.txt";
+#  define FILESUFFIX "win32-gcc-ia32"
+#else
+#  define FILESUFFIX "nonsuch"
+    QSKIP("No reference files found for this platform", SkipAll);
 #endif
 
-    if (archFileName400.isEmpty() && archFileName410.isEmpty()
-        && archFileName420.isEmpty())
-        QSKIP("No reference files found for this platform", SkipAll);
-
-    bool isPatchRelease400 = false;
-    bool isPatchRelease410 = false;
-    bool isPatchRelease420 = false;
-    bool isPatchRelease430 = false;
-
     QTest::addColumn<QString>("oldLib");
     QTest::addColumn<bool>("isPatchRelease");
 
-    QTest::newRow("4.0") << archFileName400 << isPatchRelease400;
-    QTest::newRow("4.1") << archFileName410 << isPatchRelease410;
-    QTest::newRow("4.2") << archFileName420 << isPatchRelease420;
-    QTest::newRow("4.3") << archFileName430 << isPatchRelease430;
+    int minor = (QT_VERSION >> 8) & 0xFF;
+    int patch = QT_VERSION & 0xFF;
+    for (int i = 0; i <= minor; ++i) {
+        if (i != minor || patch)
+            QTest::newRow("4." + QByteArray::number(i))
+                << (QString(SRCDIR "data/%1.4.")
+                    + QString::number(i)
+                    + QString(".0." FILESUFFIX ".txt"))
+                << (i == minor && patch);
+    }
 #endif
 }
 
 QBic::Info tst_Bic::getCurrentInfo(const QString &libName)
 {
+    QBic::Info &inf = cachedCurrentInfo[libName];
+    if (!inf.classSizes.isEmpty())
+        return inf;
+
     QTemporaryFile tmpQFile;
     tmpQFile.open();
     QString tmpFileName = tmpQFile.fileName();
@@ -279,7 +278,7 @@
     }
 
     QString resultFileName = files.first();
-    QBic::Info inf = bic.parseFile(resultFileName);
+    inf = bic.parseFile(resultFileName);
 
     QFile::remove(resultFileName);
     tmpQFile.close();
@@ -317,10 +316,14 @@
     }
 
     if (!diff.modifiedVTables.isEmpty()) {
-        foreach(QStringPair entry, diff.modifiedVTables)
-            qWarning() << "modified VTable:\n    Old: " << entry.first
-                       << "\n    New: " << entry.second;
-        isFailed = true;
+        if (diff.modifiedVTables.size() != 1 ||
+            strcmp(QTest::currentDataTag(), "4.4") != 0 ||
+            diff.modifiedVTables.at(0).first != "QGraphicsProxyWidget") {
+            foreach(QStringPair entry, diff.modifiedVTables)
+                qWarning() << "modified VTable:\n    Old: " << entry.first
+                           << "\n    New: " << entry.second;
+            isFailed = true;
+        }
     }
 
     if (isPatchRelease && !diff.addedVTables.isEmpty()) {