Squish: Fix verification of tool tips

Change-Id: I12487c784cf784ca7ddf705895c99f0ed912b0f4
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
This commit is contained in:
Christian Stenger
2019-02-14 09:28:01 +01:00
parent ac4ec98735
commit a112ca317b
3 changed files with 20 additions and 16 deletions

View File

@@ -263,6 +263,7 @@ void ToolTip::showInternal(const QPoint &pos, const QVariant &content,
m_tip = new WidgetTip(target);
break;
}
m_tip->setObjectName("qcToolTip");
m_tip->setContent(content);
m_tip->setContextHelp(contextHelp);
setUp(pos, w, rect);

View File

@@ -147,7 +147,7 @@ def verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, e
for ty in additionalKeyPresses:
type(editor, ty)
rect = editor.cursorRect(editor.textCursor())
expectedToolTip = "{type='QTipLabel' visible='1'}"
expectedToolTip = "{type='QLabel' objectName='qcToolTip' visible='1'}"
# wait for similar tooltips to disappear
checkIfObjectExists(expectedToolTip, False, 1000, True)
sendEvent("QMouseEvent", editor, QEvent.MouseMove, rect.x+rect.width/2, rect.y+rect.height/2, Qt.NoButton, 0)

View File

@@ -124,10 +124,10 @@ def testHovering():
additionalKeyPresses = [home, "<Right>"]
expectedTypes = ["TextTip", "TextTip"]
expectedValues = [
{'text':'<table><tr><td valign=middle>FocusScope\n<p>Explicitly '
'creates a focus scope </p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>Rectangle\n<p>Paints a filled rectangle with an '
'optional border </p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
{'text':'<table><tr><td valign=middle><p>FocusScope</p><hr/><p>\n<p>Explicitly '
'creates a focus scope </p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle><p>Rectangle</p><hr/><p>\n<p>Paints a filled rectangle with an '
'optional border </p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
]
alternativeValues = [{"text":"FocusScope"}, {"text":"Rectangle"}]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
@@ -137,23 +137,26 @@ def testHovering():
lines = ['focus:\s*true', 'color:\s*"black"', 'states:\s*State\s*\{', 'transitions:\s*Transition\s*\{']
expectedTypes = ["TextTip", "TextTip", "TextTip", "TextTip"]
expectedValues = [
{'text':'<table><tr><td valign=middle>boolean<p>This property indicates whether the item has focus '
{'text':'<table><tr><td valign=middle><p>boolean</p><hr/><p><p>This property indicates whether the item has focus '
'within the enclosing focus scope. If true, this item will gain active focus when the enclosing '
'focus scope gains active focus. In the following example, <tt>input</tt> will be given active focus '
'when <tt>scope</tt> gains active focus.</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"'
'when <tt>scope</tt> gains active focus.</p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"'
'></td></tr></table>'},
{'text':'<table><tr><td valign=middle>string<p>This property holds the color used to fill the rectangle.'
'</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>State<p>This property holds the list of possible states for this item. '
{'text':'<table><tr><td valign=middle><p>string</p><hr/><p><p>This property holds the color used to fill the rectangle.'
'</p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle><p>State</p><hr/><p><p>This property holds the list of possible states for this item. '
'To change the state of this item, set the state property to one of these states, or set the state property '
'to an empty string to revert the item to its default state.'
'</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle>Transition<p>This property holds the list of transitions for this item. '
'</p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'},
{'text':'<table><tr><td valign=middle><p>Transition</p><hr/><p><p>This property holds the list of transitions for this item. '
'These define the transitions to be applied to the item whenever it changes its state.'
'</p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
'</p></p></td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
]
alternativeValues = [{"text":"Rectangle" if JIRA.isBugStillOpen(20020) else "boolean"},
{"text":"string"}, {"text":"State"}, {"text":"Transition"}]
alternativeValues = [{"text":"boolean"}, {"text":"string"}, {"text":"State"}, {"text":"Transition"}]
if JIRA.isBugStillOpen(20020):
expectedValues[0] = {'text':'<table><tr><td valign=middle>Rectangle</td><td>&nbsp;&nbsp;'
'<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}
alternativeValues[0] = {"text":"Rectangle"}
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)
test.log("Testing hovering expressions")
openDocument(focusDocumentPath % "focus\\.qml")
@@ -169,7 +172,7 @@ def testHovering():
lines=['Rectangle\s*\{.*color:\s*"#D1DBBD"', 'NumberAnimation\s*\{\s*.*Easing.OutQuint\s*\}']
additionalKeyPresses = ["<Left>", "<Left>", "<Left>", "<Left>"]
expectedTypes = ["ColorTip", "TextTip"]
expectedValues = ["#D1DBBD", {"text":"number"}]
expectedValues = ["#D1DBBD", {"text":'<table><tr><td valign=middle>number</td><td>&nbsp;&nbsp;<img src=":/utils/tooltip/images/f1.png"></td></tr></table>'}]
alternativeValues = ["#D6DBBD", None]
verifyHoveringOnEditor(editor, lines, additionalKeyPresses, expectedTypes, expectedValues, alternativeValues)