diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-01 13:14:41 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-01 13:14:41 (GMT) |
commit | b6e2d52f08727d370ee6403ef9099165b56b39c9 (patch) | |
tree | f55f58395c2905af4ece1de6ff5c765b69a03841 /tests | |
parent | 14de8cecfa5b5428d597c9cca111ee0f3f89502f (diff) | |
parent | bbab5a5dd8274aadc15ef209a08632fde8baeee0 (diff) | |
download | Qt-b6e2d52f08727d370ee6403ef9099165b56b39c9.zip Qt-b6e2d52f08727d370ee6403ef9099165b56b39c9.tar.gz Qt-b6e2d52f08727d370ee6403ef9099165b56b39c9.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Manually amend latin1 change
QGraphicsItem::ItemStops[ClickFocusProgration|FocusHandling] must not interfer with touch event propagation
suppress warnings about ASCII to QString conversion
take the user defined temp dir into account
Compilation break in MSVC2008 and MSVC2005
Remove useless LFLAGS
Add docs for QNetworkConfigurationManager's time-consuming constructor.
rebuild configure
fix configure.exe option -opengl desktop
use mkdir -p for mingw+sh
Ensure the right font is used for rendering text on Mac
QDirIterator returns hidden directories when it should only return files
Update Polish translations
L10n: Update German translations.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdiriterator/tst_qdiriterator.cpp | 55 | ||||
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 79 |
2 files changed, 133 insertions, 1 deletions
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp index f7666dc..3269379 100644 --- a/tests/auto/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp @@ -118,6 +118,7 @@ private slots: void longPath(); void task185502_dirorder(); void relativePaths(); + void qtbug15421_hiddenDirs_hiddenFiles(); }; tst_QDirIterator::tst_QDirIterator() @@ -163,6 +164,20 @@ tst_QDirIterator::tst_QDirIterator() createLink("nothing", "entrylist/brokenlink.lnk"); # endif #endif + + createDirectory("qtbug15421_hiddenDirs_hiddenFiles"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenFile"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalFile"); + createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenFile"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory"); + createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory"); } tst_QDirIterator::~tst_QDirIterator() @@ -532,6 +547,46 @@ void tst_QDirIterator::relativePaths() } } +void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() +{ + // In Unix it is easy to create hidden files, but in Windows it requires + // a special call since hidden files need to be "marked" while in Unix + // anything starting by a '.' is a hidden file. + // For that reason this test is not run in Windows. +#if defined Q_OS_WIN || Q_OS_WINCE + QSKIP("To create hidden files a special call is required in Windows.", SkipAll); +#else + // Only files + { + int matches = 0; + int failures = 0; + QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (di.hasNext()) { + ++matches; + QString filename = di.next(); + if (QFileInfo(filename).isDir()) + ++failures; // search was only supposed to find files + } + QCOMPARE(matches, 6); + QCOMPARE(failures, 0); + } + // Only directories + { + int matches = 0; + int failures = 0; + QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + while (di.hasNext()) { + ++matches; + QString filename = di.next(); + if (!QFileInfo(filename).isDir()) + ++failures; // search was only supposed to find files + } + QCOMPARE(matches, 6); + QCOMPARE(failures, 0); + } +#endif // Q_OS_WIN || Q_OS_WINCE +} + QTEST_MAIN(tst_QDirIterator) #include "tst_qdiriterator.moc" diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 168f75e..73e5656 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -66,6 +66,7 @@ #include <QPushButton> #include <QLineEdit> #include <QGraphicsLinearLayout> +#include <float.h> #include "../../shared/util.h" @@ -449,6 +450,8 @@ private slots: void scroll(); void focusHandling_data(); void focusHandling(); + void touchEventPropagation_data(); + void touchEventPropagation(); void deviceCoordinateCache_simpleRotations(); // task specific tests below me @@ -10637,6 +10640,80 @@ void tst_QGraphicsItem::focusHandling() QCOMPARE(scene.focusItem(), focusableUnder); } +void tst_QGraphicsItem::touchEventPropagation_data() +{ + QTest::addColumn<QGraphicsItem::GraphicsItemFlag>("flag"); + QTest::addColumn<int>("expectedCount"); + + QTest::newRow("ItemIsPanel") + << QGraphicsItem::ItemIsPanel << 0; + QTest::newRow("ItemStopsClickFocusPropagation") + << QGraphicsItem::ItemStopsClickFocusPropagation << 1; + QTest::newRow("ItemStopsFocusHandling") + << QGraphicsItem::ItemStopsFocusHandling << 1; +} + +void tst_QGraphicsItem::touchEventPropagation() +{ + QFETCH(QGraphicsItem::GraphicsItemFlag, flag); + QFETCH(int, expectedCount); + + class Testee : public QGraphicsRectItem + { + public: + int touchBeginEventCount; + + Testee() + : QGraphicsRectItem(0, 0, 100, 100) + , touchBeginEventCount(0) + { + setAcceptTouchEvents(true); + setFlag(QGraphicsItem::ItemIsFocusable, false); + } + + bool sceneEvent(QEvent *ev) + { + if (ev->type() == QEvent::TouchBegin) + ++touchBeginEventCount; + + return QGraphicsRectItem::sceneEvent(ev); + } + }; + + Testee *touchEventReceiver = new Testee; + QGraphicsItem *topMost = new QGraphicsRectItem(touchEventReceiver->boundingRect()); + + QGraphicsScene scene; + scene.addItem(topMost); + scene.addItem(touchEventReceiver); + + topMost->setAcceptTouchEvents(true); + topMost->setZValue(FLT_MAX); + topMost->setFlag(QGraphicsItem::ItemIsFocusable, false); + topMost->setFlag(flag, true); + + QGraphicsView view(&scene); + view.setSceneRect(touchEventReceiver->boundingRect()); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(touchEventReceiver->touchBeginEventCount, 0); + + QTouchEvent::TouchPoint tp(0); + tp.setState(Qt::TouchPointPressed); + tp.setScenePos(view.sceneRect().center()); + tp.setLastScenePos(view.sceneRect().center()); + + QList<QTouchEvent::TouchPoint> touchPoints; + touchPoints << tp; + + sendMousePress(&scene, tp.scenePos()); + QTouchEvent touchBegin(QEvent::TouchBegin, QTouchEvent::TouchScreen, Qt::NoModifier, Qt::TouchPointPressed, touchPoints); + + qApp->sendEvent(&scene, &touchBegin); + QCOMPARE(touchEventReceiver->touchBeginEventCount, expectedCount); +} + void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations() { // Make sure we don't invalidate the cache when applying simple @@ -11176,6 +11253,6 @@ void tst_QGraphicsItem::QTBUG_16374_crashInDestructor() view.show(); QTest::qWaitForWindowShown(&view); } - + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |