aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-05-22 15:08:55 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-06-17 10:46:31 +0000
commitb36e9d0e95f53fdebcf63f79060c0ebff42d0bf2 (patch)
treef160af9d0cb7248eeaf19534f76c92ed127d1313 /tests
parentb213dee0134722fcdcae88efb514e0430fc72959 (diff)
ClangPchManager: Improve handling of no include in project PCH
We were doing simply nothing but we should call PchCreator::doInMainThreadAfterFinished(). Change-Id: Ia21d2cf4af53121d9e401f6e9a5b432a4daed00f Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/pchcreator-test.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/unittest/pchcreator-test.cpp b/tests/unit/unittest/pchcreator-test.cpp
index 66943fc147..0cf84a983d 100644
--- a/tests/unit/unittest/pchcreator-test.cpp
+++ b/tests/unit/unittest/pchcreator-test.cpp
@@ -315,6 +315,36 @@ TEST_F(PchCreatorVerySlowTest, FaultyProjectPartPchForCreatesFaultyPchForPchTask
Field(&ProjectPartPch::lastModified, Gt(0))));
}
+TEST_F(PchCreatorSlowTest, NoIncludes)
+{
+ pchTask1.includes = {};
+
+ creator.generatePch(std::move(pchTask1));
+
+ ASSERT_THAT(creator.projectPartPch(),
+ AllOf(Field(&ProjectPartPch::projectPartId, Eq(pchTask1.projectPartId())),
+ Field(&ProjectPartPch::pchPath, IsEmpty()),
+ Field(&ProjectPartPch::lastModified, Gt(0))));
+}
+
+TEST_F(PchCreatorSlowTest, NoIncludesInTheMainThreadCalls)
+{
+ pchTask1.includes = {};
+ creator.generatePch(std::move(pchTask1));
+
+ EXPECT_CALL(mockPchManagerClient,
+ precompiledHeadersUpdated(
+ Field(&ClangBackEnd::PrecompiledHeadersUpdatedMessage::projectPartIds,
+ ElementsAre(Eq(creator.projectPartPch().projectPartId)))));
+ EXPECT_CALL(mockClangPathWatcher,
+ updateIdPaths(
+ ElementsAre(AllOf(Field(&ClangBackEnd::IdPaths::id, 1),
+ Field(&ClangBackEnd::IdPaths::filePathIds, IsEmpty())))));
+ EXPECT_CALL(mockBuildDependenciesStorage, updatePchCreationTimeStamp(Gt(0), Eq(1)));
+
+ creator.doInMainThreadAfterFinished();
+}
+
TEST_F(PchCreatorVerySlowTest, GeneratedFile)
{
creator.clear();