From 6cfa94f3bcf9518fe9b1198ab852d77cc77d6bbc Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Mon, 10 Mar 2025 13:09:21 +0100 Subject: [PATCH] Add test for percentage sizes resolving against subpixel lengths (#35809) Two floats with `width: 50%` each should fit on the same line, and four floats with `width: 25%` each should fit on the same line. That's even if the containing block width, expressed in layout units, cannot be divided by 2 or 4. This test checks cases that are tricky for browsers where 1 pixel are either 60, 64 or 100 layout units. It passes on other browsers but fails on Servo because of #34665. Signed-off-by: Oriol Brufau --- tests/wpt/meta/MANIFEST.json | 33 +++++++ ...centage-width-subpixels.tentative.html.ini | 2 + ...centage-width-subpixels.tentative-ref.html | 39 ++++++++ .../percentage-width-subpixels.tentative.html | 94 +++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 tests/wpt/meta/css/css-sizing/percentage-width-subpixels.tentative.html.ini create mode 100644 tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative-ref.html create mode 100644 tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative.html diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index c56fc8a2f02..3d9ae7c946f 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -247175,6 +247175,35 @@ {} ] ], + "percentage-width-subpixels.tentative.html": [ + "2e85baa0f56366e73b34ba8bcb80de2ddf93ee2f", + [ + null, + [ + [ + "/css/css-sizing/percentage-width-subpixels.tentative-ref.html", + "==" + ] + ], + { + "fuzzy": [ + [ + null, + [ + [ + 0, + 255 + ], + [ + 0, + 120 + ] + ] + ] + ] + } + ] + ], "range-percent-intrinsic-size-1.html": [ "cae1c96eb6d9a54a33ec8a94c749a52ea2a8a086", [ @@ -438068,6 +438097,10 @@ "34e2ed01e5221369db8669548ec732099bef43e8", [] ], + "percentage-width-subpixels.tentative-ref.html": [ + "698e9644ddc62324d248e4de9d39690f52b33a01", + [] + ], "range-percent-intrinsic-size-1-ref.html": [ "3bacd9e4b8f5919d90f0f20578178e7994a92bf6", [] diff --git a/tests/wpt/meta/css/css-sizing/percentage-width-subpixels.tentative.html.ini b/tests/wpt/meta/css/css-sizing/percentage-width-subpixels.tentative.html.ini new file mode 100644 index 00000000000..8d85bb781c8 --- /dev/null +++ b/tests/wpt/meta/css/css-sizing/percentage-width-subpixels.tentative.html.ini @@ -0,0 +1,2 @@ +[percentage-width-subpixels.tentative.html] + expected: FAIL diff --git a/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative-ref.html b/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative-ref.html new file mode 100644 index 00000000000..698e9644ddc --- /dev/null +++ b/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative-ref.html @@ -0,0 +1,39 @@ + + +CSS Test Reference + + + + +

Test passes if there are only horizontal green lines and (almost) no red.

+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
diff --git a/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative.html b/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative.html new file mode 100644 index 00000000000..2e85baa0f56 --- /dev/null +++ b/tests/wpt/tests/css/css-sizing/percentage-width-subpixels.tentative.html @@ -0,0 +1,94 @@ + + +CSS Test: percentage sizes resolving against subpixel lengths + + + + + + + + + + +

Test passes if there are only horizontal green lines and (almost) no red.

+ + +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+