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

Commit 8ab75261 authored by Denis Ciocca's avatar Denis Ciocca Committed by Anthony Stange
Browse files

sensors:2.0:vts fix functional test for typeAsString field



For sensors of known type defined in SensorType (value <
DEVICE_PRIVATE_BASE), typeAsString field can be an empty string since
framework overrides it anyways.
The empty string test should fails only if type is >=
DEVICE_PRIVATE_BASE.
The matching type with typeAsString test is instead executed only if
the string is not empty (if it's not an empty string let's check that
at least is set to the right value).

Bug: 155514483
Test: atest VtsHalSensorsV2_0TargetTest
Signed-off-by: default avatarDenis Ciocca <denis.ciocca@gmail.com>
Merged-In: Ib5f8fd513313670e88c2b973c1ff724658914eb2
Change-Id: I4267ff6a158a571ff43122bdb7a38c9fa38f5900
parent 6232e934
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -320,11 +320,13 @@ TEST_P(SensorsHidlTest, SensorListValid) {
                         << s.sensorHandle << std::dec << " type=" << static_cast<int>(s.type)
                         << " name=" << s.name);

            // Test non-empty type string
            // Test type string non-empty only for private sensor types.
            if (s.type >= SensorType::DEVICE_PRIVATE_BASE) {
                EXPECT_FALSE(s.typeAsString.empty());

            // Test defined type matches defined string type
            } else if (!s.typeAsString.empty()) {
                // Test type string matches framework string if specified for non-private types.
                EXPECT_NO_FATAL_FAILURE(assertTypeMatchStringType(s.type, s.typeAsString));
            }

            // Test if all sensor has name and vendor
            EXPECT_FALSE(s.name.empty());