tests: Make tst_scaling more robust

When a fractional scaling value is sent, we expect the client DPR to
update, and a new frame sent to the compositor.

We can't be sure that our compositor thread won't already have the new
frame by the time we call surfaceCommitSpy.wait.

Change-Id: Iab7d57f07e854a79e69b97631fe1b6006a061b82
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: David Redondo <qt@david-redondo.de>
This commit is contained in:
David Edmundson 2024-09-16 14:36:01 +01:00
parent 577d4e2244
commit 8b9b2dec19

View File

@ -70,6 +70,8 @@ void tst_scaling::scaledWindow()
QCOMPARE(vp->m_destination, QSize(200, 200));
});
surfaceCommitSpy.clear();
// dynamic scale change
exec([&] {
QVERIFY(fractionalScale());
@ -77,8 +79,8 @@ void tst_scaling::scaledWindow()
});
QTRY_COMPARE(window.devicePixelRatio(), 2.5);
QCOMPARE(window.size(), QSize(200,200));
QTRY_VERIFY(surfaceCommitSpy.count());
QVERIFY(surfaceCommitSpy.wait());
exec([&] {
Buffer *buffer = xdgToplevel()->surface()->m_committed.buffer;
QVERIFY(buffer);