summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-06-16 15:23:34 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2010-06-16 15:23:34 (GMT)
commit0b9638476c1a8bad4e33cbd20be1f6ff33935766 (patch)
tree968c6927ef9cda975f1065c41d93882231383588 /tests
parent8cb10f381af7fd6f1fa0ffc946f6a4e6ba106d5d (diff)
parentc9a89b253176547901e11d27c042983a65f43b1f (diff)
downloadQt-0b9638476c1a8bad4e33cbd20be1f6ff33935766.zip
Qt-0b9638476c1a8bad4e33cbd20be1f6ff33935766.tar.gz
Qt-0b9638476c1a8bad4e33cbd20be1f6ff33935766.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into qt-4.7-from-4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gestures/tst_gestures.cpp66
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp19
-rw-r--r--tests/auto/qlocale/test/test.pro2
-rw-r--r--tests/auto/qprocess/testProcessEOF/testProcessEOF.pro2
-rw-r--r--tests/auto/qsqldriver/qsqldriver.pro2
-rw-r--r--tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro2
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp3
-rw-r--r--tests/auto/qtcpserver/crashingServer/crashingServer.pro2
-rw-r--r--tests/auto/qtextformat/tst_qtextformat.cpp5
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp9
-rw-r--r--tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp9
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp6
-rw-r--r--tests/auto/xmlpatternsxqts/tst_suitetest.cpp4
13 files changed, 97 insertions, 34 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index 7c1170c..a968520 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -334,6 +334,7 @@ private slots:
void gestureOverChild();
void multipleWidgetOnlyGestureInTree();
void conflictingGestures();
+ void conflictingGesturesInGraphicsView();
void finishedWithoutStarted();
void unknownGesture();
void graphicsItemGesture();
@@ -2235,5 +2236,70 @@ void tst_Gestures::testReuseCanceledGestures()
QCOMPARE(target->canceled(), 1);
}
+void tst_Gestures::conflictingGesturesInGraphicsView()
+{
+ QGraphicsScene scene;
+ GraphicsView view(&scene);
+ view.setWindowFlags(Qt::X11BypassWindowManagerHint);
+
+ GestureItem *item1 = new GestureItem("item1");
+ item1->grabGesture(CustomGesture::GestureType);
+ item1->size = QRectF(0, 0, 100, 100);
+ item1->setZValue(2);
+ scene.addItem(item1);
+
+ GestureItem *item2 = new GestureItem("item2");
+ item2->grabGesture(CustomGesture::GestureType);
+ item2->size = QRectF(0, 0, 100, 100);
+ item2->setZValue(5);
+ scene.addItem(item2);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ CustomEvent event;
+
+ // nobody accepts override
+ item1->acceptGestureOverride = false;
+ item2->acceptGestureOverride = false;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, 0);
+
+ item1->reset(); item2->reset();
+
+ // the original target accepts override
+ item1->acceptGestureOverride = false;
+ item2->acceptGestureOverride = true;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureEventsReceived, 0);
+
+ item1->reset(); item2->reset();
+
+ // the item behind accepts override
+ item1->acceptGestureOverride = true;
+ item2->acceptGestureOverride = false;
+ event.hotSpot = mapToGlobal(item2->boundingRect().center(), item2, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item2, &scene);
+
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2->gestureEventsReceived, 0);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+}
+
QTEST_MAIN(tst_Gestures)
#include "tst_gestures.moc"
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 43fbba1..1a38070 100644
--- a/tests/auto/qapplication/tst_qapplication.cpp
+++ b/tests/auto/qapplication/tst_qapplication.cpp
@@ -189,15 +189,22 @@ void tst_QApplication::getSetCheck()
{
int argc = 0;
QApplication obj1(argc, 0, QApplication::GuiServer);
- // QInputContext * QApplication::inputContext()
- // void QApplication::setInputContext(QInputContext *)
MyInputContext *var1 = new MyInputContext;
+
+ // QApplication takes ownership, so check for reparenting:
obj1.setInputContext(var1);
- QCOMPARE((QInputContext *)var1, obj1.inputContext());
+ QCOMPARE(var1->parent(), static_cast<QObject *>(&obj1));
+
+ // Test for self-assignment:
+ obj1.setInputContext(obj1.inputContext());
+ QVERIFY(obj1.inputContext());
+ QCOMPARE(static_cast<QInputContext *>(var1), obj1.inputContext());
+
+ // Resetting the input context to 0 is not allowed:
QTest::ignoreMessage(QtWarningMsg, "QApplication::setInputContext: called with 0 input context");
- obj1.setInputContext((QInputContext *)0);
- QCOMPARE((QInputContext *)var1, obj1.inputContext());
- // delete var1; // No delete, since QApplication takes ownership
+ obj1.setInputContext(0);
+
+ QCOMPARE(static_cast<QInputContext *>(var1), obj1.inputContext());
}
class CloseEventTestWindow : public QWidget
diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro
index d57f2d1..e33d0fe 100644
--- a/tests/auto/qlocale/test/test.pro
+++ b/tests/auto/qlocale/test/test.pro
@@ -36,4 +36,4 @@ symbian:contains(S60_VERSION,3.2) {
"PAGED" \
"$${LITERAL_HASH}endif"
MMP_RULES += custom_paged_rule
-} \ No newline at end of file
+}
diff --git a/tests/auto/qprocess/testProcessEOF/testProcessEOF.pro b/tests/auto/qprocess/testProcessEOF/testProcessEOF.pro
index f406759..756bd23 100644
--- a/tests/auto/qprocess/testProcessEOF/testProcessEOF.pro
+++ b/tests/auto/qprocess/testProcessEOF/testProcessEOF.pro
@@ -2,7 +2,7 @@ SOURCES = main.cpp
CONFIG -= qt app_bundle
CONFIG += console
-!win32-g++:win32:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS-
+win32:!win32-g++*:!equals(TEMPLATE_PREFIX, "vc"):QMAKE_CXXFLAGS += /GS-
DESTDIR = ./
diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro
index d04ca83..2e9ed67 100644
--- a/tests/auto/qsqldriver/qsqldriver.pro
+++ b/tests/auto/qsqldriver/qsqldriver.pro
@@ -9,7 +9,7 @@ wince*: {
DEPLOYMENT += plugFiles
LIBS += -lws2
} else {
- win32-g++ {
+ win32-g++* {
LIBS += -lws2_32
} else:win32 {
LIBS += ws2_32.lib
diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
index ee4f2f0..c6681d5 100644
--- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
+++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
@@ -17,7 +17,7 @@ wince*: {
}
}
} else {
- win32-g++ {
+ win32-g++* {
LIBS += -lws2_32
} else:win32 {
LIBS += ws2_32.lib
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index 505b867..d0509bb 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -542,6 +542,9 @@ void tst_QSslCertificate::fromPath_data()
QTest::newRow("\"d.*/c.*.pem\" regexp der") << QString("d.*/c.*.pem") << int(QRegExp::RegExp) << false << 0;
QTest::newRow("\"d.*/c.*.pem\" wildcard pem") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << true << 0;
QTest::newRow("\"d.*/c.*.pem\" wildcard der") << QString("d.*/c.*.pem") << int(QRegExp::Wildcard) << false << 0;
+#ifdef Q_OS_LINUX
+ QTest::newRow("absolute path wildcard pem") << QString(QDir::currentPath() + "/certificates/*.pem") << int(QRegExp::Wildcard) << true << 4;
+#endif
QTest::newRow("trailing-whitespace") << QString("more-certificates/trailing-whitespace.pem") << int(QRegExp::FixedString) << true << 1;
QTest::newRow("no-ending-newline") << QString("more-certificates/no-ending-newline.pem") << int(QRegExp::FixedString) << true << 1;
diff --git a/tests/auto/qtcpserver/crashingServer/crashingServer.pro b/tests/auto/qtcpserver/crashingServer/crashingServer.pro
index 70e42b4..0bea655 100644
--- a/tests/auto/qtcpserver/crashingServer/crashingServer.pro
+++ b/tests/auto/qtcpserver/crashingServer/crashingServer.pro
@@ -5,4 +5,4 @@ DESTDIR = ./
# This means the auto test works on some machines for MinGW. No dialog stalls
# the application.
-win32-g++:CONFIG += console
+win32-g++*:CONFIG += console
diff --git a/tests/auto/qtextformat/tst_qtextformat.cpp b/tests/auto/qtextformat/tst_qtextformat.cpp
index ee1f4b5..9b71481 100644
--- a/tests/auto/qtextformat/tst_qtextformat.cpp
+++ b/tests/auto/qtextformat/tst_qtextformat.cpp
@@ -308,10 +308,7 @@ void tst_QTextFormat::getSetTabs()
format.setTabPositions(tabs);
Comparator c2(tabs, format.tabPositions());
- QTextOption::Tab tab2;
- tab2.position = 3456;
- tab2.type = QTextOption::RightTab;
- tab2.delimiter = QChar('x');
+ QTextOption::Tab tab2(3456, QTextOption::RightTab, QChar('x'));
tabs.append(tab2);
format.setTabPositions(tabs);
Comparator c3(tabs, format.tabPositions());
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index 1a5f493..a631f3d 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -980,9 +980,7 @@ void tst_QTextLayout::testCenteredTab()
// test if centering the tab works. We expect the center of 'Bar.' to be at the tab point.
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
- QTextOption::Tab tab;
- tab.type = QTextOption::CenterTab;
- tab.position = 150;
+ QTextOption::Tab tab(150, QTextOption::CenterTab);
tabs.append(tab);
option.setTabs(tabs);
layout.setTextOption(option);
@@ -1002,10 +1000,7 @@ void tst_QTextLayout::testDelimiterTab()
// try the different delimiter characters to see if the alignment works there.
QTextOption option = layout.textOption();
QList<QTextOption::Tab> tabs;
- QTextOption::Tab tab;
- tab.type = QTextOption::DelimiterTab;
- tab.delimiter = QChar('.');
- tab.position = 100;
+ QTextOption::Tab tab(100, QTextOption::DelimiterTab, QChar('.'));
tabs.append(tab);
option.setTabs(tabs);
layout.setTextOption(option);
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
index 64c42bb..a463d86 100644
--- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
+++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp
@@ -198,14 +198,9 @@ void tst_QTextOdfWriter::testWriteStyle2()
{
QTextBlockFormat bf; // = cursor.blockFormat();
QList<QTextOption::Tab> tabs;
- QTextOption::Tab tab1;
- tab1.position = 40;
- tab1.type = QTextOption::RightTab;
+ QTextOption::Tab tab1(40, QTextOption::RightTab);
tabs << tab1;
- QTextOption::Tab tab2;
- tab2.position = 80;
- tab2.type = QTextOption::DelimiterTab;
- tab2.delimiter = 'o';
+ QTextOption::Tab tab2(80, QTextOption::DelimiterTab, 'o');
tabs << tab2;
bf.setTabPositions(tabs);
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index d76bbfa..045216a 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -610,10 +610,14 @@ void tst_QWidget::getSetCheck()
obj1.setAttribute(Qt::WA_InputMethodEnabled);
obj1.setInputContext(var13);
QCOMPARE(static_cast<QInputContext *>(var13), obj1.inputContext());
+ // QWidget takes ownership, so check parent
+ QCOMPARE(var13->parent(), static_cast<QObject *>(&obj1));
+ // Check self assignment
+ obj1.setInputContext(obj1.inputContext());
+ QCOMPARE(static_cast<QInputContext *>(var13), obj1.inputContext());
obj1.setInputContext((QInputContext *)0);
QCOMPARE(qApp->inputContext(), obj1.inputContext());
QVERIFY(qApp->inputContext() != var13);
- //delete var13; // No delete, since QWidget takes ownership
// bool QWidget::autoFillBackground()
// void QWidget::setAutoFillBackground(bool)
diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
index ec63858..6e10e3f 100644
--- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
+++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
@@ -141,8 +141,6 @@ void tst_SuiteTest::checkTestSuiteResult() const
/* Passed to ResultThreader so it knows what kind of file it is handling. */
ResultThreader::Type type = ResultThreader::Baseline;
- QProcess::execute(QLatin1String("p4 edit ") + m_existingBaseline);
-
for(QFileInfoList::const_iterator it(list.constBegin()); it != end; ++it)
{
QFileInfo i(*it);
@@ -167,8 +165,6 @@ void tst_SuiteTest::checkTestSuiteResult() const
const int exitCode = eventLoop.exec();
- QProcess::execute(QLatin1String("p4 revert -a ") + m_existingBaseline);
-
QCOMPARE(exitCode, 0);
}