[SOLVED] Show Widget in UnitTest - Qt 5.3
-
I want to use a gui-Test in my UnitTests. Different to the normal use, I want to show a QWidget with Buttons etc. and use it as a Simulator (for example for Cameras)
At Qt 4.3 all is running well but under Qt 5.3 - the Unit Test starts but I can't see the Widget.
Does anyone has the same problem?
-
Hi and welcome to devnet,
Can you post a minimal code sample that reproduce this ?
-
Thanks for the answer. Oh yes sorry. Here I have a little example which works on Qt 4.8.3 but not at Qt 5.3. I see that the test is running but I cant't see the label.
@
try {
QLabel* pMain = new QLabel(0);
pMain->setMinimumSize(480+25, 480+90);pMain->show(); while (pMain->isVisible()) { QTest::qWait(50); }
} catch (const std::exception &x) {
// do something
}
@ -
I can't say for sure why, but calling show and isVisible in a row without waiting, you where probably lucky with Qt 4.8 that it worked.
-
I test this case, too. But has nothing changed.
-
You can try qWaitForWindowExposed
-
Thank you for your help. I fixed the problem now. I had an TestMain which executes the tests and there I set the qminimal plugin. Because of this I haven't seen the GUI.
-
You're welcome !
Nice you found a solution !
Since it's all working now please update the thread title prepending [solved] so other forum users may know a solution has been found :)