From 5ef78a895b8a168b2f4dfb28bfdde984f8cc3684 Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Fri, 28 Oct 2016 11:08:50 -0400 Subject: [PATCH] Fix test breakage due to naming collision in the linker. Test: hwui_unit_tests in question now run successfully. Change-Id: If99865cd1cfa5c819338d062f5685700380a60a6 --- libs/hwui/tests/unit/CanvasContextTests.cpp | 5 +++++ libs/hwui/tests/unit/SkiaDisplayListTests.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/libs/hwui/tests/unit/CanvasContextTests.cpp b/libs/hwui/tests/unit/CanvasContextTests.cpp index 3cc7189e5b4b5..344cc16fdf9ca 100644 --- a/libs/hwui/tests/unit/CanvasContextTests.cpp +++ b/libs/hwui/tests/unit/CanvasContextTests.cpp @@ -43,6 +43,10 @@ RENDERTHREAD_TEST(CanvasContext, create) { canvasContext->destroy(nullptr); } +// This must be in an anonymous namespace as this class name is used in multiple +// cpp files for different purposes and without the namespace the linker can +// arbitrarily choose which class to link against. +namespace { class TestFunctor : public Functor { public: bool didProcess = false; @@ -52,6 +56,7 @@ public: return DrawGlInfo::kStatusDone; } }; +}; // end anonymous namespace RENDERTHREAD_TEST(CanvasContext, invokeFunctor) { TestFunctor functor; diff --git a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp index 7f622eb96d049..4d79dde54b350 100644 --- a/libs/hwui/tests/unit/SkiaDisplayListTests.cpp +++ b/libs/hwui/tests/unit/SkiaDisplayListTests.cpp @@ -91,6 +91,10 @@ TEST(SkiaDisplayList, reuseDisplayList) { ASSERT_EQ(availableList.get(), nullptr); } +// This must be in an anonymous namespace as this class name is used in multiple +// cpp files for different purposes and without the namespace the linker can +// arbitrarily choose which class to link against. +namespace { class TestFunctor : public Functor { public: bool didSync = false; @@ -100,6 +104,7 @@ public: return DrawGlInfo::kStatusDone; } }; +}; // end anonymous namespace TEST(SkiaDisplayList, syncContexts) { SkRect bounds = SkRect::MakeWH(200, 200);