mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "aidl: Improve Effect VTS naming"
This commit is contained in:
@@ -32,12 +32,14 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <system/audio_effects/aidl_effects_utils.h>
|
||||
#include <system/audio_effects/effect_uuid.h>
|
||||
#include <system/audio_aidl_utils.h>
|
||||
|
||||
#include "AudioHalBinderServiceUtil.h"
|
||||
#include "EffectFactoryHelper.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
using namespace android;
|
||||
using ::android::audio::utils::toString;
|
||||
using aidl::android::hardware::audio::effect::CommandId;
|
||||
using aidl::android::hardware::audio::effect::Descriptor;
|
||||
using aidl::android::hardware::audio::effect::IEffect;
|
||||
@@ -63,6 +65,13 @@ typedef ::android::AidlMessageQueue<float,
|
||||
::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
|
||||
DataMQ;
|
||||
|
||||
static inline std::string getPrefix(Descriptor &descriptor) {
|
||||
std::string prefix = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
toString(descriptor.common.id.uuid);
|
||||
return prefix;
|
||||
}
|
||||
|
||||
class EffectHelper {
|
||||
public:
|
||||
static void create(std::shared_ptr<IFactory> factory, std::shared_ptr<IEffect>& effect,
|
||||
@@ -71,7 +80,7 @@ class EffectHelper {
|
||||
auto& id = desc.common.id;
|
||||
ASSERT_STATUS(status, factory->createEffect(id.uuid, &effect));
|
||||
if (status == EX_NONE) {
|
||||
ASSERT_NE(effect, nullptr) << id.uuid.toString();
|
||||
ASSERT_NE(effect, nullptr) << toString(id.uuid);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,9 +162,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string echoDelay = std::to_string(std::get<PARAM_ECHO_DELAY>(info.param));
|
||||
std::string mobileMode = std::get<PARAM_MOBILE_MODE>(info.param) ? "true" : "false";
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_EchoDelay_" + echoDelay +
|
||||
std::string name = getPrefix(descriptor) + "_EchoDelay_" + echoDelay +
|
||||
"_MobileMode_" + mobileMode;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
|
||||
@@ -177,9 +177,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::to_string(std::get<PARAM_MAX_COMPRESSION_GAIN>(info.param));
|
||||
std::string enableLimiter = std::to_string(std::get<PARAM_ENABLE_LIMITER>(info.param));
|
||||
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_target_peak_level_" +
|
||||
std::string name = getPrefix(descriptor) + "_target_peak_level_" +
|
||||
targetPeakLevel + "_max_compression_gain_" + maxCompressionGain +
|
||||
"_enable_limiter_" + enableLimiter;
|
||||
std::replace_if(
|
||||
|
||||
@@ -183,9 +183,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::string margin =
|
||||
std::to_string(static_cast<int>(std::get<PARAM_SATURATION_MARGIN>(info.param)));
|
||||
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_digital_gain_" + gain +
|
||||
std::string name = getPrefix(descriptor) + "_digital_gain_" + gain +
|
||||
"_level_estimator_" + estimator + "_margin_" + margin;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
#include "EffectFactoryHelper.h"
|
||||
#include "TestUtils.h"
|
||||
|
||||
#include <system/audio_aidl_utils.h>
|
||||
|
||||
using namespace android;
|
||||
using ::android::audio::utils::toString;
|
||||
|
||||
using namespace android;
|
||||
|
||||
using aidl::android::hardware::audio::effect::Descriptor;
|
||||
@@ -93,7 +98,7 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> {
|
||||
std::shared_ptr<IEffect> effect;
|
||||
EXPECT_STATUS(expectStatus, mEffectFactory->createEffect(uuid, &effect));
|
||||
if (expectStatus == EX_NONE) {
|
||||
EXPECT_NE(effect, nullptr) << " null effect with uuid: " << uuid.toString();
|
||||
EXPECT_NE(effect, nullptr) << " null effect with uuid: " << toString(uuid);
|
||||
effects.push_back(std::move(effect));
|
||||
}
|
||||
}
|
||||
@@ -148,7 +153,7 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) {
|
||||
}
|
||||
std::string msg = " missing type UUID:\n";
|
||||
for (const auto& uuid : typeUuidSet) {
|
||||
msg += (uuid.toString() + "\n");
|
||||
msg += (toString(uuid) + "\n");
|
||||
}
|
||||
SCOPED_TRACE(msg);
|
||||
EXPECT_EQ(0UL, typeUuidSet.size());
|
||||
|
||||
@@ -848,10 +848,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor))),
|
||||
[](const testing::TestParamInfo<AudioEffectTest::ParamType>& info) {
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_TYPE_" +
|
||||
descriptor.common.id.type.toString() + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString();
|
||||
std::string name = getPrefix(descriptor);
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -145,9 +145,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
[](const testing::TestParamInfo<BassBoostParamTest::ParamType>& info) {
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string strength = std::to_string(std::get<PARAM_STRENGTH>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_strength_" + strength;
|
||||
std::string name = getPrefix(descriptor) + "_strength_" + strength;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -126,9 +126,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
[](const testing::TestParamInfo<DownmixParamTest::ParamType>& info) {
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string type = std::to_string(static_cast<int>(std::get<PARAM_TYPE>(info.param)));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_type" + type;
|
||||
std::string name = getPrefix(descriptor) + "_type" + type;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -513,9 +513,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<ENGINE_TEST_INSTANCE_NAME>(info.param).second;
|
||||
DynamicsProcessing::EngineArchitecture cfg;
|
||||
fillEngineArchConfig(cfg, info.param);
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_Cfg_" + cfg.toString();
|
||||
std::string name = getPrefix(descriptor) + "_Cfg_" + cfg.toString();
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -209,9 +209,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<0>(info.param).second;
|
||||
std::string roomLevel = std::to_string(std::get<1>(info.param));
|
||||
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_roomLevel" + roomLevel;
|
||||
std::string name = getPrefix(descriptor) + "_roomLevel" + roomLevel;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -209,9 +209,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string bandLevel =
|
||||
::android::internal::ToString(std::get<PARAM_BAND_LEVEL>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_preset_" +
|
||||
std::string name = getPrefix(descriptor) + "_preset_" +
|
||||
std::to_string(std::get<PARAM_PRESET>(info.param)) + "_bandLevel_" +
|
||||
bandLevel;
|
||||
std::replace_if(
|
||||
|
||||
@@ -195,9 +195,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::to_string(std::get<PARAM_VIBRATION_INFORMATION_Q_FACTOR>(info.param));
|
||||
std::string maxAmplitude =
|
||||
std::to_string(std::get<PARAM_VIBRATION_INFORMATION_MAX_AMPLITUDE>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_hapticScaleId" +
|
||||
std::string name = getPrefix(descriptor) + "_hapticScaleId" +
|
||||
hapticScaleID + "_hapticScaleVibScale" + hapticScaleVibScale +
|
||||
"_resonantFrequency" + resonantFrequency + "_qFactor" + qFactor +
|
||||
"_maxAmplitude" + maxAmplitude;
|
||||
|
||||
@@ -131,9 +131,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
[](const testing::TestParamInfo<LoudnessEnhancerParamTest::ParamType>& info) {
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string gainMb = std::to_string(std::get<PARAM_GAIN_MB>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_gainMb_" + gainMb;
|
||||
std::string name = getPrefix(descriptor) + "_gainMb_" + gainMb;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -155,9 +155,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::get<PARAM_LEVEL>(info.param));
|
||||
std::string type = aidl::android::hardware::audio::effect::toString(
|
||||
std::get<PARAM_TYPE>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_level_" + level + "_type_" +
|
||||
std::string name = getPrefix(descriptor) + "_level_" + level + "_type_" +
|
||||
type;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
|
||||
@@ -137,9 +137,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string preset =
|
||||
std::to_string(static_cast<int>(std::get<PARAM_PRESETS>(info.param)));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_preset" + preset;
|
||||
std::string name = getPrefix(descriptor) + "_preset" + preset;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -141,9 +141,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
[](const testing::TestParamInfo<VirtualizerParamTest::ParamType>& info) {
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string strength = std::to_string(std::get<PARAM_STRENGTH>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_strength" + strength;
|
||||
std::string name = getPrefix(descriptor) + "_strength" + strength;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
return name;
|
||||
|
||||
@@ -195,9 +195,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
std::get<PARAM_MEASUREMENT_MODE>(info.param));
|
||||
std::string latency = std::to_string(std::get<PARAM_LATENCY>(info.param));
|
||||
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_captureSize" + captureSize +
|
||||
std::string name = getPrefix(descriptor) + "_captureSize" + captureSize +
|
||||
"_scalingMode" + scalingMode + "_measurementMode" + measurementMode +
|
||||
"_latency" + latency;
|
||||
std::replace_if(
|
||||
|
||||
@@ -149,9 +149,7 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
|
||||
std::string level = std::to_string(std::get<PARAM_LEVEL>(info.param));
|
||||
std::string mute = std::to_string(std::get<PARAM_MUTE>(info.param));
|
||||
std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
|
||||
descriptor.common.name + "_UUID_" +
|
||||
descriptor.common.id.uuid.toString() + "_level" + level + "_mute" +
|
||||
std::string name = getPrefix(descriptor) + "_level" + level + "_mute" +
|
||||
mute;
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
|
||||
|
||||
Reference in New Issue
Block a user