From fe62f3597577f969760debcb5c8d01e398e99c55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 13 Apr 2010 12:00:02 +0200 Subject: Don't test DBus BIC if QT_NO_DBUS is defined. Change b34817d3fc adds a configure option and wraps the dbus classes in QT_NO_DBUS. DBus is off by default on Mac - the BIC test fails for the missing classes. Reviewed-by: Thiago Macieira --- tests/auto/bic/tst_bic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index 0331c96..2349afa 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -147,7 +147,9 @@ void tst_Bic::initTestCase_data() QTest::newRow("QtXmlPatterns") << "QtXmlPatterns"; QTest::newRow("Qt3Support") << "Qt3Support"; QTest::newRow("QtTest") << "QtTest"; +#ifndef QT_NO_DBUS QTest::newRow("QtDBus") << "QtDBus"; +#endif QTest::newRow("QtDesigner") << "QtDesigner"; } -- cgit v0.12 From 0fa2bea5a90c0f935aa6e4ef765cf5a24d94c23d Mon Sep 17 00:00:00 2001 From: ck Date: Tue, 13 Apr 2010 11:06:23 +0200 Subject: Assistant: Handle forward/backward mouse buttons on press on Linux. Written-by: kh1 Reviewed-by: ck --- tools/assistant/tools/assistant/helpviewer.h | 3 ++ tools/assistant/tools/assistant/helpviewer_qtb.cpp | 34 +++++++++++++++++----- tools/assistant/tools/assistant/helpviewer_qtb.h | 3 ++ tools/assistant/tools/assistant/helpviewer_qwv.cpp | 32 +++++++++++++++----- tools/assistant/tools/assistant/helpviewer_qwv.h | 2 ++ 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index 246700f..6f1f48d 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -47,6 +47,7 @@ QT_BEGIN_NAMESPACE +class QMouseEvent; class QUrl; class AbstractHelpViewer @@ -64,6 +65,8 @@ public: virtual void resetScale() = 0; virtual qreal scale() const = 0; + virtual bool handleForwardBackwardMouseButtons(QMouseEvent *e) = 0; + static QString AboutBlank; static QString LocalHelpFile; static QString PageNotFoundMessage; diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp index 07b89eb..3ff64e8 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp @@ -127,6 +127,20 @@ void HelpViewer::resetScale() zoomCount = 0; } +bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e) +{ + if (e->button() == Qt::XButton1) { + QTextBrowser::backward(); + return true; + } + + if (e->button() == Qt::XButton2) { + QTextBrowser::forward(); + return true; + } + return false; +} + void HelpViewer::setSource(const QUrl &url) { TRACE_OBJ @@ -229,15 +243,10 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *e) void HelpViewer::mouseReleaseEvent(QMouseEvent *e) { TRACE_OBJ - if (e->button() == Qt::XButton1) { - QTextBrowser::backward(); - return; - } - - if (e->button() == Qt::XButton2) { - QTextBrowser::forward(); +#ifndef Q_OS_LINUX + if (handleForwardBackwardMouseButtons(e)) return; - } +#endif controlPressed = e->modifiers() & Qt::ControlModifier; if ((controlPressed && hasAnchorAt(e->pos())) || @@ -249,6 +258,15 @@ void HelpViewer::mouseReleaseEvent(QMouseEvent *e) QTextBrowser::mouseReleaseEvent(e); } +void HelpViewer::mousePressEvent(QMouseEvent *e) +{ +#ifdef Q_OS_LINUX + if (handleForwardBackwardMouseButtons(e)) + return; +#endif + QTextBrowser::mousePressEvent(e); +} + void HelpViewer::keyPressEvent(QKeyEvent *e) { TRACE_OBJ diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.h b/tools/assistant/tools/assistant/helpviewer_qtb.h index a05782c..acb734b 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.h +++ b/tools/assistant/tools/assistant/helpviewer_qtb.h @@ -72,6 +72,8 @@ public: void resetScale(); qreal scale() const { return zoomCount; } + bool handleForwardBackwardMouseButtons(QMouseEvent *e); + void setSource(const QUrl &url); inline bool hasSelection() const @@ -91,6 +93,7 @@ private: void contextMenuEvent(QContextMenuEvent *e); void mouseReleaseEvent(QMouseEvent *e); void keyPressEvent(QKeyEvent *e); + void mousePressEvent(QMouseEvent *e); private slots: void openLinkInNewTab(); diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.cpp b/tools/assistant/tools/assistant/helpviewer_qwv.cpp index 18046a7..db1cd58 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qwv.cpp @@ -301,6 +301,22 @@ void HelpViewer::resetScale() setTextSizeMultiplier(1.0); } +bool HelpViewer::handleForwardBackwardMouseButtons(QMouseEvent *e) +{ + TRACE_OBJ + if (e->button() == Qt::XButton1) { + triggerPageAction(QWebPage::Back); + return true; + } + + if (e->button() == Qt::XButton2) { + triggerPageAction(QWebPage::Forward); + return true; + } + + return false; +} + void HelpViewer::setSource(const QUrl &url) { TRACE_OBJ @@ -328,15 +344,10 @@ void HelpViewer::wheelEvent(QWheelEvent *e) void HelpViewer::mouseReleaseEvent(QMouseEvent *e) { TRACE_OBJ - if (e->button() == Qt::XButton1) { - triggerPageAction(QWebPage::Back); +#ifndef Q_OS_LINUX + if (handleForwardBackwardMouseButtons(e)) return; - } - - if (e->button() == Qt::XButton2) { - triggerPageAction(QWebPage::Forward); - return; - } +#endif QWebView::mouseReleaseEvent(e); } @@ -356,6 +367,11 @@ void HelpViewer::actionChanged() void HelpViewer::mousePressEvent(QMouseEvent *event) { TRACE_OBJ +#ifdef Q_OS_LINUX + if (handleForwardBackwardMouseButtons(event)) + return; +#endif + HelpPage *currentPage = static_cast(page()); if (currentPage) { currentPage->m_pressedButtons = event->buttons(); diff --git a/tools/assistant/tools/assistant/helpviewer_qwv.h b/tools/assistant/tools/assistant/helpviewer_qwv.h index 41ee553..a2c0389 100644 --- a/tools/assistant/tools/assistant/helpviewer_qwv.h +++ b/tools/assistant/tools/assistant/helpviewer_qwv.h @@ -69,6 +69,8 @@ public: void resetScale(); qreal scale() const { return textSizeMultiplier(); } + bool handleForwardBackwardMouseButtons(QMouseEvent *e); + void setSource(const QUrl &url); inline QUrl source() const { return url(); } -- cgit v0.12 From 2bed031297e9edeb7e8493888c0a24f2dca3c370 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Tue, 13 Apr 2010 11:59:08 +0200 Subject: Replaced qWarning with QCOMPARE/QVERIFY statements in tst_QFileInfo Reviewed-by: Joao --- tests/auto/qfileinfo/tst_qfileinfo.cpp | 42 ++++++++++++---------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index eba04d9..da5c772 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -1087,11 +1087,7 @@ void tst_QFileInfo::isHidden_data() QTest::newRow("C:/path/to/hidden-directory/.") << QDir::currentPath() + QString::fromLatin1("/hidden-directory/.") << true; #endif #if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) - - if (!QDir("./.hidden-directory").exists() - && !QDir().mkdir("./.hidden-directory")) - qWarning("Unable to create directory './.hidden-directory'. Some tests will fail."); - + QVERIFY(QDir("./.hidden-directory").exists() || QDir().mkdir("./.hidden-directory")); QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true; QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true; QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true; @@ -1119,34 +1115,24 @@ void tst_QFileInfo::isHidden_data() { QFile file(hiddenFileName); - if (file.open(QIODevice::WriteOnly)) { - QTextStream t(&file); - t << "foobar"; - } else { - qWarning("Failed to create hidden file"); - } + QVERIFY(file.open(QIODevice::WriteOnly)); + QTextStream t(&file); + t << "foobar"; + QFile file2(notHiddenFileName); - if (file2.open(QIODevice::WriteOnly)) { - QTextStream t(&file); - t << "foobar"; - } else { - qWarning("Failed to create non-hidden file"); - } + QVERIFY(file2.open(QIODevice::WriteOnly)) + QTextStream t(&file); + t << "foobar"; } RFs rfs; TInt err = rfs.Connect(); - if (err == KErrNone) { - HBufC* symFile = qt_QString2HBufC(hiddenFileName); - err = rfs.SetAtt(*symFile, KEntryAttHidden, 0); - rfs.Close(); - delete symFile; - if (err != KErrNone) { - qWarning("Failed to set hidden attribute for test file"); - } - } else { - qWarning("Failed to open RFs session"); - } + QCOMPARE(err, KErrNone); + HBufC* symFile = qt_QString2HBufC(hiddenFileName); + err = rfs.SetAtt(*symFile, KEntryAttHidden, 0); + rfs.Close(); + delete symFile; + QCOMPARE(err, KErrNone); #endif } -- cgit v0.12 From 6bebe02e8d01e17f80d9951126c3158bf2bcc6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 13 Apr 2010 14:02:17 +0200 Subject: Skip test for cocoa: setToolTip We need to skip the QWidget::setToolTip test for now since it fails on Cocoa: The reason is that the test uses QCursor::setPos that ends up faking a mouse move on mac (which triggers tooltips). And when the mouse moves, a mouse enter event is delivered to the widget through cocoa, which will also fake a mouse move event. Until we know what the best solution is, we chose to skip this test Reviewed-by: Richard Moe Gustavsen --- tests/auto/qwidget/tst_qwidget.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 76e20b9..1b2944e 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -6056,6 +6056,9 @@ void tst_QWidget::setToolTip() #ifdef Q_OS_WINCE_WM QSKIP("Mouse over doesn't work on Windows mobile.", SkipAll); #endif +#ifdef QT_MAC_USE_COCOA + QSKIP("Temporarily disable the rest on cocoa due to QCursor::setPos problems.", SkipAll); +#endif for (int pass = 0; pass < 2; ++pass) { QWidget *popup = new QWidget(0, Qt::Popup); -- cgit v0.12