aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2022-11-16 09:40:34 +0100
committerEike Ziller <eike.ziller@qt.io>2022-11-16 09:40:34 +0100
commitae67799eb369da72a3a2da3fff0fd14dbf1a6e39 (patch)
tree38e2cba3f8183ac5b9553c4c07b1b23abe7b63fb /tests
parentf297b3f1b54ac2c4326ca1f55bdd0705c626ec35 (diff)
parent779dc52a976f7604c114e47d167d6b8537c4efd0 (diff)
Merge remote-tracking branch 'origin/9.0'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/utils/fileutils/tst_fileutils.cpp26
-rw-r--r--tests/system/objects.map4
-rw-r--r--tests/system/suite_editors/tst_memberoperator/test.py46
-rw-r--r--tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv4
-rw-r--r--tests/system/suite_general/tst_installed_languages/testdata/languages.tsv2
5 files changed, 60 insertions, 22 deletions
diff --git a/tests/auto/utils/fileutils/tst_fileutils.cpp b/tests/auto/utils/fileutils/tst_fileutils.cpp
index 5fb8fa2d0c7..1446f82096f 100644
--- a/tests/auto/utils/fileutils/tst_fileutils.cpp
+++ b/tests/auto/utils/fileutils/tst_fileutils.cpp
@@ -30,6 +30,9 @@ signals:
private slots:
void initTestCase();
+ void isEmpty_data();
+ void isEmpty();
+
void parentDir_data();
void parentDir();
@@ -143,6 +146,29 @@ void tst_fileutils::initTestCase()
touch(dir, "x/y/fileToCopy.txt", true);
}
+void tst_fileutils::isEmpty_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<bool>("result");
+
+ QTest::newRow("empty path") << "" << true;
+ QTest::newRow("root only") << "/" << false;
+ QTest::newRow("//") << "//" << false;
+ QTest::newRow("scheme://host") << "scheme://host" << true; // Intentional (for now?)
+ QTest::newRow("scheme://host/") << "scheme://host/" << false;
+ QTest::newRow("scheme://host/a") << "scheme://host/a" << false;
+ QTest::newRow("scheme://host/.") << "scheme://host/." << false;
+}
+
+void tst_fileutils::isEmpty()
+{
+ QFETCH(QString, path);
+ QFETCH(bool, result);
+
+ FilePath filePath = FilePath::fromString(path);
+ QCOMPARE(filePath.isEmpty(), result);
+}
+
void tst_fileutils::parentDir_data()
{
QTest::addColumn<QString>("path");
diff --git a/tests/system/objects.map b/tests/system/objects.map
index a6f3b23cdef..074275eba8c 100644
--- a/tests/system/objects.map
+++ b/tests/system/objects.map
@@ -41,7 +41,6 @@
:Cannot Open Project_QTextEdit {type='QTextEdit' unnamed='1' visible='1' window=':Cannot Open Project_QMessageBox'}
:Close Debugging Session.Yes_QPushButton {text='Yes' type='QPushButton' unnamed='1' visible='1' window=':Close Debugging Session_Utils::CheckableMessageBox'}
:Close Debugging Session_Utils::CheckableMessageBox {type='Utils::CheckableMessageBox' unnamed='1' visible='1' windowTitle='Close Debugging Session'}
-:Core__Internal__GeneralSettings.User Interface_QGroupBox {container=':qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget' name='interfaceBox' title='User Interface' type='QGroupBox' visible='1'}
:CppCompiler:_QComboBox {container=':qt_tabwidget_stackedwidget_QWidget' leftWidget=':CppCompiler:_QLabel' type='QComboBox' unnamed='1' visible='1'}
:CppCompiler:_QLabel {container=':qt_tabwidget_stackedwidget_QWidget' text='C++:' type='QLabel' unnamed='1' visible='1'}
:CppTools__Internal__CompletionSettingsPage.Behavior_QGroupBox {container=':qt_tabwidget_stackedwidget_QScrollArea' name='Behavior' type='QGroupBox' visible='1'}
@@ -194,7 +193,7 @@
:Send to Codepaster_CodePaster::PasteView {name='CodePaster.ViewDialog' type='QDialog' visible='1' windowTitle='Send to Codepaster'}
:Session Manager_ProjectExplorer::Internal::SessionDialog {name='ProjectExplorer.SessionDialog' type='ProjectExplorer::Internal::SessionDialog' visible='1' windowTitle='Session Manager'}
:Startup.contextHelpComboBox_QComboBox {container=':Form.Startup_QGroupBox' name='contextHelpComboBox' type='QComboBox' visible='1'}
-:User Interface.languageBox_QComboBox {container=':Core__Internal__GeneralSettings.User Interface_QGroupBox' name='languageBox' type='QComboBox' visible='1'}
+:User Interface.languageBox_QComboBox {name='languageBox' type='QComboBox' visible='1'}
:Utils::FakeToolTip {type='Utils::FakeToolTip' unnamed='1' visible='1'}
:Widget Box_qdesigner_internal::WidgetBoxTreeWidget {container=':*Qt Creator.Widget Box_QDockWidget' type='qdesigner_internal::WidgetBoxTreeWidget' unnamed='1' visible='1'}
:Working Copy_Utils::BaseValidatingLineEdit {type='Utils::FancyLineEdit' unnamed='1' visible='1' window=':New_ProjectExplorer::JsonWizard'}
@@ -208,7 +207,6 @@
:projectComboBox_QComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='QComboBox' visible='1'}
:projectComboBox_Utils::TreeViewComboBox {buddy=':New Text File.Add to project:_QLabel' name='projectComboBox' type='Utils::TreeViewComboBox' visible='1'}
:qdesigner_internal::WidgetBoxCategoryListView {container=':Widget Box_qdesigner_internal::WidgetBoxTreeWidget' occurrence='3' type='qdesigner_internal::WidgetBoxCategoryListView' unnamed='1' visible='1'}
-:qt_tabwidget_stackedwidget.Core__Internal__GeneralSettings_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' name='Core__Internal__GeneralSettings' type='QWidget' visible='1'}
:qt_tabwidget_stackedwidget.QtSupport__Internal__QtVersionManager_QtSupport::Internal::QtOptionsPageWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QScrollArea' unnamed='1' visible='1'}
:qt_tabwidget_stackedwidget_QScrollArea {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QScrollArea' unnamed='1' visible='1'}
:qt_tabwidget_stackedwidget_QWidget {container=':Options.qt_tabwidget_stackedwidget_QStackedWidget' type='QWidget' unnamed='1' visible='1'}
diff --git a/tests/system/suite_editors/tst_memberoperator/test.py b/tests/system/suite_editors/tst_memberoperator/test.py
index 14419e1fa46..18d5547f324 100644
--- a/tests/system/suite_editors/tst_memberoperator/test.py
+++ b/tests/system/suite_editors/tst_memberoperator/test.py
@@ -16,7 +16,22 @@ def __getGenericProposalListView__(timeout):
def __verifyLineUnderCursor__(cppwindow, record):
found = str(lineUnderCursor(cppwindow)).strip()
exp = testData.field(record, "expected")
- test.compare(found, exp)
+ test.verify(found.startswith(exp),
+ "Completed line '%s' should start with '%s'" % (found, exp))
+
+
+def __noBuildIssues__():
+ return len(getBuildIssues()) == 0
+
+
+def __syntaxErrorDetected__():
+ buildIssues = getBuildIssues()
+ for issue in buildIssues:
+ if issue[3] in ["Expected ';' after expression (fix available)",
+ "Expected ';' at end of declaration (fix available)",
+ "Use of undeclared identifier 'syntaxError'"]:
+ return True
+ return False
def main():
@@ -38,7 +53,13 @@ def main():
placeCursorToLine(cppwindow, "return a.exec();")
typeLines(cppwindow, ("<Up>", testData.field(record, "declaration")))
type(cppwindow, testData.field(record, "usage"))
- snooze(1) # maybe find something better
+ if useClang:
+ if not waitFor(__syntaxErrorDetected__, 5000):
+ test.warning("Waiting for code model to find a syntax error timed out",
+ "If the code model's messages didn't change, "
+ "consider raising the timeout.")
+ else:
+ snooze(1)
type(cppwindow, testData.field(record, "operator"))
genericProposalWidget = __getGenericProposalListView__(1500)
# the clang code model does not change the . to -> before applying a proposal
@@ -49,22 +70,11 @@ def main():
'Verifying whether proposal widget is displayed as expected.')
if genericProposalWidget is not None:
- model = genericProposalWidget.model()
- proposalToolTips = dumpItems(model, role=WhatsThisRole)
- needCorrection = filter(lambda x: 'Requires changing "." to "->"' in x,
- proposalToolTips)
correction = testData.field(record, "correction")
- if correction == 'all':
+ if correction in ['all', 'none']:
+ type(genericProposalWidget, "<Return>")
__verifyLineUnderCursor__(cppwindow, record)
- test.compare(len(needCorrection), 0,
- "Verifying whether operator has been already corrected.")
- elif correction == 'mixed':
- test.verify(len(proposalToolTips) > len(needCorrection) > 0,
- "Verifying whether some of the proposals need correction.")
- elif correction == 'none':
- test.verify(len(needCorrection) == 0,
- "Verifying whether no proposal needs a correction.")
- else:
+ elif correction != 'mixed' and expectProposal:
test.warning("Used tsv file seems to be broken - found '%s' in "
"correction column." % correction)
elif not expectProposal:
@@ -73,5 +83,9 @@ def main():
__verifyLineUnderCursor__(cppwindow, record)
invokeMenuItem("File", 'Revert "main.cpp" to Saved')
clickButton(waitForObject(":Revert to Saved.Proceed_QPushButton"))
+ if useClang and not waitFor(__noBuildIssues__, 5000):
+ test.warning("Waiting for code model timed out",
+ "If there is no new issue detected in the code, "
+ "consider raising the timeout.")
invokeMenuItem("File", "Exit")
waitForCleanShutdown()
diff --git a/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv b/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv
index 89831a431bb..482903ad1bb 100644
--- a/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv
+++ b/tests/system/suite_editors/tst_memberoperator/testdata/usages.tsv
@@ -9,13 +9,13 @@
"" "QCoreApplication &ref = a;" "ref" "." "ref." "True" "none"
"<QPointer>" "QPointer<QCoreApplication> p;" "p" "." "p." "True" "mixed"
"<QPointer>" "QPointer<QCoreApplication> *poi;" "poi" "." "poi->" "True" "all"
-"<QPointer>" "QPointer<QCoreApplication> &poi;" "poi" "." "poi." "False" ""
+"<QPointer>" "QPointer<QCoreApplication> &poi;" "poi" "." "poi." "True" "mixed"
"<QPointer>" "QPointer<QCoreApplication> pa; QPointer<QCoreApplication> &poi = pa;" "poi" "." "poi." "True" "mixed"
"<QPointer>" "QPointer<QCoreApplication> poi[5];" "poi[2]" "." "poi[2]." "True" "mixed"
"<QPointer>" "QPointer<QCoreApplication> *poi[5];" "poi[2]" "." "poi[2]->" "True" "all"
"<memory>" "std::auto_ptr<QCoreApplication> sap;" "sap" "." "sap." "True" "mixed"
"<memory>" "std::auto_ptr<QCoreApplication> *sap;" "sap" "." "sap->" "True" "all"
-"<memory>" "std::auto_ptr<QCoreApplication> &sap;" "sap" "." "sap." "False" ""
+"<memory>" "std::auto_ptr<QCoreApplication> &sap;" "sap" "." "sap." "True" "mixed"
"<memory>" "std::auto_ptr<QCoreApplication> sapqa; std::auto_ptr<QCoreApplication> &sap = sapqa;" "sap" "." "sap." "True" "mixed"
"<memory>" "std::auto_ptr<QCoreApplication> sap[10];" "sap[2]" "." "sap[2]." "True" "mixed"
"<memory>" "std::auto_ptr<QCoreApplication> *sap[10];" "sap[2]" "." "sap[2]->" "True" "all"
diff --git a/tests/system/suite_general/tst_installed_languages/testdata/languages.tsv b/tests/system/suite_general/tst_installed_languages/testdata/languages.tsv
index fb8aa0c011c..78eeee245d9 100644
--- a/tests/system/suite_general/tst_installed_languages/testdata/languages.tsv
+++ b/tests/system/suite_general/tst_installed_languages/testdata/languages.tsv
@@ -1,5 +1,5 @@
"language" "Exit" "ISO"
-"Czech (Czech Republic)" "Ukončit" "cs_CZ"
+"Czech (Czechia)" "Ukončit" "cs_CZ"
"Danish (Denmark)" "Afslut" "da_DK"
"German (Germany)" "Beenden" "de_DE"
"French (France)" "Quitter" "fr_FR"