diff options
author | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-02-01 05:53:18 (GMT) |
---|---|---|
committer | Rohan McGovern <rohan.mcgovern@nokia.com> | 2010-02-01 05:53:18 (GMT) |
commit | 4915439de467d1119a46af66ea08dbe161d2f336 (patch) | |
tree | 450a989691b5a892b07d5edbe5cf88ba78d388a0 /tests/auto/qgraphicswidget | |
parent | 5bda4e27bbe3fde98bd5c628fada76dfccadad0e (diff) | |
parent | 4d1c8407c1ac16b6288c3aa0f7c2118d2748f348 (diff) | |
download | Qt-4915439de467d1119a46af66ea08dbe161d2f336.zip Qt-4915439de467d1119a46af66ea08dbe161d2f336.tar.gz Qt-4915439de467d1119a46af66ea08dbe161d2f336.tar.bz2 |
Merge commit 'origin/4.6' into oslo1-master
Conflicts:
doc/src/deployment/deployment.qdoc
doc/src/getting-started/installation.qdoc
examples/assistant/simpletextviewer/findfiledialog.cpp
examples/assistant/simpletextviewer/findfiledialog.h
examples/assistant/simpletextviewer/mainwindow.cpp
examples/webkit/fancybrowser/main.cpp
src/corelib/global/qglobal.h
src/gui/dialogs/qfiledialog_win.cpp
src/plugins/qpluginbase.pri
src/qbase.pri
tests/auto/selftests/expected_cmptest.txt
tests/auto/selftests/expected_crashes_3.txt
tests/auto/selftests/expected_longstring.txt
tests/auto/selftests/expected_maxwarnings.txt
tests/auto/selftests/expected_skip.txt
tools/assistant/compat/config.cpp
tools/assistant/compat/config.h
tools/assistant/compat/docuparser.cpp
tools/assistant/compat/docuparser.h
tools/assistant/compat/fontsettingsdialog.cpp
tools/assistant/compat/helpdialog.cpp
tools/assistant/compat/helpdialog.h
tools/assistant/compat/helpdialog.ui
tools/assistant/compat/helpwindow.cpp
tools/assistant/compat/helpwindow.h
tools/assistant/compat/index.cpp
tools/assistant/compat/index.h
tools/assistant/compat/lib/qassistantclient.cpp
tools/assistant/compat/lib/qassistantclient.h
tools/assistant/compat/main.cpp
tools/assistant/compat/mainwindow.cpp
tools/assistant/compat/mainwindow.h
tools/assistant/compat/mainwindow.ui
tools/assistant/compat/profile.cpp
tools/assistant/compat/profile.h
tools/assistant/compat/tabbedbrowser.cpp
tools/assistant/compat/tabbedbrowser.h
tools/assistant/compat/tabbedbrowser.ui
tools/assistant/compat/topicchooser.cpp
tools/assistant/compat/topicchooser.ui
tools/assistant/lib/qhelpsearchquerywidget.cpp
tools/assistant/tools/assistant/centralwidget.cpp
tools/assistant/tools/assistant/doc/assistant.qdocconf
tools/assistant/tools/assistant/helpviewer.cpp
tools/linguist/lupdate/main.cpp
tools/qdoc3/test/assistant.qdocconf
tools/qdoc3/test/designer.qdocconf
tools/qdoc3/test/linguist.qdocconf
tools/qdoc3/test/qmake.qdocconf
tools/qdoc3/test/qt-build-docs.qdocconf
tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'tests/auto/qgraphicswidget')
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 69 |
1 files changed, 68 insertions, 1 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 3b98c2f..909ea54 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -106,6 +106,7 @@ private slots: void font_data(); void font(); void fontPropagation(); + void fontChangedEvent(); void fontPropagationWidgetItemWidget(); void fontPropagationSceneChange(); void geometry_data(); @@ -167,6 +168,7 @@ private slots: void task236127_bspTreeIndexFails(); void task243004_setStyleCrash(); void task250119_shortcutContext(); + void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems(); }; @@ -673,6 +675,40 @@ void tst_QGraphicsWidget::fontPropagation() QCOMPARE(child2->font().pointSize(), 43); } +void tst_QGraphicsWidget::fontChangedEvent() +{ + QGraphicsWidget *root = new QGraphicsWidget; + QGraphicsScene scene; + scene.addItem(root); + + // Check that only the application fonts apply. + QFont appFont = QApplication::font(); + QCOMPARE(scene.font(), appFont); + QCOMPARE(root->font(), appFont); + + EventSpy rootSpyFont(root, QEvent::FontChange); + EventSpy rootSpyPolish(root, QEvent::Polish); + QCOMPARE(rootSpyFont.count(), 0); + QApplication::processEvents(); //The polish event is sent + QCOMPARE(rootSpyPolish.count(), 1); + QApplication::processEvents(); //Process events to see if we get the font change event + //The font is still the same so no fontChangeEvent + QCOMPARE(rootSpyFont.count(), 0); + + QFont font; + font.setPointSize(43); + root->setFont(font); + QApplication::processEvents(); //Process events to get the font change event + //The font changed + QCOMPARE(rootSpyFont.count(), 1); + + //then roll back to the default one. + root->setFont(appFont); + QApplication::processEvents(); //Process events to get the font change event + //The font changed + QCOMPARE(rootSpyFont.count(), 2); +} + void tst_QGraphicsWidget::fontPropagationWidgetItemWidget() { QGraphicsWidget *widget = new QGraphicsWidget; @@ -2820,6 +2856,37 @@ void tst_QGraphicsWidget::polishEvent2() QVERIFY(widget->events.contains(QEvent::Polish)); } +void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() +{ + QGraphicsScene scene; + QGraphicsWidget* parent1 = new QGraphicsWidget; + QGraphicsWidget* child1_0 = new QGraphicsWidget; + QGraphicsWidget* child1_1 = new QGraphicsWidget; + + QGraphicsWidget* parent2 = new QGraphicsWidget; + + // Add the parent and child to the scene. + scene.addItem(parent1); + child1_0->setParentItem(parent1); + child1_1->setParentItem(parent1); + + // Hide and show the child. + child1_0->setParentItem(NULL); + scene.removeItem(child1_0); + + // Remove parent from the scene. + scene.removeItem(parent1); + + delete child1_0; + delete child1_1; + delete parent1; + + // Add an item into the scene. + scene.addItem(parent2); + + //This should not crash +} + QTEST_MAIN(tst_QGraphicsWidget) #include "tst_qgraphicswidget.moc" |