diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-12-15 12:21:49 +0100 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-12-15 12:21:58 +0100 |
commit | ff60bf37c97b1ce398a7f8623ea108a2b4a1b313 (patch) | |
tree | 8a0af8ef7ac90863cc2f02a5dc20df5896ce3fdd /tests | |
parent | 75cfa50771323f7a2253888d651ff2b5cb36f16c (diff) | |
parent | aa6fb0da41b51d82c13a35680762f5346c75bda9 (diff) | |
download | qt-creator-ff60bf37c97b1ce398a7f8623ea108a2b4a1b313.tar.gz |
Merge remote-tracking branch 'origin/3.6'
Change-Id: I8223551aec66539dd8c55262e5000c1621410334
Diffstat (limited to 'tests')
-rw-r--r-- | tests/manual/debugger/simple/simple_test_app.cpp | 2 | ||||
-rw-r--r-- | tests/system/shared/classes.py | 4 | ||||
-rw-r--r-- | tests/system/suite_CSUP/tst_CSUP06/test.py | 4 | ||||
-rw-r--r-- | tests/system/suite_debugger/tst_cli_output_console/test.py | 4 | ||||
-rw-r--r-- | tests/unit/unittest/codecompletionsextractortest.cpp | 22 | ||||
-rw-r--r-- | tests/unit/unittest/data/complete_extractor_class.cpp | 2 | ||||
-rw-r--r-- | tests/unit/unittest/highlightinginformationstest.cpp | 4 | ||||
-rw-r--r-- | tests/unit/unittest/translationunitstest.cpp | 18 | ||||
-rw-r--r-- | tests/unit/unittest/translationunittest.cpp | 45 |
9 files changed, 86 insertions, 19 deletions
diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp index 9688dbf5eb..be92e48ea7 100644 --- a/tests/manual/debugger/simple/simple_test_app.cpp +++ b/tests/manual/debugger/simple/simple_test_app.cpp @@ -7174,7 +7174,7 @@ int main(int argc, char *argv[]) qstack::testQStack(); qstringlist::testQStringList(); qstring::testQString(); - qthread::testQThread(); + // qthread::testQThread(); qprocess::testQProcess(); qurl::testQUrl(); qvariant::testQVariant(); diff --git a/tests/system/shared/classes.py b/tests/system/shared/classes.py index e5cf6abb7d..85c4f679cd 100644 --- a/tests/system/shared/classes.py +++ b/tests/system/shared/classes.py @@ -51,8 +51,8 @@ class Targets: @staticmethod def qt4Classes(): - return (Targets.DESKTOP_474_GCC & Targets.DESKTOP_480_DEFAULT - & Targets.SIMULATOR & Targets.EMBEDDED_LINUX) + return (Targets.DESKTOP_474_GCC | Targets.DESKTOP_480_DEFAULT + | Targets.SIMULATOR | Targets.EMBEDDED_LINUX) @staticmethod def getStringForTarget(target): diff --git a/tests/system/suite_CSUP/tst_CSUP06/test.py b/tests/system/suite_CSUP/tst_CSUP06/test.py index 76d38ee223..b36adb57fd 100644 --- a/tests/system/suite_CSUP/tst_CSUP06/test.py +++ b/tests/system/suite_CSUP/tst_CSUP06/test.py @@ -149,7 +149,9 @@ def checkSymbolCompletion(editor, isClangCodeModel): else: exp = (symbol[:max(symbol.rfind(":"), symbol.rfind(".")) + 1] + expectedSug.get(symbol, found)[0]) - test.compare(changedLine, exp, "Verify completion matches.") + if not (isClangCodeModel and platform.system() in ('Microsoft', 'Windows') + and JIRA.isBugStillOpen(15483)): + test.compare(changedLine, exp, "Verify completion matches.") performAutoCompletionTest(editor, ".*Complete symbols.*", "//", testSymb, missing, expectedSuggestion, expectedResults) diff --git a/tests/system/suite_debugger/tst_cli_output_console/test.py b/tests/system/suite_debugger/tst_cli_output_console/test.py index 81ce1566ae..8873369c4e 100644 --- a/tests/system/suite_debugger/tst_cli_output_console/test.py +++ b/tests/system/suite_debugger/tst_cli_output_console/test.py @@ -63,10 +63,6 @@ def main(): if not availableConfigs: test.fatal("Haven't found a suitable Qt version - leaving without building.") for kit, config in availableConfigs: - if (checkedTargets[kit] == Targets.DESKTOP_480_DEFAULT - and config == "Profile" and JIRA.isBugStillOpen(15457)): - test.warning("Skipping MSVC build of Qt 4 because of QTCREATORBUG-15457.") - continue selectBuildConfig(len(checkedTargets), kit, config) test.log("Testing build configuration: " + config) diff --git a/tests/unit/unittest/codecompletionsextractortest.cpp b/tests/unit/unittest/codecompletionsextractortest.cpp index cf31413085..d9f070a3ba 100644 --- a/tests/unit/unittest/codecompletionsextractortest.cpp +++ b/tests/unit/unittest/codecompletionsextractortest.cpp @@ -281,6 +281,28 @@ TEST_F(CodeCompletionsExtractor, Union) CodeCompletion::Available)); } +TEST_F(CodeCompletionsExtractor, Typedef) +{ + ClangCodeCompleteResults completeResults(getResults(classTranslationUnit, 20)); + + ::CodeCompletionsExtractor extractor(completeResults.data()); + + ASSERT_THAT(extractor, HasCompletion(Utf8StringLiteral("TypeDef"), + CodeCompletion::TypeAliasCompletionKind, + CodeCompletion::Available)); +} + +TEST_F(CodeCompletionsExtractor, UsingAsTypeAlias) +{ + ClangCodeCompleteResults completeResults(getResults(classTranslationUnit, 20)); + + ::CodeCompletionsExtractor extractor(completeResults.data()); + + ASSERT_THAT(extractor, HasCompletion(Utf8StringLiteral("UsingClass"), + CodeCompletion::TypeAliasCompletionKind, + CodeCompletion::Available)); +} + TEST_F(CodeCompletionsExtractor, TemplateTypeParameter) { ClangCodeCompleteResults completeResults(getResults(classTranslationUnit, 20)); diff --git a/tests/unit/unittest/data/complete_extractor_class.cpp b/tests/unit/unittest/data/complete_extractor_class.cpp index becfdc3292..218b5fbe25 100644 --- a/tests/unit/unittest/data/complete_extractor_class.cpp +++ b/tests/unit/unittest/data/complete_extractor_class.cpp @@ -2,6 +2,7 @@ class Class {}; struct Struct{}; union Union{}; typedef Class TypeDef; +using UsingClass = Class; template<class T> class TemplateClass{}; template<class T> class ClassTemplatePartialSpecialization; template<class T> class ClassTemplatePartialSpecialization<T*>; @@ -13,7 +14,6 @@ template<class T> class ClassTemplatePartialSpecialization<T*>; - template<class TemplateTypeParameter, template<class> class TemplateTemplateParameter> void function() { diff --git a/tests/unit/unittest/highlightinginformationstest.cpp b/tests/unit/unittest/highlightinginformationstest.cpp index 9413d3a2ff..29e68042b6 100644 --- a/tests/unit/unittest/highlightinginformationstest.cpp +++ b/tests/unit/unittest/highlightinginformationstest.cpp @@ -340,7 +340,7 @@ TEST_F(HighlightingInformations, Enumeration) { const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(118, 17)); - ASSERT_THAT(infos[1], HasType(HighlightingType::Enumeration)); + ASSERT_THAT(infos[1], HasType(HighlightingType::Type)); } TEST_F(HighlightingInformations, Enumerator) @@ -354,7 +354,7 @@ TEST_F(HighlightingInformations, EnumerationReferenceDeclarationType) { const auto infos = translationUnit.highlightingInformationsInRange(sourceRange(125, 28)); - ASSERT_THAT(infos[0], HasType(HighlightingType::Enumeration)); + ASSERT_THAT(infos[0], HasType(HighlightingType::Type)); } TEST_F(HighlightingInformations, EnumerationReferenceDeclarationVariable) diff --git a/tests/unit/unittest/translationunitstest.cpp b/tests/unit/unittest/translationunitstest.cpp index 3241473967..3e4b9d9cf9 100644 --- a/tests/unit/unittest/translationunitstest.cpp +++ b/tests/unit/unittest/translationunitstest.cpp @@ -57,6 +57,7 @@ using ClangBackEnd::TranslationUnit; using ClangBackEnd::UnsavedFiles; using ClangBackEnd::ProjectPart; +using ClangBackEnd::ProjectPartContainer; using ClangBackEnd::DiagnosticsChangedMessage; using ClangBackEnd::HighlightingChangedMessage; using ClangBackEnd::DocumentAnnotationsSendState; @@ -483,9 +484,24 @@ TEST_F(TranslationUnits, SendDocumentAnnotationsOnlyOnceForVisibleEditor) sendAllDocumentAnnotationsForVisibleEditors(); } +TEST_F(TranslationUnits, SendDocumentAnnotationsAfterProjectPartChange) +{ + translationUnits.create({fileContainer, headerContainer}); + auto fileTranslationUnit = translationUnits.translationUnit(fileContainer); + fileTranslationUnit.setIsVisibleInEditor(true); + fileTranslationUnit.diagnostics(); // Reset + fileTranslationUnit.highlightingInformations(); // Reset + projects.createOrUpdate({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DNEW")})}); + translationUnits.setTranslationUnitsDirtyIfProjectPartChanged(); + + EXPECT_CALL(mockSendDocumentAnnotationsCallback, sendDocumentAnnotations()).Times(1); + + sendAllDocumentAnnotationsForVisibleEditors(); +} + void TranslationUnits::SetUp() { - projects.createOrUpdate({ClangBackEnd::ProjectPartContainer(projectPartId)}); + projects.createOrUpdate({ProjectPartContainer(projectPartId)}); auto callback = [&] (const DiagnosticsChangedMessage &, const HighlightingChangedMessage &) { mockSendDocumentAnnotationsCallback.sendDocumentAnnotations(); diff --git a/tests/unit/unittest/translationunittest.cpp b/tests/unit/unittest/translationunittest.cpp index 24bdcdac10..579f71bd61 100644 --- a/tests/unit/unittest/translationunittest.cpp +++ b/tests/unit/unittest/translationunittest.cpp @@ -33,6 +33,7 @@ #include <highlightinginformations.h> #include <filecontainer.h> #include <projectpart.h> +#include <projectpartcontainer.h> #include <projects.h> #include <translationunitdoesnotexistexception.h> #include <translationunitfilenotexitexception.h> @@ -55,10 +56,11 @@ #include <chrono> #include <thread> - +using ClangBackEnd::FileContainer; using ClangBackEnd::TranslationUnit; using ClangBackEnd::UnsavedFiles; using ClangBackEnd::ProjectPart; +using ClangBackEnd::ProjectPartContainer; using ClangBackEnd::TranslationUnits; using testing::IsNull; @@ -74,19 +76,18 @@ namespace { class TranslationUnit : public ::testing::Test { protected: + void SetUp() override; ::TranslationUnit createTemporaryTranslationUnit(); QByteArray readContentFromTranslationUnitFile() const; protected: ClangBackEnd::ProjectParts projects; - ProjectPart projectPart{Utf8StringLiteral("/path/to/projectfile")}; + Utf8String projectPartId{Utf8StringLiteral("/path/to/projectfile")}; + ProjectPart projectPart; Utf8String translationUnitFilePath = Utf8StringLiteral(TESTDATA_DIR"/translationunits.cpp"); ClangBackEnd::UnsavedFiles unsavedFiles; ClangBackEnd::TranslationUnits translationUnits{projects, unsavedFiles}; - ::TranslationUnit translationUnit{translationUnitFilePath, - projectPart, - Utf8StringVector(), - translationUnits}; + ::TranslationUnit translationUnit; }; TEST_F(TranslationUnit, DefaultTranslationUnitIsInvalid) @@ -338,6 +339,36 @@ TEST_F(TranslationUnit, HasNoNewHighlightingInformationsAfterGettingHighlighting ASSERT_FALSE(translationUnit.hasNewHighlightingInformations()); } +TEST_F(TranslationUnit, SetDirtyIfProjectPartIsOutdated) +{ + projects.createOrUpdate({ProjectPartContainer(projectPartId)}); + translationUnit.cxTranslationUnit(); + projects.createOrUpdate({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DNEW")})}); + + translationUnit.setDirtyIfProjectPartIsOutdated(); + + ASSERT_TRUE(translationUnit.isNeedingReparse()); +} + +TEST_F(TranslationUnit, SetNotDirtyIfProjectPartIsNotOutdated) +{ + translationUnit.cxTranslationUnit(); + + translationUnit.setDirtyIfProjectPartIsOutdated(); + + ASSERT_FALSE(translationUnit.isNeedingReparse()); +} + +void TranslationUnit::SetUp() +{ + projects.createOrUpdate({ProjectPartContainer(projectPartId)}); + projectPart = *projects.findProjectPart(projectPartId); + + const QVector<FileContainer> fileContainer{FileContainer(translationUnitFilePath, projectPartId)}; + const auto createdTranslationUnits = translationUnits.create(fileContainer); + translationUnit = createdTranslationUnits.front(); +} + ::TranslationUnit TranslationUnit::createTemporaryTranslationUnit() { QTemporaryFile temporaryFile; @@ -348,7 +379,7 @@ TEST_F(TranslationUnit, HasNoNewHighlightingInformationsAfterGettingHighlighting Utf8StringVector(), translationUnits); -return translationUnit; + return translationUnit; } QByteArray TranslationUnit::readContentFromTranslationUnitFile() const |