Format VTS test code

Bug: 287430121
Test: atest VtsHalAudioEffectTargetTest
Change-Id: Iecc0c9388c6596cf5a25918f8f0af0495b2133a6
Merged-In: Iecc0c9388c6596cf5a25918f8f0af0495b2133a6
This commit is contained in:
Shunkai Yao 2023-06-23 04:34:50 +00:00
parent 4559d0fd39
commit 21cc1371a9
6 changed files with 15 additions and 18 deletions

View file

@ -30,16 +30,15 @@
#include <android/binder_auto_utils.h>
#include <fmq/AidlMessageQueue.h>
#include <gtest/gtest.h>
#include <system/audio_aidl_utils.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;
@ -53,6 +52,7 @@ using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::AudioUuid;
using aidl::android::media::audio::common::PcmType;
using ::android::audio::utils::toString;
using ::android::hardware::EventFlag;
const AudioFormatDescription kDefaultFormatDescription = {
@ -65,10 +65,9 @@ typedef ::android::AidlMessageQueue<float,
::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
DataMQ;
static inline std::string getPrefix(Descriptor &descriptor) {
static inline std::string getPrefix(Descriptor& descriptor) {
std::string prefix = "Implementor_" + descriptor.common.implementor + "_name_" +
descriptor.common.name + "_UUID_" +
toString(descriptor.common.id.uuid);
descriptor.common.name + "_UUID_" + toString(descriptor.common.id.uuid);
return prefix;
}

View file

@ -162,8 +162,8 @@ 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 = getPrefix(descriptor) + "_EchoDelay_" + echoDelay +
"_MobileMode_" + mobileMode;
std::string name =
getPrefix(descriptor) + "_EchoDelay_" + echoDelay + "_MobileMode_" + mobileMode;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;

View file

@ -177,9 +177,9 @@ 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 = getPrefix(descriptor) + "_target_peak_level_" +
targetPeakLevel + "_max_compression_gain_" + maxCompressionGain +
"_enable_limiter_" + enableLimiter;
std::string name = getPrefix(descriptor) + "_target_peak_level_" + targetPeakLevel +
"_max_compression_gain_" + maxCompressionGain + "_enable_limiter_" +
enableLimiter;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;

View file

@ -195,10 +195,10 @@ 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 = getPrefix(descriptor) + "_hapticScaleId" +
hapticScaleID + "_hapticScaleVibScale" + hapticScaleVibScale +
"_resonantFrequency" + resonantFrequency + "_qFactor" + qFactor +
"_maxAmplitude" + maxAmplitude;
std::string name = getPrefix(descriptor) + "_hapticScaleId" + hapticScaleID +
"_hapticScaleVibScale" + hapticScaleVibScale + "_resonantFrequency" +
resonantFrequency + "_qFactor" + qFactor + "_maxAmplitude" +
maxAmplitude;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;

View file

@ -155,8 +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 = getPrefix(descriptor) + "_level_" + level + "_type_" +
type;
std::string name = getPrefix(descriptor) + "_level_" + level + "_type_" + type;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;

View file

@ -149,8 +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 = getPrefix(descriptor) + "_level" + level + "_mute" +
mute;
std::string name = getPrefix(descriptor) + "_level" + level + "_mute" + mute;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;