summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-03-04 16:48:44 +0100
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-03-04 16:49:00 +0100
commit38b5e9f8ba7686152fe5199f2a40c013e6a322e0 (patch)
tree8986796a85dfc338698bce617fb33aac3af475f8 /tests
parentc0a5e8c9d77aefd6c403af39908e56414a921522 (diff)
parent8ac63a3323585de28428df3f376bdf3f3c2a67fb (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp7
-rw-r--r--tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp8
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp9
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp4
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp4
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp4
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp4
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp24
-rw-r--r--tests/manual/qtabletevent/regular_widgets/main.cpp88
11 files changed, 78 insertions, 84 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 7d2d009213..decd4ef931 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -734,6 +734,13 @@ void tst_QImage::convertToFormat_data()
QTest::newRow("blue rgb888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
<< int(QImage::Format_ARGB32) << 0xff0000ff;
+ QTest::newRow("red rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xffff0000
+ << int(QImage::Format_RGBX8888) << 0xffff0000;
+ QTest::newRow("green rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff00ff00
+ << int(QImage::Format_RGBX8888) << 0xff00ff00;
+ QTest::newRow("blue rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff0000ff
+ << int(QImage::Format_RGBX8888) << 0xff0000ff;
+
QTest::newRow("semired argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7fff0000u
<< int(QImage::Format_RGB888) << 0xffff0000;
QTest::newRow("semigreen argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7f00ff00u
diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index b2b583fa9c..708e7ebca8 100644
--- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -38,7 +38,7 @@
#include <algorithm>
-#define EXAMPLE_URL "http://user:pass@www.example.com/#foo"
+#define EXAMPLE_URL "http://user:pass@localhost:4/#foo"
//cached objects are organized into these many subdirs
#define NUM_SUBDIRECTORIES 16
@@ -409,7 +409,7 @@ void tst_QNetworkDiskCache::accessAfterRemoveReadyReadSlot()
void tst_QNetworkDiskCache::setCookieHeader() // QTBUG-41514
{
SubQNetworkDiskCache *cache = new SubQNetworkDiskCache();
- url = QUrl("http://www.foo.com/cookieTest.html");
+ url = QUrl("http://localhost:4/cookieTest.html"); // hopefully no one is running an HTTP server on port 4
QNetworkCacheMetaData metaData;
metaData.setUrl(url);
@@ -518,7 +518,7 @@ void tst_QNetworkDiskCache::expire()
if (i % 3 == 0)
QTest::qWait(2000);
QNetworkCacheMetaData m;
- m.setUrl(QUrl("http://www.foo.com/" + QString::number(i)));
+ m.setUrl(QUrl("http://localhost:4/" + QString::number(i)));
QIODevice *d = cache.prepare(m);
QString bigString;
bigString.fill(QLatin1Char('Z'), (1024 * 1024 / 4));
@@ -540,7 +540,7 @@ void tst_QNetworkDiskCache::expire()
std::sort(cacheList.begin(), cacheList.end());
for (int i = 0; i < cacheList.count(); ++i) {
QString fileName = cacheList[i];
- QCOMPARE(fileName, QString("http://www.foo.com/%1").arg(i + 6));
+ QCOMPARE(fileName, QString("http://localhost:4/%1").arg(i + 6));
}
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index c1027dac18..f8d852888c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -123,7 +123,9 @@ private slots:
void resizeEvent_data();
void resizeEvent();
void paintEvent();
+#ifndef QT_NO_WHEELEVENT
void wheelEvent();
+#endif
void sizeHint_data();
void sizeHint();
void sizePolicy();
@@ -260,6 +262,7 @@ public:
int focusOut;
};
+#ifndef QT_NO_WHEELEVENT
class WheelWidget : public QWidget
{
public:
@@ -269,6 +272,7 @@ public:
bool wheelEventCalled;
};
+#endif // !QT_NO_WHEELEVENT
// This will be called before the first test function is executed.
// It is only called once.
@@ -1308,6 +1312,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
}
+#ifndef QT_NO_WHEELEVENT
void tst_QGraphicsProxyWidget::wheelEvent()
{
QGraphicsScene scene;
@@ -1331,6 +1336,7 @@ void tst_QGraphicsProxyWidget::wheelEvent()
QVERIFY(event.isAccepted());
QVERIFY(wheelWidget->wheelEventCalled);
}
+#endif // !QT_NO_WHEELEVENT
Q_DECLARE_METATYPE(Qt::SizeHint)
void tst_QGraphicsProxyWidget::sizeHint_data()
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 783395fed4..119e9dfecb 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -198,7 +198,9 @@ private slots:
void mapFromScenePoly();
void mapFromScenePath();
void sendEvent();
+#ifndef QT_NO_WHEELEVENT
void wheelEvent();
+#endif
#ifndef QTEST_NO_CURSOR
void cursor();
void cursor2();
@@ -2172,6 +2174,7 @@ void tst_QGraphicsView::sendEvent()
QCOMPARE(item->events.last(), QEvent::KeyPress);
}
+#ifndef QT_NO_WHEELEVENT
class MouseWheelScene : public QGraphicsScene
{
public:
@@ -2228,6 +2231,7 @@ void tst_QGraphicsView::wheelEvent()
QCOMPARE(spy.count(), 2);
QVERIFY(widget->hasFocus());
}
+#endif // !QT_NO_WHEELEVENT
#ifndef QTEST_NO_CURSOR
void tst_QGraphicsView::cursor()
diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
index 4bea53c926..a11d423896 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -195,15 +195,19 @@ private slots:
void task191545_dragSelectRows();
void taskQTBUG_5062_spansInconsistency();
void taskQTBUG_4516_clickOnRichTextLabel();
+#ifndef QT_NO_WHEELEVENT
void taskQTBUG_5237_wheelEventOnHeader();
+#endif
void taskQTBUG_8585_crashForNoGoodReason();
void taskQTBUG_7774_RtoLVisualRegionForSelection();
void taskQTBUG_8777_scrollToSpans();
void taskQTBUG_10169_sizeHintForRow();
void taskQTBUG_30653_doItemsLayout();
+#ifndef QT_NO_WHEELEVENT
void mouseWheel_data();
void mouseWheel();
+#endif
void addColumnWhileEditing();
void task234926_setHeaderSorting();
@@ -3994,7 +3998,7 @@ void tst_QTableView::task248688_autoScrollNavigation()
}
}
-
+#ifndef QT_NO_WHEELEVENT
void tst_QTableView::mouseWheel_data()
{
QTest::addColumn<int>("scrollMode");
@@ -4051,6 +4055,7 @@ void tst_QTableView::mouseWheel()
QApplication::sendEvent(view.viewport(), &verticalEvent);
QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
}
+#endif // !QT_NO_WHEELEVENT
void tst_QTableView::addColumnWhileEditing()
{
@@ -4311,6 +4316,7 @@ void tst_QTableView::changeHeaderData()
QVERIFY(view.verticalHeader()->width() > textWidth);
}
+#ifndef QT_NO_WHEELEVENT
void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
{
QTableView view;
@@ -4327,6 +4333,7 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
int sbValueAfter = view.verticalScrollBar()->value();
QVERIFY(sbValueBefore != sbValueAfter);
}
+#endif
class TestTableView : public QTableView {
Q_OBJECT
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index c3e8b51ccd..c9a1a64135 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -149,7 +149,9 @@ private slots:
void execAfterExit();
+#ifndef QT_NO_WHEELEVENT
void wheelScrollLines();
+#endif
void task109149();
@@ -1844,6 +1846,7 @@ void tst_QApplication::execAfterExit()
QCOMPARE(exitCode, 0);
}
+#ifndef QT_NO_WHEELEVENT
void tst_QApplication::wheelScrollLines()
{
int argc = 1;
@@ -1851,6 +1854,7 @@ void tst_QApplication::wheelScrollLines()
// If wheelScrollLines returns 0, the mose wheel will be disabled.
QVERIFY(app.wheelScrollLines() > 0);
}
+#endif // !QT_NO_WHEELEVENT
void tst_QApplication::style()
{
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index 7cb15fab3f..3c150e77b9 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
@@ -79,8 +79,10 @@ private slots:
void minimum_maximum();
void keyPressed_data();
void keyPressed();
+#ifndef QT_NO_WHEELEVENT
void wheelEvent_data();
void wheelEvent();
+#endif
void sliderPressedReleased_data();
void sliderPressedReleased();
void setOrientation();
@@ -691,6 +693,7 @@ void tst_QAbstractSlider::keyPressed()
QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted);
}
+#ifndef QT_NO_WHEELEVENT
void tst_QAbstractSlider::wheelEvent_data()
{
QTest::addColumn<int>("initialSliderPosition");
@@ -894,6 +897,7 @@ void tst_QAbstractSlider::wheelEvent()
if (expectedSignalCount)
QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp);
}
+#endif // !QT_NO_WHEELEVENT
void tst_QAbstractSlider::sliderPressedReleased_data()
{
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 2a012f0dcd..7b4b65e841 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -122,9 +122,11 @@ private slots:
void flaggedItems_data();
void flaggedItems();
void pixmapIcon();
+#ifndef QT_NO_WHEELEVENT
void mouseWheel_data();
void mouseWheel();
void popupWheelHandling();
+#endif // !QT_NO_WHEELEVENT
void layoutDirection();
void itemListPosition();
void separatorItem_data();
@@ -2004,6 +2006,7 @@ void tst_QComboBox::pixmapIcon()
QCOMPARE( box.itemIcon(1).isNull(), false );
}
+#ifndef QT_NO_WHEELEVENT
// defined to be 120 by the wheel mouse vendors according to the docs
#define WHEEL_DELTA 120
@@ -2094,6 +2097,7 @@ void tst_QComboBox::popupWheelHandling()
QVERIFY(comboBox->view()->isVisible());
QCOMPARE(comboBox->view()->pos(), popupPos);
}
+#endif // !QT_NO_WHEELEVENT
void tst_QComboBox::layoutDirection()
{
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index 8f6d54e325..c9ae60dd76 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -236,7 +236,9 @@ private slots:
void reverseTest();
void ddMMMMyyyy();
+#ifndef QT_NO_WHEELEVENT
void wheelEvent();
+#endif
void specialValueCornerCase();
void cursorPositionOnInit();
@@ -3028,6 +3030,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy()
QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200");
}
+#ifndef QT_NO_WHEELEVENT
void tst_QDateTimeEdit::wheelEvent()
{
testWidget->setDisplayFormat("dddd/MM");
@@ -3040,6 +3043,7 @@ void tst_QDateTimeEdit::wheelEvent()
qApp->sendEvent(testWidget, &w);
QCOMPARE(testWidget->date(), QDate(2000, 3, 22));
}
+#endif // !QT_NO_WHEELEVENT
void tst_QDateTimeEdit::specialValueCornerCase()
{
diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
index d4834a04e2..2d4a453b58 100644
--- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
+++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
@@ -43,6 +43,9 @@ private slots:
void convertRgb888ToRgb32_data();
void convertRgb888ToRgb32();
+ void convertRgb888ToRgbx8888_data();
+ void convertRgb888ToRgbx8888();
+
void convertRgb32ToRgb888_data();
void convertRgb32ToRgb888();
@@ -74,8 +77,8 @@ void tst_QImageConversion::convertRgb888ToRgb32_data()
// 16 pixels, minimum for the SSSE3 implementation
QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
- // 50 pixels, more realistic use case
- QTest::newRow("width: 50px; height: 5000px;") << generateImageRgb888(50, 5000);
+ // 200 pixels, more realistic use case
+ QTest::newRow("width: 200px; height: 5000px;") << generateImageRgb888(200, 5000);
// 2000 pixels -> typical values for pictures
QTest::newRow("width: 2000px; height: 2000px;") << generateImageRgb888(2000, 2000);
@@ -93,6 +96,23 @@ void tst_QImageConversion::convertRgb888ToRgb32()
}
}
+void tst_QImageConversion::convertRgb888ToRgbx8888_data()
+{
+ convertRgb888ToRgb32_data();
+}
+
+void tst_QImageConversion::convertRgb888ToRgbx8888()
+{
+ QFETCH(QImage, inputImage);
+
+ QBENCHMARK {
+ volatile QImage output = inputImage.convertToFormat(QImage::Format_RGBX8888);
+ // we need the volatile and the following to make sure the compiler does not do
+ // anything stupid :)
+ (void)output;
+ }
+}
+
void tst_QImageConversion::convertRgb32ToRgb888_data()
{
QTest::addColumn<QImage>("inputImage");
diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp
index 2ac57986b3..5a83decfa2 100644
--- a/tests/manual/qtabletevent/regular_widgets/main.cpp
+++ b/tests/manual/qtabletevent/regular_widgets/main.cpp
@@ -147,29 +147,23 @@ void EventReportWidget::paintEvent(QPaintEvent *)
void EventReportWidget::tabletEvent(QTabletEvent *event)
{
-
QWidget::tabletEvent(event);
- QString type;
+ bool isMove = false;
switch (event->type()) {
case QEvent::TabletEnterProximity:
- type = QString::fromLatin1("TabletEnterProximity");
- break;
case QEvent::TabletLeaveProximity:
- type = QString::fromLatin1("TabletLeaveProximity");
break;
case QEvent::TabletMove:
- type = QString::fromLatin1("TabletMove");
m_points.push_back(TabletPoint(event->pos(), TabletMove, m_lastButton, event->pointerType(), event->pressure(), event->rotation()));
update();
+ isMove = true;
break;
case QEvent::TabletPress:
- type = QString::fromLatin1("TabletPress");
m_points.push_back(TabletPoint(event->pos(), TabletButtonPress, event->button(), event->pointerType(), event->rotation()));
m_lastButton = event->button();
update();
break;
case QEvent::TabletRelease:
- type = QString::fromLatin1("TabletRelease");
m_points.push_back(TabletPoint(event->pos(), TabletButtonRelease, event->button(), event->pointerType(), event->rotation()));
update();
break;
@@ -178,84 +172,24 @@ void EventReportWidget::tabletEvent(QTabletEvent *event)
break;
}
- QString pointerType = "UNKNOWN";
- switch (event->pointerType()) {
- case QTabletEvent::Pen:
- pointerType = "Pen";
- break;
- case QTabletEvent::Cursor:
- pointerType = "Cursor";
- break;
- case QTabletEvent::Eraser:
- pointerType = "Eraser";
- break;
- default:
- break;
- }
-
- QString device = "UNKNOWN";
- switch (event->device()) {
- case QTabletEvent::Puck:
- pointerType = "Puck";
- break;
- case QTabletEvent::Stylus:
- pointerType = "Stylus";
- break;
- case QTabletEvent::Airbrush:
- pointerType = "Airbrush";
- break;
- case QTabletEvent::FourDMouse:
- pointerType = "FourDMouse";
- break;
- case QTabletEvent::RotationStylus:
- pointerType = "RotationStylus";
- break;
- default:
- break;
+ if (!(isMove && m_lastIsTabletMove)) {
+ QDebug d = qDebug();
+ d << event << " global position = " << event->globalPos()
+ << " cursor at " << QCursor::pos();
+ if (event->button() != Qt::NoButton)
+ d << " changed button " << event->button();
}
-
- if (!m_lastIsTabletMove)
- qDebug() << "Tablet event, type = " << type
- << " position = " << event->pos()
- << " global position = " << event->globalPos()
- << " cursor at " << QCursor::pos()
- << " buttons " << event->buttons() << " changed " << event->button()
- << " pointer type " << pointerType << " device " << device;
-
- m_lastIsTabletMove = (event->type() == QEvent::TabletMove);
+ m_lastIsTabletMove = isMove;
}
void EventReportWidget::outputMouseEvent(QMouseEvent *event)
{
- QString type;
- switch (event->type()) {
- case QEvent::MouseButtonDblClick:
- m_lastIsMouseMove = false;
- type = QString::fromLatin1("MouseButtonDblClick");
- break;
- case QEvent::MouseButtonPress:
- m_lastIsMouseMove = false;
- type = QString::fromLatin1("MouseButtonPress");
- break;
- case QEvent::MouseButtonRelease:
- m_lastIsMouseMove = false;
- type = QString::fromLatin1("MouseButtonRelease");
- break;
- case QEvent::MouseMove:
+ if (event->type() == QEvent::MouseMove) {
if (m_lastIsMouseMove)
return; // only show one move to keep things readable
-
m_lastIsMouseMove = true;
- type = QString::fromLatin1("MouseMove");
- break;
- default:
- Q_ASSERT(false);
- break;
}
-
- qDebug() << "Mouse event, type = " << type
- << " position = " << event->pos()
- << " global position = " << event->globalPos();
+ qDebug() << event;
}
int main(int argc, char *argv[])