[frameworks/kirigami] autotests: ImageColors: de-flake test_extractColors

Méven Car <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 90b7c3c823eeb7f65373bb2d4a7694422ab4b0f1 by Méven Car.
Committed on 17/08/2026 at 10:27.
Pushed by meven into branch 'master'.

ImageColors: de-flake test_extractColors

Palette extraction is a three-hop async chain: update() grabs the item
(grabToImage completes only after a render pass), generatePalette() then runs
on a worker thread, and paletteChanged is emitted from the future watcher. The
default 5s SignalSpy.wait() timeout could be exceeded on a loaded CI runner
(seen failing on FreeBSD), so wait longer.

Also wait for a render pass after setting the color, so grabToImage captures
the intended color rather than whatever was painted before the change.

M  +5    -1    autotests/tst_ImageColors.qml

https://invent.kde.org/frameworks/kirigami/-/commit/90b7c3c823eeb7f65373bb2d4a7694422ab4b0f1

diff --git a/autotests/tst_ImageColors.qml b/autotests/tst_ImageColors.qml
index 23e6cbe89..3a57f33f8 100644
--- a/autotests/tst_ImageColors.qml
+++ b/autotests/tst_ImageColors.qml
@@ -97,8 +97,12 @@ TestCase {
         const { colorArea, imageColors, paletteChangedSpy } = item;
 
         colorArea.color = Qt.rgba(1, 0, 0);
+        // Make sure the new color has actually been rendered before update() grabs
+        // the item (grabToImage only completes after a render pass).
+        verify(waitForRendering(testCase));
         imageColors.update();
-        paletteChangedSpy.wait();
+        // Palette extraction then runs on a worker thread; give slow CI headroom.
+        paletteChangedSpy.wait(10000);
         compare(paletteChangedSpy.count, 1);
         compare(imageColors.dominant, colorArea.color);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.