2016-01-15 14:55:33 +01:00
|
|
|
# Copyright (C) 2016 The Qt Company Ltd.
|
2022-08-19 15:59:36 +02:00
|
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2013-07-23 16:41:06 +02:00
|
|
|
|
|
|
|
|
source("../../shared/qtcreator.py")
|
|
|
|
|
|
|
|
|
|
def main():
|
2018-08-22 14:37:34 +02:00
|
|
|
startQC()
|
2013-07-23 16:41:06 +02:00
|
|
|
if not startedWithoutPluginError():
|
|
|
|
|
return
|
|
|
|
|
createProject_Qt_GUI(tempDir(), "DesignerTestApp")
|
|
|
|
|
selectFromLocator("mainwindow.ui")
|
|
|
|
|
dragAndDrop(waitForObject("{container=':qdesigner_internal::WidgetBoxCategoryListView'"
|
|
|
|
|
"text='Push Button' type='QModelIndex'}"), 5, 5,
|
|
|
|
|
":FormEditorStack_qdesigner_internal::FormWindow", 20, 50, Qt.CopyAction)
|
|
|
|
|
for buttonName in [None, "aDifferentName", "anotherDifferentName", "pushButton"]:
|
|
|
|
|
if buttonName:
|
|
|
|
|
openContextMenu(waitForObject("{container=':*Qt Creator.FormEditorStack_Designer::Internal::FormEditorStack'"
|
|
|
|
|
"text='PushButton' type='QPushButton' visible='1'}"), 5, 5, 1)
|
2019-12-03 09:36:32 +01:00
|
|
|
activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1'}", "Change objectName..."))
|
2013-07-23 16:41:06 +02:00
|
|
|
typeLines(waitForObject(":FormEditorStack_qdesigner_internal::PropertyLineEdit"), buttonName)
|
|
|
|
|
else:
|
|
|
|
|
# Verify that everything works without ever changing the name
|
|
|
|
|
buttonName = "pushButton"
|
|
|
|
|
selectFromLocator("mainwindow.cpp")
|
|
|
|
|
editor = waitForObject(":Qt Creator_CppEditor::Internal::CPPEditorWidget")
|
|
|
|
|
for tryDotOperator in [False, True]:
|
|
|
|
|
if not placeCursorToLine(editor, "ui->setupUi(this);"):
|
|
|
|
|
earlyExit("Maybe the project template changed.")
|
|
|
|
|
return
|
|
|
|
|
type(editor, "<Return>")
|
|
|
|
|
type(editor, "ui")
|
|
|
|
|
if tryDotOperator:
|
|
|
|
|
snooze(1)
|
|
|
|
|
type(editor, ".")
|
|
|
|
|
waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500)
|
|
|
|
|
else:
|
|
|
|
|
type(editor, "-")
|
|
|
|
|
snooze(1)
|
|
|
|
|
type(editor, ">")
|
2013-09-25 14:48:05 +02:00
|
|
|
snooze(1)
|
2013-07-23 16:41:06 +02:00
|
|
|
nativeType("%s" % buttonName[0])
|
|
|
|
|
test.verify(waitFor("object.exists(':popupFrame_TextEditor::GenericProposalWidget')", 1500),
|
|
|
|
|
"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))
|
|
|
|
|
type(editor, "<Shift+Delete>") # Delete line
|
|
|
|
|
selectFromLocator("mainwindow.ui")
|
2022-12-15 10:54:08 +01:00
|
|
|
saveAndExit()
|