tests: improve tst_gestures on GNOME

There are some issues when testing QGraphicsView on GNOME(xorg)
overlapping with the default top bar. This change only move
the view a bit.

Notes:

* There is no CentOS in CI any more.
* panelPropagation() and panelStacksBehindParent() failed in CI
and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04.

For example, we can turn the top bar off:

In Extension Manager, install Just Perfection, and disable Panel
in Visibility in it, all tests will pass too.

Task-number: QTBUG-84258
Task-number: QTBUG-103054
Pick-to: 6.4 6.2
Change-Id: I05c262540c85af00182cd142760c4a29554b04c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Liang Qi 2022-09-15 10:10:30 +02:00
parent 7ae9632929
commit 571e7a41f5
2 changed files with 16 additions and 46 deletions

View File

@ -1,50 +1,6 @@
[autoCancelGestures2]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[explicitGraphicsObjectTarget]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[graphicsItemGesture]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[graphicsView]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[graphicsViewParentPropagation]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[panelPropagation]
rhel
centos
ubuntu-18.04
ubuntu-20.04
ubuntu-22.04 ci
[panelStacksBehindParent]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[partialGesturePropagation]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[testReuseCanceledGestures]
rhel
centos
ubuntu-18.04
ubuntu-20.04
[conflictingGesturesInGraphicsView]
ubuntu-20.04
[graphicsItemTreeGesture]
ubuntu-18.04
ubuntu-20.04
ubuntu-22.04 ci

View File

@ -318,6 +318,8 @@ private slots:
void testQGestureRecognizerCleanup();
void testReuseCanceledGestures();
void bug_13501_gesture_not_accepted();
private:
QPoint m_availableTopLeft;
};
void tst_Gestures::initTestCase()
@ -325,6 +327,8 @@ void tst_Gestures::initTestCase()
CustomGesture::GestureType = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
QVERIFY(CustomGesture::GestureType != Qt::GestureType(0));
QVERIFY(CustomGesture::GestureType != Qt::CustomGesture);
const QScreen *screen = QGuiApplication::primaryScreen();
m_availableTopLeft = screen->availableGeometry().topLeft();
}
void tst_Gestures::cleanupTestCase()
@ -800,6 +804,7 @@ void tst_Gestures::graphicsItemGesture()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item = new GestureItem("item");
scene.addItem(item);
@ -862,6 +867,7 @@ void tst_Gestures::graphicsView()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item = new GestureItem("item");
scene.addItem(item);
@ -927,6 +933,7 @@ void tst_Gestures::graphicsItemTreeGesture()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item1 = new GestureItem("item1");
item1->setPos(100, 100);
@ -984,6 +991,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item1 = new GestureItem("item1");
scene.addItem(item1);
@ -1533,6 +1541,7 @@ void tst_Gestures::autoCancelGestures2()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
MockItem *parent = new MockItem("parent");
GestureItem *child = new GestureItem("child");
@ -1569,6 +1578,7 @@ void tst_Gestures::graphicsViewParentPropagation()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item0 = new GestureItem("item0");
scene.addItem(item0);
@ -1629,6 +1639,7 @@ void tst_Gestures::panelPropagation()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item0 = new GestureItem("item0");
scene.addItem(item0);
@ -1753,6 +1764,7 @@ void tst_Gestures::panelStacksBehindParent()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item1 = new GestureItem("item1");
item1->grabGesture(CustomGesture::GestureType);
@ -1940,6 +1952,7 @@ void tst_Gestures::partialGesturePropagation()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.setWindowFlags(Qt::X11BypassWindowManagerHint);
view.move(m_availableTopLeft);
GestureItem *item1 = new GestureItem("item1");
item1->grabGesture(CustomGesture::GestureType);
@ -2152,6 +2165,7 @@ void tst_Gestures::testReuseCanceledGestures()
mw.setWindowFlags(Qt::X11BypassWindowManagerHint);
QGraphicsView *gv = new QGraphicsView(&mw);
QGraphicsScene *scene = new QGraphicsScene;
mw.move(m_availableTopLeft);
gv->setScene(scene);
scene->setSceneRect(0,0,100,100);