Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 871f1e63 authored by Kriti Dang's avatar Kriti Dang Committed by Android (Google) Code Review
Browse files

Merge "Vts test for verifying that there are no duplicates in getDisplayconfigs"

parents 6385a2c1 4efe8608
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -737,6 +737,39 @@ TEST_P(GraphicsComposerHidlTest, getLayerGenericMetadataKeys) {
    }
}

/*
 * Test that no two display configs are exactly the same.
 */
TEST_P(GraphicsComposerHidlTest, GetDisplayConfigNoRepetitions) {
    for (const auto& display : mDisplays) {
        std::vector<Config> configs = mComposerClient->getDisplayConfigs(display.get());
        for (int i = 0; i < configs.size(); i++) {
            for (int j = i + 1; j < configs.size(); j++) {
                const int32_t width1 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[i], IComposerClient::Attribute::WIDTH);
                const int32_t height1 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[i], IComposerClient::Attribute::HEIGHT);
                const int32_t vsyncPeriod1 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[i], IComposerClient::Attribute::VSYNC_PERIOD);
                const int32_t group1 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[i], IComposerClient::Attribute::CONFIG_GROUP);

                const int32_t width2 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[j], IComposerClient::Attribute::WIDTH);
                const int32_t height2 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[j], IComposerClient::Attribute::HEIGHT);
                const int32_t vsyncPeriod2 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[j], IComposerClient::Attribute::VSYNC_PERIOD);
                const int32_t group2 = mComposerClient->getDisplayAttribute_2_4(
                        display.get(), configs[j], IComposerClient::Attribute::CONFIG_GROUP);

                ASSERT_FALSE(width1 == width2 && height1 == height2 &&
                             vsyncPeriod1 == vsyncPeriod2 && group1 == group2);
            }
        }
    }
}

}  // namespace
}  // namespace vts
}  // namespace V2_4
+35 −0
Original line number Diff line number Diff line
@@ -2122,6 +2122,41 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) {
    EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}

/*
 * Test that no two display configs are exactly the same.
 */
TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) {
    for (const auto& display : mDisplays) {
        const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId());
        for (std::vector<int>::size_type i = 0; i < configs.size(); i++) {
            for (std::vector<int>::size_type j = i + 1; j < configs.size(); j++) {
                const auto& [widthStatus1, width1] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[i], DisplayAttribute::WIDTH);
                const auto& [heightStatus1, height1] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[i], DisplayAttribute::HEIGHT);
                const auto& [vsyncPeriodStatus1, vsyncPeriod1] =
                        mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[i],
                                                             DisplayAttribute::VSYNC_PERIOD);
                const auto& [groupStatus1, group1] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[i], DisplayAttribute::CONFIG_GROUP);

                const auto& [widthStatus2, width2] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[j], DisplayAttribute::WIDTH);
                const auto& [heightStatus2, height2] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[j], DisplayAttribute::HEIGHT);
                const auto& [vsyncPeriodStatus2, vsyncPeriod2] =
                        mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[j],
                                                             DisplayAttribute::VSYNC_PERIOD);
                const auto& [groupStatus2, group2] = mComposerClient->getDisplayAttribute(
                        display.getDisplayId(), configs[j], DisplayAttribute::CONFIG_GROUP);

                ASSERT_FALSE(width1 == width2 && height1 == height2 &&
                             vsyncPeriod1 == vsyncPeriod2 && group1 == group2);
            }
        }
    }
}

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest);
INSTANTIATE_TEST_SUITE_P(
        PerInstance, GraphicsComposerAidlCommandTest,