Specification link: 7.10 Units

coords-units-02-b ← index → coords-viewattr-01-b

Tests that contain the draft-watermark are under development and may be incorrectly testing a feature.

# coords-units-03-b.svg
SVG Image | PNG Image

## Operator Script

Run the test. No interaction required.

## Pass Criteria

The test passes if the top three lines (user units, px, em) are the same length, the fifth line (%) is the same length as the top three lines, and the bottom five lines (in, cm, mm, pt, pc) are the same length. The fourth line (ex) may have any non-zero length, since the X-height of the font will depend on the exact font chosen by the user agent (which may vary).

## Test Description

This test verifies both the initial viewport size and the support for the various unit specifiers.

The units in SVG can be: user coordinate and CSS units: em, ex, px, pt, pc, cm, mm, in and percentages. The test does not check the absolute length accuracy as this can only be truly validated with a ruler. However, it validates that the different units are supported by drawing multiple elements who have the same length specified in different units.

The viewport is the "finite rectangular region" where rendering occurs in SVG. Hence, nothing should be rendered outside the viewport (paragraph 7.1). Furthermore, when no positioning properties are set on the top svg element, the initial viewport size should have the value of the top svg element's "width" and "height" attributes. To check this behavior, the test does not define positioning properties on the top svg element but defines its "width" and "height" properties. Then it fills a red rectangle that is bigger than the viewport size. Then, a rectangle, the size of the viewport is drawn in white. If rendering is limited to the viewport area, none of the red should show.

The line showing the "ex" units will not necessarily appear with the same length as shown in the reference image because the X-height of a font is not necessarily half of the font size (which is assumed in the reference image where 1ex is considered to be .5em).

coords-units-02-b ← index → coords-viewattr-01-b