From 1c57378eeddf5f981fcdda227829d6f6b2309c32 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Thu, 20 Dec 2018 13:49:51 -0800 Subject: Fix/suppress hwui/tests google-explicit-constructor warnings * Add explicit to conversion constructors/operators Bug: 28341362 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor Change-Id: I59c61af29ab09209c5a4c2bf43b10215bf59756a --- libs/hwui/tests/common/scenes/BitmapFillrate.cpp | 4 ++-- libs/hwui/tests/common/scenes/BitmapShaders.cpp | 2 +- libs/hwui/tests/common/scenes/TvApp.cpp | 8 ++++---- libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp | 2 +- libs/hwui/tests/unit/ThreadBaseTests.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/hwui/tests/common/scenes/BitmapFillrate.cpp b/libs/hwui/tests/common/scenes/BitmapFillrate.cpp index 1d3d60716d68..5af7d43d7f66 100644 --- a/libs/hwui/tests/common/scenes/BitmapFillrate.cpp +++ b/libs/hwui/tests/common/scenes/BitmapFillrate.cpp @@ -31,7 +31,7 @@ static bool _BitmapFillrate( class BitmapFillrate : public TestScene { public: - BitmapFillrate(BitmapAllocationTestUtils::BitmapAllocator allocator) + explicit BitmapFillrate(BitmapAllocationTestUtils::BitmapAllocator allocator) : TestScene(), mAllocator(allocator) {} void createContent(int width, int height, Canvas& canvas) override { @@ -70,4 +70,4 @@ private: BitmapAllocationTestUtils::BitmapAllocator mAllocator; std::vector > mNodes; -}; \ No newline at end of file +}; diff --git a/libs/hwui/tests/common/scenes/BitmapShaders.cpp b/libs/hwui/tests/common/scenes/BitmapShaders.cpp index 15039b5fa976..4ecb54c9f0fd 100644 --- a/libs/hwui/tests/common/scenes/BitmapShaders.cpp +++ b/libs/hwui/tests/common/scenes/BitmapShaders.cpp @@ -26,7 +26,7 @@ static bool _BitmapShaders(BitmapAllocationTestUtils::registerBitmapAllocationSc class BitmapShaders : public TestScene { public: - BitmapShaders(BitmapAllocationTestUtils::BitmapAllocator allocator) + explicit BitmapShaders(BitmapAllocationTestUtils::BitmapAllocator allocator) : TestScene(), mAllocator(allocator) {} sp card; diff --git a/libs/hwui/tests/common/scenes/TvApp.cpp b/libs/hwui/tests/common/scenes/TvApp.cpp index a64e8444a9b1..286f5f194aed 100644 --- a/libs/hwui/tests/common/scenes/TvApp.cpp +++ b/libs/hwui/tests/common/scenes/TvApp.cpp @@ -48,7 +48,7 @@ static bool _TvAppNoRoundedCornerColorFilter( class TvApp : public TestScene { public: - TvApp(BitmapAllocationTestUtils::BitmapAllocator allocator) + explicit TvApp(BitmapAllocationTestUtils::BitmapAllocator allocator) : TestScene(), mAllocator(allocator) {} sp mBg; @@ -232,7 +232,7 @@ private: class TvAppNoRoundedCorner : public TvApp { public: - TvAppNoRoundedCorner(BitmapAllocationTestUtils::BitmapAllocator allocator) : TvApp(allocator) {} + explicit TvAppNoRoundedCorner(BitmapAllocationTestUtils::BitmapAllocator allocator) : TvApp(allocator) {} private: virtual float roundedCornerRadius() override { return dp(0); } @@ -240,7 +240,7 @@ private: class TvAppColorFilter : public TvApp { public: - TvAppColorFilter(BitmapAllocationTestUtils::BitmapAllocator allocator) : TvApp(allocator) {} + explicit TvAppColorFilter(BitmapAllocationTestUtils::BitmapAllocator allocator) : TvApp(allocator) {} private: virtual bool useOverlay() override { return false; } @@ -248,7 +248,7 @@ private: class TvAppNoRoundedCornerColorFilter : public TvApp { public: - TvAppNoRoundedCornerColorFilter(BitmapAllocationTestUtils::BitmapAllocator allocator) + explicit TvAppNoRoundedCornerColorFilter(BitmapAllocationTestUtils::BitmapAllocator allocator) : TvApp(allocator) {} private: diff --git a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp index ad5fdacc8594..7deb0b1486ea 100644 --- a/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp +++ b/libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp @@ -45,7 +45,7 @@ static void testProperty(std::function propSetupCallbac static const int CANVAS_HEIGHT = 100; class PropertyTestCanvas : public TestCanvasBase { public: - PropertyTestCanvas(std::function callback) + explicit PropertyTestCanvas(std::function callback) : TestCanvasBase(CANVAS_WIDTH, CANVAS_HEIGHT), mCallback(callback) {} void onDrawRect(const SkRect& rect, const SkPaint& paint) override { EXPECT_EQ(mDrawCounter++, 0); diff --git a/libs/hwui/tests/unit/ThreadBaseTests.cpp b/libs/hwui/tests/unit/ThreadBaseTests.cpp index 1168ff211202..817c1f3d3e43 100644 --- a/libs/hwui/tests/unit/ThreadBaseTests.cpp +++ b/libs/hwui/tests/unit/ThreadBaseTests.cpp @@ -95,7 +95,7 @@ TEST(ThreadBase, lifecyclePerf) { }; struct Counter { - Counter(EventCount* count) : mCount(count) { mCount->construct++; } + explicit Counter(EventCount* count) : mCount(count) { mCount->construct++; } Counter(const Counter& other) : mCount(other.mCount) { if (mCount) mCount->copy++; @@ -148,4 +148,4 @@ TEST(ThreadBase, lifecycle) { ASSERT_EQ(1, dummyObject->getStrongCount()); ASSERT_EQ(2, lifecycleTestHelper(dummyObject)); ASSERT_EQ(1, dummyObject->getStrongCount()); -} \ No newline at end of file +} -- cgit v1.2.3-59-g8ed1b