summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-29 23:50:30 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-29 23:50:30 (GMT)
commitab870ab08b71c20b5dc13946bb8af5a51fb8182d (patch)
tree759002be5bf3049ac793d5a1462747a8270e68a4 /tests
parent587b0fed9bd17a378eb0212c95074df965549ef2 (diff)
parent33f01c58fa7e8f1d85f8cb591502f30a6ff30dd3 (diff)
downloadQt-ab870ab08b71c20b5dc13946bb8af5a51fb8182d.zip
Qt-ab870ab08b71c20b5dc13946bb8af5a51fb8182d.tar.gz
Qt-ab870ab08b71c20b5dc13946bb8af5a51fb8182d.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: (26 commits) Doc: QSettings::sync() imports changes made by other processes. Made -graphicssystem trace work with Qt::TextBypassShaping flag. Fix an assertion in comp_func_SourceOver_sse2() if const_alpha == 0 Add a manual test for regular widget interaction with the table. New variant of ::createPixmapData with origin for QGraphicsSystem. EGL plane levels are the same as all other GL backends. Need to access extensionFuncs in subclasses too. Export QGLWindowSurface too. Export the QGLPixmapData so that we can override it in a custom graphics system. Fixed autotest failure in QPathClipper on N900. Fixed autotest failure in QPainter::setOpacity when NEON is used. Fix compilation when configured with -no-xrender Add a new (internal) flag QGraphicsItem::ItemStopsClickFocusPropagation. Fixed some potential index-out-of-bounds issues in QImage. Fixed autotest failure in fillRect_stretchToDeviceMode Adding a known issue for VC2010 64 bit Added a note to desupport VC2010 64-bit Normalize integers when calling glVertexAttribPointer() Add an implementation of comp_func_solid_SourceOver_neon() with Neon. Fix the casts of qdrawhelper_sse2 ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp54
-rw-r--r--tests/auto/qimage/tst_qimage.cpp4
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp16
-rw-r--r--tests/manual/qtabletevent/regular_widgets/main.cpp109
-rw-r--r--tests/manual/qtabletevent/regular_widgets/regular_widgets.pro3
5 files changed, 178 insertions, 8 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index fe68c8e..31a6845 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -442,6 +442,7 @@ private slots:
void updateMicroFocus();
void textItem_shortcuts();
void scroll();
+ void stopClickFocusPropagation();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -10268,6 +10269,59 @@ void tst_QGraphicsItem::scroll()
QCOMPARE(item2->lastExposedRect, expectedItem2Expose);
}
+void tst_QGraphicsItem::stopClickFocusPropagation()
+{
+ class MyItem : public QGraphicsRectItem
+ {
+ public:
+ MyItem() : QGraphicsRectItem(0, 0, 100, 100) {}
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
+ {
+ painter->fillRect(boundingRect(), hasFocus() ? QBrush(Qt::red) : brush());
+ }
+ };
+
+ QGraphicsScene scene(-50, -50, 400, 400);
+ scene.setStickyFocus(true);
+
+ QGraphicsRectItem *noFocusOnTop = new MyItem;
+ noFocusOnTop->setBrush(Qt::yellow);
+ noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation);
+
+ QGraphicsRectItem *focusableUnder = new MyItem;
+ focusableUnder->setBrush(Qt::blue);
+ focusableUnder->setFlag(QGraphicsItem::ItemIsFocusable);
+ focusableUnder->setPos(50, 50);
+
+ QGraphicsRectItem *itemWithFocus = new MyItem;
+ itemWithFocus->setBrush(Qt::black);
+ itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable);
+ itemWithFocus->setPos(250, 10);
+
+ scene.addItem(noFocusOnTop);
+ scene.addItem(focusableUnder);
+ scene.addItem(itemWithFocus);
+ focusableUnder->stackBefore(noFocusOnTop);
+ itemWithFocus->setFocus();
+
+ QGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ QApplication::setActiveWindow(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QVERIFY(itemWithFocus->hasFocus());
+
+ QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF());
+ mousePressPoint.rx() += 60;
+ mousePressPoint.ry() += 60;
+ const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint);
+ QVERIFY(itemsAtMousePressPosition.contains(focusableUnder));
+
+ sendMousePress(&scene, mousePressPoint);
+ QVERIFY(itemWithFocus->hasFocus());
+}
+
void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
{
struct Item : public QGraphicsTextItem
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index 16deb03..5052114 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -945,11 +945,11 @@ void tst_QImage::rotate()
const int n = original.colorTable().size();
for (int x = 0; x < w; ++x) {
original.setPixel(x, 0, x % n);
- original.setPixel(x,h - 1, n - (x % n));
+ original.setPixel(x, h - 1, n - (x % n) - 1);
}
for (int y = 0; y < h; ++y) {
original.setPixel(0, y, y % n);
- original.setPixel(w - 1, y, n - (y % n));
+ original.setPixel(w - 1, y, n - (y % n) - 1);
}
}
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 701dc2e..27ee6e7 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -2648,12 +2648,16 @@ void tst_QPainter::setOpacity()
p.drawImage(imageRect, src, imageRect);
p.end();
- QImage expected(imageSize, destFormat);
- p.begin(&expected);
- p.fillRect(imageRect, QColor(127, 127, 127));
- p.end();
-
- QCOMPARE(dest, expected);
+ QImage actual = dest.convertToFormat(QImage::Format_RGB32);
+
+ for (int y = 0; y < actual.height(); ++y) {
+ QRgb *p = (QRgb *)actual.scanLine(y);
+ for (int x = 0; x < actual.width(); ++x) {
+ QVERIFY(qAbs(qRed(p[x]) - 127) <= 0xf);
+ QVERIFY(qAbs(qGreen(p[x]) - 127) <= 0xf);
+ QVERIFY(qAbs(qBlue(p[x]) - 127) <= 0xf);
+ }
+ }
}
void tst_QPainter::drawhelper_blend_untransformed_data()
diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp
new file mode 100644
index 0000000..e0c53f5
--- /dev/null
+++ b/tests/manual/qtabletevent/regular_widgets/main.cpp
@@ -0,0 +1,109 @@
+#include <QApplication>
+#include <QDebug>
+#include <QMouseEvent>
+#include <QTabletEvent>
+#include <QWidget>
+
+class EventReportWidget : public QWidget
+{
+public:
+ EventReportWidget();
+protected:
+ void mouseDoubleClickEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mouseMoveEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mousePressEvent(QMouseEvent *event) { outputMouseEvent(event); }
+ void mouseReleaseEvent(QMouseEvent *event) { outputMouseEvent(event); }
+
+ void tabletEvent(QTabletEvent *);
+
+private:
+ void outputMouseEvent(QMouseEvent *event);
+
+ bool m_lastIsMouseMove;
+ bool m_lastIsTabletMove;
+};
+
+EventReportWidget::EventReportWidget()
+ : m_lastIsMouseMove(false)
+ , m_lastIsTabletMove(false)
+{ }
+
+void EventReportWidget::tabletEvent(QTabletEvent *event)
+{
+ QWidget::tabletEvent(event);
+
+ QString type;
+ switch (event->type()) {
+ case QEvent::TabletEnterProximity:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletEnterProximity");
+ break;
+ case QEvent::TabletLeaveProximity:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletLeaveProximity");
+ break;
+ case QEvent::TabletMove:
+ if (m_lastIsTabletMove)
+ return;
+
+ m_lastIsTabletMove = true;
+ type = QString::fromLatin1("TabletMove");
+ break;
+ case QEvent::TabletPress:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletPress");
+ break;
+ case QEvent::TabletRelease:
+ m_lastIsTabletMove = false;
+ type = QString::fromLatin1("TabletRelease");
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+
+ qDebug() << "Tablet event, type = " << type
+ << " position = " << event->pos()
+ << " global position = " << event->globalPos();
+}
+
+void EventReportWidget::outputMouseEvent(QMouseEvent *event)
+{
+ QString type;
+ switch (event->type()) {
+ case QEvent::MouseButtonDblClick:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonDblClick");
+ break;
+ case QEvent::MouseButtonPress:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonPress");
+ break;
+ case QEvent::MouseButtonRelease:
+ m_lastIsMouseMove = false;
+ type = QString::fromLatin1("MouseButtonRelease");
+ break;
+ case QEvent::MouseMove:
+ if (m_lastIsMouseMove)
+ return; // only show one move to keep things readable
+
+ m_lastIsMouseMove = true;
+ type = QString::fromLatin1("MouseMove");
+ break;
+ default:
+ Q_ASSERT(false);
+ break;
+ }
+
+ qDebug() << "Mouse event, type = " << type
+ << " position = " << event->pos()
+ << " global position = " << event->globalPos();
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ EventReportWidget widget;
+ widget.show();
+ return app.exec();
+}
diff --git a/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro
new file mode 100644
index 0000000..9f0da76
--- /dev/null
+++ b/tests/manual/qtabletevent/regular_widgets/regular_widgets.pro
@@ -0,0 +1,3 @@
+TEMPLATE = app
+
+SOURCES += main.cpp