summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-24 13:20:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-24 13:20:22 (GMT)
commit63e354fdc31c874a0796be5ad4799d737fe9c8fa (patch)
tree32b8f3e14aff2924f393be10313a6c6bdf1543b9 /tests
parentc6d893bc8ada7ddd3b9896ab43d05f7d764edf51 (diff)
parent803ac286afd47de44359d66b9c711f0b03780f36 (diff)
downloadQt-63e354fdc31c874a0796be5ad4799d737fe9c8fa.zip
Qt-63e354fdc31c874a0796be5ad4799d737fe9c8fa.tar.gz
Qt-63e354fdc31c874a0796be5ad4799d737fe9c8fa.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (39 commits) fix typo in documentation Improve Bearer Management related documentation in QNetworkAccessManager Compile with QT_NO_ACTION. Unbreak compilation outside Mac QDBusAbstractInterface: don't set lastError outside the object's own thread tst_bic: make it possible to test for cross-compilation Remove Q_PACKED from QChar and QLocale::Data. QDebug operator for QFlags Removing unneeded qDebug statement. Fixing incorrect addition of public API symbols. Removal erroneous inclusion of new Public API in qmacstyle. Doc: design changes qdoc: Fixed html error, but the problem is still there. qdoc: Changed number of columns to 1. Oila! Doc: Changes to the HTMLGenerator, style and js remove dead code that will never get called. add bytes and activeTime to corelwan. Fix formating of license header. fix irix build clarify wording of warning message ...
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/bic/gen.sh2
-rw-r--r--tests/auto/bic/tst_bic.cpp12
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp78
3 files changed, 88 insertions, 4 deletions
diff --git a/tests/auto/bic/gen.sh b/tests/auto/bic/gen.sh
index 8005880..7bcad24 100755
--- a/tests/auto/bic/gen.sh
+++ b/tests/auto/bic/gen.sh
@@ -56,7 +56,7 @@ fi
for module in $modules; do
echo "#include <$module/$module>" >test.cpp
- g++ -c -I$QTDIR/include -DQT_NO_STL -DQT3_SUPPORT -fdump-class-hierarchy test.cpp
+ ${CXX-g++} $CXXFLAGS -c -I$QTDIR/include -DQT_NO_STL -DQT3_SUPPORT -fdump-class-hierarchy test.cpp
mv test.cpp*.class $module.$2.txt
# Remove template classes from the output
perl -pi -e '$skip = 1 if (/^(Class|Vtable).*</);
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp
index 400fcc1..504512d 100644
--- a/tests/auto/bic/tst_bic.cpp
+++ b/tests/auto/bic/tst_bic.cpp
@@ -178,13 +178,17 @@ void tst_Bic::sizesAndVTables_data()
QSKIP("Test not implemented for this compiler/platform", SkipAll);
#else
-#if defined Q_OS_LINUX && defined Q_WS_X11
+#if defined(FILESUFFIX)
+ // cross-testing
+#elif defined Q_OS_LINUX && defined Q_WS_X11
# if defined(__powerpc__) && !defined(__powerpc64__)
# define FILESUFFIX "linux-gcc-ppc32"
# elif defined(__amd64__)
# define FILESUFFIX "linux-gcc-amd64"
# elif defined(__i386__)
# define FILESUFFIX "linux-gcc-ia32"
+# elif defined(__ARMEL__)
+# define FILESUFFIX "linux-gcc-armel"
# endif
#elif defined Q_OS_MAC && defined(__powerpc__)
# define FILESUFFIX "macx-gcc-ppc32"
@@ -233,9 +237,11 @@ QBic::Info tst_Bic::getCurrentInfo(const QString &libName)
#ifdef Q_OS_WIN
qtDir.replace('\\', '/');
#endif
- QString compilerName = "g++";
+ QString compilerName = QString::fromLocal8Bit(qgetenv("CXX"));
+ if (compilerName.isEmpty())
+ compilerName = "g++";
- QStringList args;
+ QStringList args = QString::fromLocal8Bit(qgetenv("CXXFLAGS")).split(' ');
args << "-c"
<< "-I" + qtDir + "/include"
#ifdef Q_OS_MAC
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 459ac2b..43fbba1 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -106,6 +106,7 @@ private slots:
void lastWindowClosed();
void quitOnLastWindowClosed();
+ void closeAllWindows();
void testDeleteLater();
void testDeleteLaterProcessEvents();
@@ -745,6 +746,83 @@ void tst_QApplication::quitOnLastWindowClosed()
}
}
+class PromptOnCloseWidget : public QWidget
+{
+public:
+ void closeEvent(QCloseEvent *event)
+ {
+ QMessageBox *messageBox = new QMessageBox(this);
+ messageBox->setWindowTitle("Unsaved data");
+ messageBox->setText("Would you like to save or discard your current data?");
+ messageBox->setStandardButtons(QMessageBox::Save|QMessageBox::Discard|QMessageBox::Cancel);
+ messageBox->setDefaultButton(QMessageBox::Save);
+
+ messageBox->show();
+ QTest::qWaitForWindowShown(messageBox);
+
+ // verify that all windows are visible
+ foreach (QWidget *w, qApp->topLevelWidgets())
+ QVERIFY(w->isVisible());
+ // flush event queue
+ qApp->processEvents();
+ // close all windows
+ qApp->closeAllWindows();
+
+ if (messageBox->standardButton(messageBox->clickedButton()) == QMessageBox::Cancel)
+ event->ignore();
+ else
+ event->accept();
+
+ delete messageBox;
+ }
+};
+
+void tst_QApplication::closeAllWindows()
+{
+ int argc = 0;
+ QApplication app(argc, 0, QApplication::GuiServer);
+
+ // create some windows
+ new QWidget;
+ new QWidget;
+ new QWidget;
+
+ // show all windows
+ foreach (QWidget *w, app.topLevelWidgets()) {
+ w->show();
+ QTest::qWaitForWindowShown(w);
+ }
+ // verify that they are visible
+ foreach (QWidget *w, app.topLevelWidgets())
+ QVERIFY(w->isVisible());
+ // empty event queue
+ app.processEvents();
+ // close all windows
+ app.closeAllWindows();
+ // all windows should no longer be visible
+ foreach (QWidget *w, app.topLevelWidgets())
+ QVERIFY(!w->isVisible());
+
+ // add a window that prompts the user when closed
+ PromptOnCloseWidget *promptOnCloseWidget = new PromptOnCloseWidget;
+ // show all windows
+ foreach (QWidget *w, app.topLevelWidgets()) {
+ w->show();
+ QTest::qWaitForWindowShown(w);
+ }
+ // close the last window to open the prompt (eventloop recurses)
+ promptOnCloseWidget->close();
+ // all windows should not be visible, except the one that opened the prompt
+ foreach (QWidget *w, app.topLevelWidgets()) {
+ if (w == promptOnCloseWidget)
+ QVERIFY(w->isVisible());
+ else
+ QVERIFY(!w->isVisible());
+ }
+
+ qDeleteAll(app.topLevelWidgets());
+}
+
bool isPathListIncluded(const QStringList &l, const QStringList &r)
{
int size = r.count();