Loading libs/gui/tests/Android.bp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,8 @@ cc_test { ], ], shared_libs: [ shared_libs: [ "android.hardware.configstore@1.0", "android.hardware.configstore-utils", "liblog", "liblog", "libEGL", "libEGL", "libGLESv1_CM", "libGLESv1_CM", Loading @@ -34,6 +36,8 @@ cc_test { "libbinder", "libbinder", "libcutils", "libcutils", "libgui", "libgui", "libhidlbase", "libhidltransport", "libui", "libui", "libutils", "libutils", "libnativewindow" "libnativewindow" Loading libs/gui/tests/Surface_test.cpp +21 −11 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,9 @@ #include <gtest/gtest.h> #include <gtest/gtest.h> #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <binder/ProcessState.h> #include <binder/ProcessState.h> #include <configstore/Utils.h> #include <cutils/properties.h> #include <cutils/properties.h> #include <gui/BufferItemConsumer.h> #include <gui/BufferItemConsumer.h> #include <gui/IDisplayEventConnection.h> #include <gui/IDisplayEventConnection.h> Loading @@ -35,6 +37,12 @@ namespace android { namespace android { using namespace std::chrono_literals; using namespace std::chrono_literals; // retrieve wide-color and hdr settings from configstore using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; static bool hasWideColorDisplay = getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(false); class FakeSurfaceComposer; class FakeSurfaceComposer; class FakeProducerFrameEventHistory; class FakeProducerFrameEventHistory; Loading Loading @@ -271,17 +279,19 @@ TEST_F(SurfaceTest, GetWideColorSupport) { bool supported; bool supported; surface->getWideColorSupport(&supported); surface->getWideColorSupport(&supported); // TODO(courtneygo): How can we know what device we are on to // NOTE: This test assumes that device that supports // verify that this is correct? // wide-color (as indicated by BoardConfig) must also char product[PROPERTY_VALUE_MAX] = "0"; // have a wide-color primary display. property_get("ro.build.product", product, "0"); // That assumption allows this test to cover devices std::cerr << "[ ] product = " << product << std::endl; // that advertised a wide-color color mode without // actually supporting wide-color to pass this test if (strcmp("marlin", product) == 0 || strcmp("sailfish", product) == 0) { // as well as the case of a device that does support ASSERT_EQ(true, supported); // wide-color (via BoardConfig) and has a wide-color } else { // primary display. ASSERT_EQ(false, supported); // NOT covered at this time is a device that supports } // wide color in the BoardConfig but does not support // a wide-color color mode on the primary display. ASSERT_EQ(hasWideColorDisplay, supported); } } TEST_F(SurfaceTest, DynamicSetBufferCount) { TEST_F(SurfaceTest, DynamicSetBufferCount) { Loading Loading
libs/gui/tests/Android.bp +4 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,8 @@ cc_test { ], ], shared_libs: [ shared_libs: [ "android.hardware.configstore@1.0", "android.hardware.configstore-utils", "liblog", "liblog", "libEGL", "libEGL", "libGLESv1_CM", "libGLESv1_CM", Loading @@ -34,6 +36,8 @@ cc_test { "libbinder", "libbinder", "libcutils", "libcutils", "libgui", "libgui", "libhidlbase", "libhidltransport", "libui", "libui", "libutils", "libutils", "libnativewindow" "libnativewindow" Loading
libs/gui/tests/Surface_test.cpp +21 −11 Original line number Original line Diff line number Diff line Loading @@ -18,7 +18,9 @@ #include <gtest/gtest.h> #include <gtest/gtest.h> #include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h> #include <binder/ProcessState.h> #include <binder/ProcessState.h> #include <configstore/Utils.h> #include <cutils/properties.h> #include <cutils/properties.h> #include <gui/BufferItemConsumer.h> #include <gui/BufferItemConsumer.h> #include <gui/IDisplayEventConnection.h> #include <gui/IDisplayEventConnection.h> Loading @@ -35,6 +37,12 @@ namespace android { namespace android { using namespace std::chrono_literals; using namespace std::chrono_literals; // retrieve wide-color and hdr settings from configstore using namespace android::hardware::configstore; using namespace android::hardware::configstore::V1_0; static bool hasWideColorDisplay = getBool<ISurfaceFlingerConfigs, &ISurfaceFlingerConfigs::hasWideColorDisplay>(false); class FakeSurfaceComposer; class FakeSurfaceComposer; class FakeProducerFrameEventHistory; class FakeProducerFrameEventHistory; Loading Loading @@ -271,17 +279,19 @@ TEST_F(SurfaceTest, GetWideColorSupport) { bool supported; bool supported; surface->getWideColorSupport(&supported); surface->getWideColorSupport(&supported); // TODO(courtneygo): How can we know what device we are on to // NOTE: This test assumes that device that supports // verify that this is correct? // wide-color (as indicated by BoardConfig) must also char product[PROPERTY_VALUE_MAX] = "0"; // have a wide-color primary display. property_get("ro.build.product", product, "0"); // That assumption allows this test to cover devices std::cerr << "[ ] product = " << product << std::endl; // that advertised a wide-color color mode without // actually supporting wide-color to pass this test if (strcmp("marlin", product) == 0 || strcmp("sailfish", product) == 0) { // as well as the case of a device that does support ASSERT_EQ(true, supported); // wide-color (via BoardConfig) and has a wide-color } else { // primary display. ASSERT_EQ(false, supported); // NOT covered at this time is a device that supports } // wide color in the BoardConfig but does not support // a wide-color color mode on the primary display. ASSERT_EQ(hasWideColorDisplay, supported); } } TEST_F(SurfaceTest, DynamicSetBufferCount) { TEST_F(SurfaceTest, DynamicSetBufferCount) { Loading