Update composePwleV2 VTS test
Updating composePwleV2 VTS test to verify cases where the PWLE V2 capability is not supported.
Bug: 347034419
Flag: TEST_ONLY
Test: vts-tradefed run vts -m VtsHalVibratorTargetTest
Change-Id: I73de882f6595e858cea922b5378e5e7da4719140
diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
index ffd38b1..33e8660 100644
--- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
+++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp
@@ -89,6 +89,7 @@
static constexpr std::chrono::milliseconds VIBRATION_CALLBACK_TIMEOUT = 100ms;
static constexpr int32_t VENDOR_EFFECTS_MIN_VERSION = 3;
+static constexpr int32_t PWLE_V2_MIN_VERSION = 3;
static std::vector<std::string> findVibratorManagerNames() {
std::vector<std::string> names;
@@ -1117,6 +1118,17 @@
EXPECT_OK(vibrator->off());
}
+TEST_P(VibratorAidl, ComposePwleV2Unsupported) {
+ if (version < PWLE_V2_MIN_VERSION) {
+ EXPECT_EQ(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2, 0)
+ << "Vibrator version " << version << " should not report PWLE V2 capability.";
+ }
+ if (capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2) return;
+
+ EXPECT_UNKNOWN_OR_UNSUPPORTED(
+ vibrator->composePwleV2(pwle_v2_utils::composeValidPwleV2Effect(vibrator), nullptr));
+}
+
TEST_P(VibratorAidl, ComposeValidPwleV2EffectWithCallback) {
if (!(capabilities & IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2)) {
GTEST_SKIP() << "PWLE V2 not supported, skipping test";