From db1254131c8d372e1d47acbaaa7c5c2b2be5b7d7 Mon Sep 17 00:00:00 2001
From: Miikka Heikkinen <miikka.heikkinen@digia.com>
Date: Fri, 7 May 2010 11:51:10 +0300
Subject: Fix fetchedRoot test variable to work also in Symbian

RVCT builds cannot seem to be able to deal with data symbols at runtime,
so made accessors for fetchedRoot test variable. Also moved it out
of QFileInfoGatherer class as there is no need to have it there.

Reviewed-by: Janne Koskinen
---
 src/gui/dialogs/qfileinfogatherer.cpp        | 15 +++++++++++++--
 src/gui/dialogs/qfileinfogatherer_p.h        |  3 ---
 tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 16 +++++++++++-----
 3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp
index 3b279ae..af0506f 100644
--- a/src/gui/dialogs/qfileinfogatherer.cpp
+++ b/src/gui/dialogs/qfileinfogatherer.cpp
@@ -55,7 +55,18 @@ QT_BEGIN_NAMESPACE
 
 #ifndef QT_NO_FILESYSTEMMODEL
 
-bool QFileInfoGatherer::fetchedRoot = false;
+#ifdef QT_BUILD_INTERNAL
+static bool fetchedRoot = false;
+Q_AUTOTEST_EXPORT void qt_test_resetFetchedRoot()
+{
+    fetchedRoot = false;
+}
+
+Q_AUTOTEST_EXPORT bool qt_test_isFetchedRoot()
+{
+    return fetchedRoot;
+}
+#endif
 
 /*!
     Creates thread
@@ -278,7 +289,7 @@ void QFileInfoGatherer::getFileInfos(const QString &path, const QStringList &fil
 
     // List drives
     if (path.isEmpty()) {
-#if defined Q_AUTOTEST_EXPORT
+#ifdef QT_BUILD_INTERNAL
         fetchedRoot = true;
 #endif
         QFileInfoList infoList;
diff --git a/src/gui/dialogs/qfileinfogatherer_p.h b/src/gui/dialogs/qfileinfogatherer_p.h
index 5abcd94..8681eb5 100644
--- a/src/gui/dialogs/qfileinfogatherer_p.h
+++ b/src/gui/dialogs/qfileinfogatherer_p.h
@@ -195,9 +195,6 @@ private:
     uint userId;
     uint groupId;
 #endif
-public :
-    //for testing purpose
-    static bool fetchedRoot;
 };
 #endif // QT_NO_FILESYSTEMMODEL
 
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 6bfa8be..eee495f 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -76,6 +76,13 @@
 # define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
 #endif
 
+#if defined QT_BUILD_INTERNAL
+QT_BEGIN_NAMESPACE
+Q_GUI_EXPORT bool qt_test_isFetchedRoot();
+Q_GUI_EXPORT void qt_test_resetFetchedRoot();
+QT_END_NAMESPACE
+#endif
+
 class QNonNativeFileDialog : public QFileDialog
 {
     Q_OBJECT
@@ -139,7 +146,7 @@ private:
 };
 
 tst_QFileDialog2::tst_QFileDialog2()
-{   
+{
 #if defined(Q_OS_WINCE)
     qApp->setAutoMaximizeThreshold(-1);
 #endif
@@ -177,19 +184,18 @@ void tst_QFileDialog2::listRoot()
     QFileInfoGatherer fileInfoGatherer;
     fileInfoGatherer.start();
     QTest::qWait(1500);
-
-    QFileInfoGatherer::fetchedRoot = false;
+    qt_test_resetFetchedRoot();
     QString dir(QDir::currentPath());
     QNonNativeFileDialog fd(0, QString(), dir);
     fd.show();
-    QCOMPARE(QFileInfoGatherer::fetchedRoot,false);
+    QCOMPARE(qt_test_isFetchedRoot(),false);
     fd.setDirectory("");
 #ifdef Q_OS_WINCE
     QTest::qWait(1500);
 #else
     QTest::qWait(500);
 #endif
-    QCOMPARE(QFileInfoGatherer::fetchedRoot,true);
+    QCOMPARE(qt_test_isFetchedRoot(),true);
 #endif
 }
 
-- 
cgit v0.12