summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qpointf/tst_qpointf.cpp4
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp18
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp11
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp65
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro1
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp9
-rw-r--r--tests/manual/manual.pro1
-rw-r--r--tests/manual/shortcuts/main.cpp148
-rw-r--r--tests/manual/shortcuts/shortcuts.pro6
9 files changed, 252 insertions, 11 deletions
diff --git a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
index fc79b40a18..52a6d3aa46 100644
--- a/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
+++ b/tests/auto/corelib/tools/qpointf/tst_qpointf.cpp
@@ -284,12 +284,12 @@ void tst_QPointF::division()
{
QPointF p(1e-14, 1e-14);
p = p / sqrt(dot(p, p));
- qFuzzyCompare(dot(p, p), 1);
+ QCOMPARE(dot(p, p), qreal(1.0));
}
{
QPointF p(1e-14, 1e-14);
p /= sqrt(dot(p, p));
- qFuzzyCompare(dot(p, p), 1);
+ QCOMPARE(dot(p, p), qreal(1.0));
}
}
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 85b60686d6..a15daf660a 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -947,7 +947,8 @@ void tst_QSslSocket::protocol()
socket->abort();
QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3);
socket->connectToHost(QtNetworkSettings::serverName(), 443);
- QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString()));
+ if (setProxy && !socket->waitForConnected())
+ QSKIP("Skipping flaky test - See QTBUG-29941");
socket->startClientEncryption();
if (setProxy && !socket->waitForEncrypted())
QSKIP("Skipping flaky test - See QTBUG-29941");
@@ -1263,7 +1264,9 @@ void tst_QSslSocket::setSslConfiguration()
this->socket = socket.data();
socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
QFETCH(bool, works);
- QCOMPARE(socket->waitForEncrypted(10000), works);
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy && (socket->waitForEncrypted(10000) != works))
+ QSKIP("Skipping flaky test - See QTBUG-29941");
if (works) {
socket->disconnectFromHost();
QVERIFY2(socket->waitForDisconnected(), qPrintable(socket->errorString()));
@@ -2114,7 +2117,9 @@ void tst_QSslSocket::ignoreSslErrorsListWithSlot()
QFETCH(int, expectedSslErrorSignalCount);
bool expectEncryptionSuccess = (expectedSslErrorSignalCount == 0);
- QCOMPARE(socket.waitForEncrypted(10000), expectEncryptionSuccess);
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy && (socket.waitForEncrypted(10000) != expectEncryptionSuccess))
+ QSKIP("Skipping flaky test - See QTBUG-29941");
}
// make sure a closed socket has no bytesAvailable()
@@ -2205,7 +2210,8 @@ void tst_QSslSocket::blacklistedCertificates()
QVERIFY(server.listen(QHostAddress::LocalHost));
receiver->connectToHost("127.0.0.1", server.serverPort());
QVERIFY(receiver->waitForConnected(5000));
- QVERIFY(server.waitForNewConnection(0));
+ if (!server.waitForNewConnection(0))
+ QSKIP("Skipping flaky test - See QTBUG-29941");
QSslSocket *sender = server.socket;
QVERIFY(sender);
@@ -2341,7 +2347,9 @@ void tst_QSslSocket::resume()
socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 993);
QTestEventLoop::instance().enterLoop(10);
- QVERIFY(!QTestEventLoop::instance().timeout());
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy && QTestEventLoop::instance().timeout())
+ QSKIP("Skipping flaky test - See QTBUG-29941");
QCOMPARE(sslErrorSpy.count(), 1);
QCOMPARE(errorSpy.count(), 0);
QCOMPARE(encryptedSpy.count(), 0);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 9353aa0eba..2c03850181 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -4423,10 +4423,13 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsEllipseItem()
QCOMPARE(item.boundingRect(), QRectF(0, 0, 100, 100));
item.setSpanAngle(90 * 16);
- qFuzzyCompare(item.boundingRect().left(), qreal(50.0));
- qFuzzyCompare(item.boundingRect().top(), qreal(0.0));
- qFuzzyCompare(item.boundingRect().width(), qreal(50.0));
- qFuzzyCompare(item.boundingRect().height(), qreal(50.0));
+ // for some reason, the bounding rect has very few significant digits
+ // (i.e. it's likely that floats are being used inside it), so we
+ // must force the conversion from qreals to float or these tests will fail
+ QCOMPARE(float(item.boundingRect().left()), 50.0f);
+ QVERIFY(qFuzzyIsNull(float(item.boundingRect().top())));
+ QCOMPARE(float(item.boundingRect().width()), 50.0f);
+ QCOMPARE(float(item.boundingRect().height()), 50.0f);
item.setPen(QPen(Qt::black, 1));
QCOMPARE(item.boundingRect(), QRectF(49.5, -0.5, 51, 51));
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index ba3a150154..09f0161dff 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -46,6 +46,7 @@
#include <QStringListModel>
#include <QSortFilterProxyModel>
#include <QTableView>
+#include <QProxyStyle>
#include <qabstractitemmodel.h>
#include <qapplication.h>
@@ -59,6 +60,20 @@ typedef QList<int> IntList;
typedef QList<bool> BoolList;
+class TestStyle : public QProxyStyle
+{
+public:
+ void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
+ {
+ if (element == CE_HeaderSection) {
+ if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option))
+ lastPosition = header->position;
+ }
+ QProxyStyle::drawControl(element, option, painter, widget);
+ }
+ mutable QStyleOptionHeader::SectionPosition lastPosition;
+};
+
class protected_QHeaderView : public QHeaderView
{
Q_OBJECT
@@ -229,6 +244,7 @@ private slots:
void mixedTests();
void resizeToContentTest();
void testStreamWithHide();
+ void testStylePosition();
protected:
void setupTestData(bool use_reset_model = false);
@@ -2732,5 +2748,54 @@ void tst_QHeaderView::testStreamWithHide()
#endif
}
+void tst_QHeaderView::testStylePosition()
+{
+ topLevel->show();
+ QVERIFY(QTest::qWaitForWindowExposed(topLevel));
+
+ protected_QHeaderView *header = static_cast<protected_QHeaderView *>(view);
+
+ TestStyle proxy;
+ header->setStyle(&proxy);
+
+ QImage image(1, 1, QImage::Format_ARGB32);
+ QPainter p(&image);
+
+ // 0, 1, 2, 3
+ header->paintSection(&p, view->rect(), 0);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Beginning);
+ header->paintSection(&p, view->rect(), 1);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Middle);
+ header->paintSection(&p, view->rect(), 2);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Middle);
+ header->paintSection(&p, view->rect(), 3);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::End);
+
+ // (0),2,1,3
+ view->setSectionHidden(0, true);
+ view->swapSections(1, 2);
+ header->paintSection(&p, view->rect(), 1);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Middle);
+ header->paintSection(&p, view->rect(), 2);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Beginning);
+ header->paintSection(&p, view->rect(), 3);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::End);
+
+ // (1),2,0,(3)
+ view->setSectionHidden(3, true);
+ view->setSectionHidden(0, false);
+ view->setSectionHidden(1, true);
+ view->swapSections(0, 1);
+ header->paintSection(&p, view->rect(), 0);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::End);
+ header->paintSection(&p, view->rect(), 2);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::Beginning);
+
+ // (1),2,(0),(3)
+ view->setSectionHidden(0, true);
+ header->paintSection(&p, view->rect(), 2);
+ QCOMPARE(proxy.lastPosition, QStyleOptionHeader::OnlyOneSection);
+}
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index 6916ee85e6..a4fcde8a34 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -23,3 +23,4 @@ x11 {
!wince*:win32: LIBS += -luser32 -lgdi32
mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695
+linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC # QTBUG-30566 \ No newline at end of file
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index fefa7333d1..0085b75299 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -4859,6 +4859,9 @@ void tst_QWidget::moveChild_data()
void tst_QWidget::moveChild()
{
+#if defined(UBUNTU_ONEIRIC)
+ QSKIP("QTBUG-30566 - Unstable auto-test");
+#endif
QFETCH(QPoint, offset);
ColorWidget parent;
@@ -4909,6 +4912,9 @@ void tst_QWidget::moveChild()
void tst_QWidget::showAndMoveChild()
{
+#if defined(UBUNTU_ONEIRIC)
+ QSKIP("QTBUG-30566 - Unstable auto-test");
+#endif
QWidget parent(0, Qt::FramelessWindowHint);
// prevent custom styles
parent.setStyle(QStyleFactory::create(QLatin1String("Windows")));
@@ -7637,6 +7643,9 @@ void tst_QWidget::doubleRepaint()
if (!macHasAccessToWindowsServer())
QSKIP("Not having window server access causes the wrong number of repaints to be issues");
#endif
+#if defined(UBUNTU_ONEIRIC)
+ QSKIP("QTBUG-30566 - Unstable auto-test");
+#endif
UpdateWidget widget;
widget.setFocusPolicy(Qt::StrongFocus);
// Filter out activation change and focus events to avoid update() calls in QWidget.
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index c04f22b53b..381922288f 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -40,6 +40,7 @@ windowmodality \
widgetgrab \
xembed-raster \
xembed-widgets \
+shortcuts \
dialogs \
windowtransparency \
unc
diff --git a/tests/manual/shortcuts/main.cpp b/tests/manual/shortcuts/main.cpp
new file mode 100644
index 0000000000..95faff671c
--- /dev/null
+++ b/tests/manual/shortcuts/main.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include <QVBoxLayout>
+#include <QWidget>
+#include <QLabel>
+#include <QPushButton>
+
+class ShortcutTester : public QWidget
+{
+public:
+ ShortcutTester() {
+ setupLayout();
+ setFixedWidth(200);
+ }
+protected:
+ void setupLayout()
+ {
+ QVBoxLayout *layout = new QVBoxLayout(this);
+
+ QKeySequence sq1(Qt::AltModifier + Qt::ShiftModifier + Qt::Key_G);
+ QPushButton *b1 = new QPushButton(sq1.toString());
+ b1->setShortcut(sq1);
+
+ QKeySequence sq2(Qt::AltModifier + Qt::Key_G);
+ QPushButton *b2 = new QPushButton(sq2.toString());
+ b2->setShortcut(sq2);
+
+ QKeySequence sq3(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_R);
+ QPushButton *b3 = new QPushButton(sq3.toString());
+ b3->setShortcut(sq3);
+
+ QKeySequence sq4(Qt::ControlModifier + Qt::Key_R);
+ QPushButton *b4 = new QPushButton(sq4.toString());
+ b4->setShortcut(sq4);
+
+ QKeySequence sq5(Qt::ControlModifier + Qt::Key_Return);
+ QPushButton *b5 = new QPushButton(sq5.toString());
+ b5->setShortcut(sq5);
+
+ QKeySequence sq6(Qt::ControlModifier + Qt::ShiftModifier + Qt::AltModifier + Qt::Key_R);
+ QPushButton *b6 = new QPushButton(sq6.toString());
+ b6->setShortcut(sq6);
+
+ QKeySequence sq7(Qt::ShiftModifier + Qt::Key_5);
+ QPushButton *b7 = new QPushButton(sq7.toString());
+ b7->setShortcut(sq7);
+
+ QKeySequence sq8(Qt::ControlModifier + Qt::Key_Q);
+ QPushButton *b8 = new QPushButton(sq8.toString());
+ b8->setShortcut(sq8);
+
+ QKeySequence sq9(Qt::ControlModifier + Qt::Key_Plus);
+ QPushButton *b9 = new QPushButton(sq9.toString());
+ b9->setShortcut(sq9);
+
+ QKeySequence sq10(Qt::ControlModifier + Qt::Key_Y);
+ QPushButton *b10 = new QPushButton(sq10.toString());
+ b10->setShortcut(sq10);
+
+ QKeySequence sq11(Qt::ShiftModifier + Qt::Key_Comma);
+ QPushButton *b11 = new QPushButton(sq11.toString());
+ b11->setShortcut(sq11);
+
+ // LATIN SMALL LETTER O WITH STROKE
+ QKeySequence sq12(QString(QChar(ushort(0xf8))));
+ QPushButton *b12 = new QPushButton(sq12.toString());
+ b12->setShortcut(sq12);
+
+ // CYRILLIC SMALL LETTER ZHE
+ QKeySequence sq13(QString(QChar(ushort(0x436))));
+ QPushButton *b13 = new QPushButton(sq13.toString());
+ b13->setShortcut(sq13);
+
+ QLabel *testPurpose = new QLabel();
+ testPurpose->setWordWrap(true);
+ testPurpose->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
+ testPurpose->setText("This test come in handy to verify shortcuts under different"
+ " keyboard layouts - qwerty, dvorak, non-latin (russian, arabic), etc.");
+ layout->addWidget(testPurpose);
+ layout->addWidget(b1);
+ layout->addWidget(b2);
+ layout->addWidget(b3);
+ layout->addWidget(b4);
+ layout->addWidget(b5);
+ layout->addWidget(b6);
+ layout->addWidget(b7);
+ layout->addWidget(b8);
+ layout->addWidget(b9);
+ layout->addWidget(b10);
+ layout->addWidget(b11);
+ layout->addWidget(new QLabel("Norwegian layout"));
+ layout->addWidget(b12);
+ layout->addWidget(new QLabel("Russian layout"));
+ layout->addWidget(b13);
+
+ setLayout(layout);
+ }
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+ ShortcutTester tester;
+ tester.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/shortcuts/shortcuts.pro b/tests/manual/shortcuts/shortcuts.pro
new file mode 100644
index 0000000000..3df6f2192b
--- /dev/null
+++ b/tests/manual/shortcuts/shortcuts.pro
@@ -0,0 +1,6 @@
+QT += core gui widgets
+
+TARGET = shortcuts
+TEMPLATE = app
+
+SOURCES += main.cpp