summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-12 00:28:39 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-12 00:28:39 (GMT)
commita653056f806a3410b4aa76df78fae736d4f93791 (patch)
treeaafc9a816ce6a55e4ad6ba999d2a6d2d8e4be1f1 /tests
parent497da277770ccf37e05a7b519afd5206601a7cf1 (diff)
parentcde3f39cb75ba69185cca8176ea7126f8441f042 (diff)
downloadQt-a653056f806a3410b4aa76df78fae736d4f93791.zip
Qt-a653056f806a3410b4aa76df78fae736d4f93791.tar.gz
Qt-a653056f806a3410b4aa76df78fae736d4f93791.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (31 commits) Fixed an on-exit crash for apps using GL. QMetaType: do not crash when registering builtin stream operator Fix another potential strstr() crash for EGL based GL apps. Fixed an on-exit application crash for GL apps using EGL. Compile fix. QWidget::childAt for masked child widgets doesn't work properly Optimized 90-, 180-, and 270- rotated blits in raster paint engine. Rename QLocale::isWrittenRightToLeft() to textDirection() Fixed some bugs in detection of keyboard directionality Add a isWrittenRightToLeft() method to QLocale. consistent handling of directionality in QTextLayout For an empty line edit the cursor position is depending on input language correctly initialize the bidi level in the text engine Use the textDirection() of blocks correctly. Add QTextBlock::textDirection() Make sure LayoutDirectionAuto is the default text direction LayoutDirectionAuto is the default layout direction for QPainter Correct BiDi behavior of QLineEdit The default text direction for QTextOption is Qt::LayoutDirectionAuto Handle setting the layoutDirection to Qt::LayoutDirectionAuto ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmetatype/tst_qmetatype.cpp8
-rw-r--r--tests/auto/qtransform/tst_qtransform.cpp8
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp97
3 files changed, 113 insertions, 0 deletions
diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp
index f4e122f..8558e06 100644
--- a/tests/auto/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/qmetatype/tst_qmetatype.cpp
@@ -77,6 +77,7 @@ private slots:
void isRegistered_data();
void isRegistered();
void unregisterType();
+ void QTBUG11316_registerStreamBuiltin();
};
@@ -318,5 +319,12 @@ void tst_QMetaType::unregisterType()
QCOMPARE(QMetaType::isRegistered(typeId), false);
}
+void tst_QMetaType::QTBUG11316_registerStreamBuiltin()
+{
+ //should not crash;
+ qRegisterMetaTypeStreamOperators<QString>("QString");
+ qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
+}
+
QTEST_MAIN(tst_QMetaType)
#include "tst_qmetatype.moc"
diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp
index a3ded8e..c784b3a 100644
--- a/tests/auto/qtransform/tst_qtransform.cpp
+++ b/tests/auto/qtransform/tst_qtransform.cpp
@@ -85,6 +85,7 @@ private slots:
void inverted();
void projectivePathMapping();
void mapInt();
+ void mapPathWithPoint();
private:
void mapping_data();
@@ -793,6 +794,13 @@ void tst_QTransform::mapInt()
QCOMPARE(y, 10);
}
+void tst_QTransform::mapPathWithPoint()
+{
+ QPainterPath p(QPointF(10, 10));
+ p = QTransform::fromTranslate(10, 10).map(p);
+ QCOMPARE(p.currentPosition(), QPointF(20, 20));
+}
+
QTEST_APPLESS_MAIN(tst_QTransform)
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index a1fc607..d76bbfa 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -404,6 +404,10 @@ private slots:
void taskQTBUG_7532_tabOrderWithFocusProxy();
void movedAndResizedAttributes();
+ void childAt();
+#ifdef Q_WS_MAC
+ void childAt_unifiedToolBar();
+#endif
private:
bool ensureScreenSize(int width, int height);
@@ -10347,5 +10351,98 @@ void tst_QWidget::movedAndResizedAttributes()
#endif
}
+void tst_QWidget::childAt()
+{
+ QWidget parent(0, Qt::FramelessWindowHint);
+ parent.resize(200, 200);
+
+ QWidget *child = new QWidget(&parent);
+ child->setPalette(Qt::red);
+ child->setAutoFillBackground(true);
+ child->setGeometry(20, 20, 160, 160);
+
+ QWidget *grandChild = new QWidget(child);
+ grandChild->setPalette(Qt::blue);
+ grandChild->setAutoFillBackground(true);
+ grandChild->setGeometry(-20, -20, 220, 220);
+
+ QVERIFY(!parent.childAt(19, 19));
+ QVERIFY(!parent.childAt(180, 180));
+ QCOMPARE(parent.childAt(20, 20), grandChild);
+ QCOMPARE(parent.childAt(179, 179), grandChild);
+
+ grandChild->setAttribute(Qt::WA_TransparentForMouseEvents);
+ QCOMPARE(parent.childAt(20, 20), child);
+ QCOMPARE(parent.childAt(179, 179), child);
+ grandChild->setAttribute(Qt::WA_TransparentForMouseEvents, false);
+
+ child->setMask(QRect(50, 50, 60, 60));
+
+ QVERIFY(!parent.childAt(69, 69));
+ QVERIFY(!parent.childAt(130, 130));
+ QCOMPARE(parent.childAt(70, 70), grandChild);
+ QCOMPARE(parent.childAt(129, 129), grandChild);
+
+ child->setAttribute(Qt::WA_MouseNoMask);
+ QCOMPARE(parent.childAt(69, 69), grandChild);
+ QCOMPARE(parent.childAt(130, 130), grandChild);
+ child->setAttribute(Qt::WA_MouseNoMask, false);
+
+ grandChild->setAttribute(Qt::WA_TransparentForMouseEvents);
+ QCOMPARE(parent.childAt(70, 70), child);
+ QCOMPARE(parent.childAt(129, 129), child);
+ grandChild->setAttribute(Qt::WA_TransparentForMouseEvents, false);
+
+ grandChild->setMask(QRect(80, 80, 40, 40));
+
+ QCOMPARE(parent.childAt(79, 79), child);
+ QCOMPARE(parent.childAt(120, 120), child);
+ QCOMPARE(parent.childAt(80, 80), grandChild);
+ QCOMPARE(parent.childAt(119, 119), grandChild);
+
+ grandChild->setAttribute(Qt::WA_MouseNoMask);
+
+ QCOMPARE(parent.childAt(79, 79), grandChild);
+ QCOMPARE(parent.childAt(120, 120), grandChild);
+}
+
+#ifdef Q_WS_MAC
+void tst_QWidget::childAt_unifiedToolBar()
+{
+ QLabel *label = new QLabel(QLatin1String("foo"));
+ QToolBar *toolBar = new QToolBar;
+ toolBar->addWidget(new QLabel("dummy"));
+ toolBar->addWidget(label);
+
+ QMainWindow mainWindow;
+ mainWindow.addToolBar(toolBar);
+ mainWindow.show();
+
+ // Calculate the top-left corner of the tool bar and the label (in mainWindow's coordinates).
+ QPoint labelTopLeft = label->mapTo(&mainWindow, QPoint());
+ QPoint toolBarTopLeft = toolBar->mapTo(&mainWindow, QPoint());
+
+ QCOMPARE(mainWindow.childAt(toolBarTopLeft), static_cast<QWidget *>(toolBar));
+ QCOMPARE(mainWindow.childAt(labelTopLeft), static_cast<QWidget *>(label));
+
+ // Enable unified tool bars.
+ mainWindow.setUnifiedTitleAndToolBarOnMac(true);
+ QTest::qWait(50);
+
+ // The tool bar is now in the "non-client" area of QMainWindow, i.e.
+ // outside the mainWindow's rect(), and since mapTo et al. doesn't work
+ // in that case (see commit 35667fd45ada49269a5987c235fdedfc43e92bb8),
+ // we use mapToGlobal/mapFromGlobal to re-calculate the corners.
+ QPoint oldToolBarTopLeft = toolBarTopLeft;
+ toolBarTopLeft = mainWindow.mapFromGlobal(toolBar->mapToGlobal(QPoint()));
+ QVERIFY(toolBarTopLeft != oldToolBarTopLeft);
+ QVERIFY(toolBarTopLeft.y() < 0);
+ labelTopLeft = mainWindow.mapFromGlobal(label->mapToGlobal(QPoint()));
+
+ QCOMPARE(mainWindow.childAt(toolBarTopLeft), static_cast<QWidget *>(toolBar));
+ QCOMPARE(mainWindow.childAt(labelTopLeft), static_cast<QWidget *>(label));
+}
+#endif
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"