⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278299 in webkit


Ignore:
Timestamp:
Jun 1, 2021, 1:42:48 AM (5 years ago)
Author:
cathiechen
Message:

Update tests of mapping width and height attributes to aspect-ratio from WPT
https://bugs.webkit.org/show_bug.cgi?id=226472

Reviewed by Rob Buis.

Base commit: https://github.com/web-platform-tests/wpt/commit/da6406b38dae07a8a69c384b72ddd89b48d5194a

  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html:
  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js:

(test_computed_style_aspect_ratio):

  • web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
Location:
trunk/LayoutTests/imported/w3c
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r278293 r278299  
     12021-06-01  Cathie Chen  <cathiechen@igalia.com>
     2
     3        Update tests of mapping width and height attributes to aspect-ratio from WPT
     4        https://bugs.webkit.org/show_bug.cgi?id=226472
     5
     6        Reviewed by Rob Buis.
     7
     8        Base commit: https://github.com/web-platform-tests/wpt/commit/da6406b38dae07a8a69c384b72ddd89b48d5194a
     9
     10        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt:
     11        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html:
     12        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt:
     13        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html:
     14        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js:
     15        (test_computed_style_aspect_ratio):
     16        * web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html:
     17
    1182021-05-31  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio-expected.txt

    r277321 r278299  
    44PASS Canvas width and height attributes are used as the surface size
    55FAIL Computed style test: canvas with {"width":"10","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
    6 PASS Computed style test: canvas with {"width":"0","height":"1"}
    7 PASS Computed style test: canvas with {"width":"1","height":"0"}
    8 PASS Computed style test: canvas with {"width":"0","height":"0"}
    9 FAIL Computed style test: canvas with {"width":"0.5","height":"1.5"} assert_in_array: value "auto" not in array ["auto 0 / 1", "auto 0.5 / 1.5"]
    10 PASS Computed style test: canvas with {"width":"10%","height":"20"}
     6FAIL Computed style test: canvas with {"width":"0","height":"1"} assert_equals: expected "auto 0 / 1" but got "auto"
     7FAIL Computed style test: canvas with {"width":"1","height":"0"} assert_equals: expected "auto 1 / 0" but got "auto"
     8FAIL Computed style test: canvas with {"width":"0","height":"0"} assert_equals: expected "auto 0 / 0" but got "auto"
     9FAIL Computed style test: canvas with {"width":"0.5","height":"1.5"} assert_equals: expected "auto 0 / 1" but got "auto"
     10FAIL Computed style test: canvas with {"width":"10%","height":"20"} assert_equals: expected "auto 10 / 20" but got "auto"
    1111PASS Computed style test: canvas with {"width":null,"height":null}
    1212PASS Computed style test: canvas with {"width":"10","height":null}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html

    r276296 r278299  
    3939
    4040test_computed_style("10", "20", "auto 10 / 20");
    41 // These are invalid per spec, but see
    42 // https://github.com/whatwg/html/issues/4961
    43 test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
    44 test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
    45 test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
    46 
    47 // See https://github.com/whatwg/html/issues/4961:
    48 // https://html.spec.whatwg.org/#attr-canvas-width
    49 // https://html.spec.whatwg.org/#rules-for-parsing-non-negative-integers
    50 test_computed_style("0.5", "1.5", ["auto 0 / 1", "auto 0.5 / 1.5"]);
    51 test_computed_style("10%", "20", ["auto", "auto 10 / 20"]);
    52 
     41test_computed_style("0", "1", "auto 0 / 1");
     42test_computed_style("1", "0", "auto 1 / 0");
     43test_computed_style("0", "0", "auto 0 / 0");
     44test_computed_style("0.5", "1.5", "auto 0 / 1");
     45test_computed_style("10%", "20", "auto 10 / 20");
    5346test_computed_style(null, null, "auto");
    5447test_computed_style("10", null, "auto");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio-expected.txt

    r277997 r278299  
    55PASS Create, append and test immediately: <img> with attributes width=0.8, height=0.2
    66PASS Create, append and test immediately: <img> with attributes width=50% height=25%
     7FAIL Create, append and test immediately: <img> with invalid trailing attributes width=50pp height=25xx assert_approx_equals: expected 2 +/- 0.001 but got Infinity
    78PASS Computed style test: img with {"width":"10","height":"20"}
    89PASS Computed style test: input with {"type":"image","width":"10","height":"20"}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html

    r276498 r278299  
    6464}, "Create, append and test immediately: <img> with attributes width=50% height=25%");
    6565
     66test(function () {
     67  img = new Image();
     68  img.setAttribute("width", "50pp");
     69  img.setAttribute("height", "25xx");
     70  img.src = "/images/blue.png";
     71  document.body.appendChild(img);
     72  assert_ratio(img, 2);
     73}, "Create, append and test immediately: <img> with invalid trailing attributes width=50pp height=25xx");
     74
    6675test_computed_style("10", "20", "auto 10 / 20");
    67 // These are invalid per spec, but see
    68 // https://github.com/whatwg/html/issues/4961
    6976test_computed_style("0", "1", "auto 0 / 1");
    7077test_computed_style("1", "0", "auto 1 / 0");
    7178test_computed_style("0", "0", "auto 0 / 0");
    72 // https://html.spec.whatwg.org/#map-to-the-aspect-ratio-property
    73 // https://html.spec.whatwg.org/#rules-for-parsing-non-zero-dimension-values
    7479test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
    75 
    7680test_computed_style(null, null, "auto");
    7781test_computed_style("10", null, "auto");
     
    101105  test(function () {
    102106    assert_not_equals(images[5].offsetHeight, 500, "Images with alt text should be inline and ignore the aspect ratio");
     107    // Though aspect-ratio is ignored, its value does not change.
     108    assert_equals(getComputedStyle(images[5]).aspectRatio, "auto 100 / 500");
    103109  }, "Loaded images test: Error image with width, height and alt attributes");
    104110
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/resources/aspect-ratio.js

    r276498 r278299  
    99    document.body.appendChild(elem);
    1010    let aspectRatio = getComputedStyle(elem).aspectRatio;
    11     if (Array.isArray(expected)) {
    12       assert_in_array(aspectRatio, expected);
    13     } else {
    14       assert_equals(aspectRatio, expected);
    15     }
     11    assert_equals(aspectRatio, expected);
    1612    elem.remove();
    1713  }, `Computed style test: ${tag} with ${JSON.stringify(attributes)}`);
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html

    r276296 r278299  
    5353test_computed_style("10", "20", "auto 10 / 20");
    5454test_computed_style("0.5", "1.5", "auto 0.5 / 1.5");
    55 
    56 // These are invalid per spec, but see
    57 // https://github.com/whatwg/html/issues/4961
    58 test_computed_style("0", "1", ["auto", "auto 0 / 1"]);
    59 test_computed_style("1", "0", ["auto", "auto 1 / 0"]);
    60 test_computed_style("0", "0", ["auto", "auto 0 / 0"]);
    61 
     55test_computed_style("0", "1", "auto 0 / 1");
     56test_computed_style("1", "0", "auto 1 / 0");
     57test_computed_style("0", "0", "auto 0 / 0");
    6258test_computed_style(null, null, "auto");
    6359test_computed_style("10", null, "auto");
Note: See TracChangeset for help on using the changeset viewer.