summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-09 16:53:06 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-09 16:53:06 (GMT)
commit690e54dda08496d80526ae64dcb1fb88f533542b (patch)
treeb416f5fba7f781b0e4cb9ea91ab9cb057bb0e0aa /tests
parente09c61235dab9de1111372ee05eb51004eda5569 (diff)
parent1ab962d75bd6754331536034022b882f0474196d (diff)
downloadQt-690e54dda08496d80526ae64dcb1fb88f533542b.zip
Qt-690e54dda08496d80526ae64dcb1fb88f533542b.tar.gz
Qt-690e54dda08496d80526ae64dcb1fb88f533542b.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Doc: we don't ship a qconfig executable in the Windows CE packages Fixed possible data corruption in the triangulating stroker. Fixed caching of QPainter patterns in the GL 2 engine. Fixes CursorChange and TooltipChange events delivery for QGraphicsWidget QTableView: fix spans corruption when removing spans. Fixes painting artifacts when scaling a QGraphicsProxyWidget. Fix <MemLeak> valgrind report shows memory leak for QImage::save(). Fix test sql for sql server.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp86
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp6
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp8
3 files changed, 99 insertions, 1 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 4a874be..1930a6f 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -165,6 +165,7 @@ private slots:
void polishEvent2();
void initialShow();
void initialShow2();
+ void itemChangeEvents();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2886,6 +2887,91 @@ void tst_QGraphicsWidget::initialShow2()
QTRY_COMPARE(widget->repaints, expectedRepaintCount);
}
+void tst_QGraphicsWidget::itemChangeEvents()
+{
+ class TestGraphicsWidget : public QGraphicsWidget
+ { public:
+ TestGraphicsWidget() : QGraphicsWidget() {}
+ QHash<QEvent::Type, QVariant> valueDuringEvents;
+ bool event(QEvent *event) {
+ Q_UNUSED(event);
+ switch (event->type()) {
+ case QEvent::EnabledChange: {
+ valueDuringEvents.insert(QEvent::EnabledChange, isEnabled());
+ break;
+ }
+ case QEvent::ParentAboutToChange: {
+ valueDuringEvents.insert(QEvent::ParentAboutToChange, qVariantFromValue(parentItem()));
+ break;
+ }
+ case QEvent::ParentChange: {
+ valueDuringEvents.insert(QEvent::ParentChange, qVariantFromValue(parentItem()));
+ break;
+ }
+ case QEvent::CursorChange: {
+ valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape()));
+ break;
+ }
+ case QEvent::ToolTipChange: {
+ valueDuringEvents.insert(QEvent::ToolTipChange, toolTip());
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ return true;
+ }
+ void showEvent(QShowEvent *event) {
+ Q_UNUSED(event);
+ valueDuringEvents.insert(QEvent::Show, isVisible());
+ }
+ void hideEvent(QHideEvent *event) {
+ Q_UNUSED(event);
+ valueDuringEvents.insert(QEvent::Hide, isVisible());
+ }
+ };
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget *parent = new QGraphicsWidget;
+ scene.addItem(parent);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ TestGraphicsWidget *item = new TestGraphicsWidget;
+ item->setParentItem(parent);
+ // ParentAboutToChange should be triggered before the parent has changed
+ QTRY_COMPARE(qVariantValue<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentAboutToChange)),
+ static_cast<QGraphicsItem *>(0));
+ // ParentChange should be triggered after the parent has changed
+ QTRY_COMPARE(qVariantValue<QGraphicsItem *>(item->valueDuringEvents.value(QEvent::ParentChange)),
+ static_cast<QGraphicsItem *>(parent));
+
+ // ShowEvent should be triggered before the item is shown
+ QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Show).toBool());
+
+ // HideEvent should be triggered after the item is hidden
+ QVERIFY(item->isVisible());
+ item->setVisible(false);
+ QVERIFY(!item->isVisible());
+ QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool());
+
+ // CursorChange should be triggered after the cursor has changed
+ item->setCursor(Qt::PointingHandCursor);
+ QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape()));
+
+ // ToolTipChange should be triggered after the tooltip has changed
+ item->setToolTip("tooltipText");
+ QTRY_COMPARE(item->valueDuringEvents.value(QEvent::ToolTipChange).toString(), item->toolTip());
+
+ // EnabledChange should be triggered after the enabled state has changed
+ QVERIFY(item->isEnabled());
+ item->setEnabled(false);
+ QVERIFY(!item->isEnabled());
+ QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::EnabledChange).toBool());
+}
+
void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems()
{
QGraphicsScene scene;
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index 8a084bb..38e5387 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -181,7 +181,11 @@ void tst_QSqlTableModel::createTestTables()
QVERIFY_SQL( q, exec("create table " + test3 + "(id int, random varchar(20), randomtwo varchar(20))"));
- QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))"));
+ if(!tst_Databases::isSqlServer(db))
+ QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))"));
+ else
+ QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50) NULL, column3 varchar(50))"));
+
QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int)"));
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 54e32218..2062e8e 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -3035,6 +3035,14 @@ void tst_QTableView::spans_data()
<< QPoint(0, 0)
<< 1
<< 1;
+
+ QTest::newRow("QTBUG-9631: remove one span")
+ << 10 << 10
+ << (SpanList() << QRect(1, 1, 2, 1) << QRect(2, 2, 2, 2) << QRect(1, 1, 1, 1))
+ << false
+ << QPoint(1, 1)
+ << 1
+ << 1;
}
void tst_QTableView::spans()