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

Commit d773e954 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk Committed by Android (Google) Code Review
Browse files

Merge "Allow spaces in DAB frequency labels and make it up to 7 characters long."

parents 81ccaed5 a425dedb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -215,7 +215,9 @@ struct DabTableEntry {
    /**
     * Channel name, i.e. 5A, 7B.
     *
     * It must match the following regular expression: /^[A-Z0-9]{2,5}$/.
     * It must match the following regular expression:
     * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters
     * without spaces allowed at the beginning nor end).
     */
    string label;

+4 −2
Original line number Diff line number Diff line
@@ -342,11 +342,13 @@ TEST_F(BroadcastRadioHalTest, GetDabRegionConfig) {
    }
    ASSERT_EQ(Result::OK, halResult);

    std::regex re("^[A-Z0-9]{2,5}$");
    std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$");
    // double-check correctness of the test
    ASSERT_TRUE(std::regex_match("5A", re));
    ASSERT_FALSE(std::regex_match("5a", re));
    ASSERT_FALSE(std::regex_match("123ABC", re));
    ASSERT_FALSE(std::regex_match("1234ABCD", re));
    ASSERT_TRUE(std::regex_match("CN 12D", re));
    ASSERT_FALSE(std::regex_match(" 5A", re));

    for (auto&& entry : config) {
        EXPECT_TRUE(std::regex_match(std::string(entry.label), re));