[Webkit-unassigned] [Bug 273346] New: Add test coverage for `TimeRanges::nearest`

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 26 16:14:34 PDT 2024


https://bugs.webkit.org/show_bug.cgi?id=273346

            Bug ID: 273346
           Summary: Add test coverage for `TimeRanges::nearest`
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Media
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ahmad.saleem792 at gmail.com
                CC: destra at apple.com, eric.carlson at apple.com,
                    jean-yves.avenard at apple.com

Hi Team,

Just came across this Blink's commit and noticed that it had API tests for 'TimeRanges::nearest()' and I checked our implementation and noticed that we don't have these:

NOTE - I don't know whether we have this bug or not but just thought to raise to get input.

Blink Commit: https://source.chromium.org/chromium/chromium/src/+/ca7a61971dd87991e2b923eb66448bdd8129284c

WebKit Source (API Test): https://searchfox.org/wubkat/rev/1ade9b72a383daa2aee2e964d15c42877b9fb999/Tools/TestWebKitAPI/Tests/WebCore/TimeRanges.cpp#317

Just raising so we can track this either to add test coverage or fix bug (if we have it). It might be something like (didn't try):

TEST(TimeRanges, Nearest)
{
    RefPtr<TimeRanges> ranges = TimeRanges::create();

    ranges->add(0, 2);
    ranges->add(5, 7);

    ASSERT_EQ(0, ranges->nearest(0, 0));
    ASSERT_EQ(1, ranges->nearest(1, 0));
    ASSERT_EQ(2, ranges->nearest(2, 0));
    ASSERT_EQ(2, ranges->nearest(3, 0));
    ASSERT_EQ(5, ranges->nearest(4, 0));
    ASSERT_EQ(5, ranges->nearest(5, 0));
    ASSERT_EQ(7, ranges->nearest(8, 0));

    ranges->add(9, 11);
    ASSERT_EQ(7, ranges->nearest(8, 6));
    ASSERT_EQ(7, ranges->nearest(8, 8));
    ASSERT_EQ(9, ranges->nearest(8, 10));
}

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240426/cde683cc/attachment-0001.htm>


More information about the webkit-unassigned mailing list