SquishTests: Don't proceed in hopeless situation

When the GenericProposalWidget is not being shown,
there's no point in trying to use it.

Change-Id: Ibe6f3ed9230fdc41271f5ff8538bd863da3d0ab3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Robert Löhning
2024-04-23 13:01:07 +02:00
parent 15446c9e3f
commit 394e9a9fb3

View File

@@ -48,12 +48,15 @@ def main():
snooze(1)
type(editor, ">")
snooze(1)
proposalExists = lambda: object.exists(':popupFrame_TextEditor::GenericProposalWidget')
nativeType("%s" % buttonName[0])
test.verify(waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500),
"Verify that GenericProposalWidget is being shown.")
if test.verify(waitFor(proposalExists, 4000),
"Verify that GenericProposalWidget is being shown."):
nativeType("<Return>")
test.verify(waitFor('str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName', 1000),
'Comparing line "%s" to expected "%s"' % (lineUnderCursor(editor), "ui->%s" % buttonName))
lineCorrect = lambda: str(lineUnderCursor(editor)).strip() == "ui->%s" % buttonName
test.verify(waitFor(lineCorrect, 1000),
('Comparing line "%s" to expected "%s"'
% (lineUnderCursor(editor), "ui->%s" % buttonName)))
type(editor, "<Shift+Delete>") # Delete line
selectFromLocator("mainwindow.ui")
saveAndExit()