mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Vts test for verifying that there are no duplicates in getDisplayconfigs
Test: atest VtsHalGraphicsComposer3_TargetTest Test: atest VtsHalGraphicsComposerV2_4TargetTest Bug: 176086656 Change-Id: I51dd4774b3c990e6db2cb9ee71d14f74dc3effb0
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user