Add test for additional form actions
ClosedPublic

Authored by aheinecke on May 28 2018, 12:37 PM.

Details

Summary

This tests the newly added additional widget actions.

Test Plan

Passes for me. Is my first GUI test, maybe the timing
needs to be slower for slower machines?

Diff Detail

Repository
R223 Okular
Lint
No Linters Available
Unit
No Unit Test Coverage
aheinecke created this revision.May 28 2018, 12:37 PM
Restricted Application added a subscriber: okular-devel. · View Herald TranscriptMay 28 2018, 12:37 PM
aheinecke requested review of this revision.May 28 2018, 12:37 PM
aacid requested changes to this revision.May 28 2018, 3:12 PM

QTest::qWait( 100 ); is bad as you probably already guessed since it's "machine dependant".

In those cases you awnt to use the QTRY_ versions, i.e. QTRY_VERIFY2 instead of QVERIFY2

Also you probably want QCOMPARE instead of QVERIFY if your QVERIFY has a == inside, because that way when it fails it already says the expected: actual: values without you having to construct the string (in this case we want QTRY_COMPARE to be able to remove the wait() calls).

Hope i made sense :D

This revision now requires changes to proceed.May 28 2018, 3:12 PM

QTest::qWait( 100 ); is bad as you probably already guessed since it's "machine dependant".

Yeah, looked fishy ;-) Although stuff like that is used in part test on other places so i've copied it.

In those cases you awnt to use the QTRY_ versions, i.e. QTRY_VERIFY2 instead of QVERIFY2

I'll try.

Also you probably want QCOMPARE instead of QVERIFY if your QVERIFY has a == inside, because that way when it fails it already says the expected: actual: values without you having to construct the string (in this case we want QTRY_COMPARE to be able to remove the wait() calls).

I used QVERIFY2 with the equality operator because there is no QCOMPARE2 for QVERIFY So I can't add a message. And if I use such a helper function I need to know the actual failure line.

Hope i made sense :D

Yes, thanks :-)

aheinecke updated this revision to Diff 35084.May 29 2018, 8:51 AM

Use QTRY instead of QTest::wait. This is acutally much faster.

QTest::qWait( 100 ); is bad as you probably already guessed since it's "machine dependant".

Yeah, looked fishy ;-) Although stuff like that is used in part test on other places so i've copied it.

Well Ok, only in the testAnnotWindow,.. so it's not really used in other places.

aacid accepted this revision.May 30 2018, 8:01 AM
This revision is now accepted and ready to land.May 30 2018, 8:01 AM
This revision was automatically updated to reflect the committed changes.