Skip to content

Commit 142da63

Browse files
fernandotononclaude
andcommitted
test: fix flaky MainWindowTest.ModeBarLoadsAndModeChange (show window first)
This test failed intermittently on CI (Xvfb) with: Value of: window->m_modeBarShell->isHidden() Actual: true Expected: false The fixture constructs MainWindow but never show()s it. QToolBar::isHidden() reflects effective visibility, which is only realized once the parent window is mapped — so under Xvfb the shell reports hidden and the assertion is racy. It hit BOTH this branch and the unrelated CI-only PR #756 (which has no source changes), confirming it's a pre-existing flake, not a regression. Fix: show() the window and processEvents() before the visibility assertion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b8d5159 commit 142da63

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/mainwindow_test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ TEST_F(MainWindowTest, ModeBarLoadsAndModeChangeUpdatesStatusIndicator)
282282
ASSERT_EQ(window->m_modeBar->status(), QQuickWidget::Ready);
283283
EXPECT_GE(window->m_modeBar->minimumWidth(), 560);
284284
EXPECT_EQ(window->toolBarArea(window->m_modeBarShell), Qt::TopToolBarArea);
285+
// QToolBar::isHidden() reflects effective visibility, which is only
286+
// meaningful once the parent window has been shown. The fixture constructs
287+
// MainWindow without show()ing it, so under Xvfb this assertion was flaky
288+
// (the shell reports hidden until the window is mapped). Show the window and
289+
// drain events so the toolbar's visibility is realized before asserting.
290+
window->show();
291+
app->processEvents();
285292
EXPECT_FALSE(window->m_modeBarShell->isHidden());
286293
ASSERT_NE(window->m_editModeLabel, nullptr);
287294

0 commit comments

Comments
 (0)