From 9028f0abdbf249192f5936977fd11691169fb3b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 31 Jul 2017 17:18:43 +0200 Subject: tst_QQuickDropArea: Pass with High DPI scaling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply device pixel ratio where appropriate. Change-Id: I166604faa3f332f800822abdbbee7b8caacf2f54 Reviewed-by: Morten Johan Sørvig --- .../quick/qquickdroparea/tst_qquickdroparea.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp index fedca98205..071a7b3607 100644 --- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp @@ -185,14 +185,17 @@ void tst_QQuickDropArea::containsDrag_external() QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction); + const qreal dpr = window.devicePixelRatio(); + const QPoint nativePos1 = QPoint(50, 50) * dpr; + const QPoint nativePos2 = QPoint(150, 50) * dpr; + QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "hasDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(evaluate(dropArea, "exitEvents"), 0); evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&alternateWindow, &data, QPoint(50, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&alternateWindow, &data, nativePos1, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); @@ -200,13 +203,13 @@ void tst_QQuickDropArea::containsDrag_external() evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "exitEvents"), 0); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&window, &data, nativePos1, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), true); QCOMPARE(evaluate(dropArea, "hasDrag"), true); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); @@ -214,13 +217,13 @@ void tst_QQuickDropArea::containsDrag_external() evaluate(dropArea, "{ enterEvents = 0; exitEvents = 0 }"); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(150, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&window, &data, nativePos2, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "containsDrag"), false); QCOMPARE(evaluate(dropArea, "hasDrag"), false); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "exitEvents"), 1); - QWindowSystemInterface::handleDrop(&window, &data, QPoint(150, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrop(&window, &data, nativePos2, Qt::CopyAction); } void tst_QQuickDropArea::keys_internal() @@ -583,7 +586,8 @@ void tst_QQuickDropArea::position_external() QMimeData data; - QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50), Qt::CopyAction); + const qreal dpr = window.devicePixelRatio(); + QWindowSystemInterface::handleDrag(&window, &data, QPoint(50, 50) * dpr, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 1); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(50)); @@ -594,7 +598,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&window, &data, QPoint(40, 50) * dpr, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(40)); @@ -605,7 +609,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventY"), qreal(50)); evaluate(dropArea, "{ enterEvents = 0; moveEvents = 0; eventX = -1; eventY = -1 }"); - QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25), Qt::CopyAction); + QWindowSystemInterface::handleDrag(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction); QCOMPARE(evaluate(dropArea, "enterEvents"), 0); QCOMPARE(evaluate(dropArea, "moveEvents"), 1); QCOMPARE(evaluate(dropArea, "drag.x"), qreal(75)); @@ -615,7 +619,7 @@ void tst_QQuickDropArea::position_external() QCOMPARE(evaluate(dropArea, "eventX"), qreal(75)); QCOMPARE(evaluate(dropArea, "eventY"), qreal(25)); - QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25), Qt::CopyAction); + QWindowSystemInterface::handleDrop(&window, &data, QPoint(75, 25) * dpr, Qt::CopyAction); } void tst_QQuickDropArea::drop_internal() -- cgit v1.2.3