W3C home > Mailing lists > Public > public-css-testsuite@w3.org > January 2011

Re: [RC4] numbers-units-018

From: Gérard Talbot <css21testsuite@gtalbot.org>
Date: Mon, 10 Jan 2011 11:00:20 -0800
Message-ID: <d50fdb0b2af33226f03885ea5c41d40f.squirrel@cp3.shieldhost.com>
To: "Alan Gresley" <alan@css-class.com>
Cc: "Arron Eicholz" <arron.eicholz@microsoft.com>, "Public CSS test suite mailing list" <public-css-testsuite@w3.org>

Le Lun 10 janvier 2011 2:28, Alan Gresley a écrit :
> On 10/01/2011 5:05 PM, "Gérard Talbot" wrote:
>> Hello,
>>
>> http://test.csswg.org/suites/css2.1/20101210/html4/numbers-units-018.htm
>>
>> 1-
>> <title>CSS Test: Specifying em/ex on the root element</title>
>> (...)
>>          <meta name="assert" content="Units 'em' and 'ex' refer to the
>> initial value of the property when specified on the root element
>> of a document.">
>>
>> There is no property with em or ex specified on the root element in
>> the
>> testcase. So, the testcase is not testing what it is declaring to
>> test.
>
>
> The assert should possibly say,
>
>      "Units 'em' and 'ex' used with offset and margins should allow
>       the correct positioning due to the font size of an ancestor
>       and/or font size settings of a UA."
>
>
>> 2-
>> The testcase can never fail, regardless of font used. And the font
>> family in use is never controlled, so we never can predict the value
>> of
>> 30ex as "ex" varies from 1 font family to another.
>> This testcase would require Ahem font and to set it on the root
>> element.
>
>
> The testcase can fail if UAs do not position the black bordered box
> correctly regardless of whatever font is used,

I use different fonts with different browsers and the testcase passes in
all browsers. When using webpage debuggers (Opera DragonFly, Firefox DOM
inspector, Chrome Web Inspector, Konqueror DOMtreeviewer), the actual
value for 30ex varies because of different font used.

> regardless of the font
> size settings in a UA and regardless of an OS screen resolution.

The assumptions for the test suite is that we're all using
# The resolution of the device is 96 CSS pixels per inch.
# The 'medium' font-size computes to 16px.
http://test.csswg.org/suites/css2.1/20101210/#uncommon

But, even here, you could change font size setting for that testcase and
it would still pass.


> With the "em" the left offset and margin-left values (testcase has 30em)
> should correctly position the black bordered box on the right edge of
> the orange box.
>
> With the "ex" the top offset and margin-top values (testcase has 30ex)
> should correctly position the black bordered box on the bottom edge of
> the blue box.


The testcase has a circular logic and is not predictable. It ends up in
a situation where 2 objects must be positioned at 30ex, regardless of
what 1ex is or represents exactly in terms of pixels. 30ex as a length
is compared to 30ex as a length via different properties (margin-top,
height, top): this is not a real test.

The height of the blue stripe varies from using one font to another but
its actual height is not predicted by the testcase. And it never
overlaps the black bordered parg; I say the testcase makes it impossible
too.


> The unit "em" and "ex" are based on the font-size value of it ancestors.

The unit "em" and "ex" (for all properties except font-size) are based
on the font-size value of the current element ... and font properties
(including font-size) are inherited ... so that's possible.

> If no such ancestors exist, then the used size of the "em" and "ex"
> values are base on the default font size of the UA.
>
> <http://www.w3.org/TR/CSS21/syndata.html#length-units>

I can not find the quote you are referring to.

Eventually, what you say about ancestors happens in the testcase.

The testcase was most likely trying to verify, test this statement from
the spec:

"
When specified for the root of the document tree (e.g., "HTML" in HTML),
'em' and 'ex' refer to the property's initial value.
"
<http://www.w3.org/TR/CSS21/syndata.html#length-units>


> This case doesn't need Ahem font.

Alan, the x-height (1ex) of the Ahem font is 0.8em. So
- it makes it easy/easier to create non-fractional pixel situation
- it avoids situation of where testers may be using various different
fonts, each having a different ex value:
http://www.cs.tut.fi/~jkorpela/x-height.html
http://www.barrypearson.co.uk/articles/text/aspect_values.htm
In those references, the 1ex value varies greatly.
- it makes a testcase predictable, reliable, easy to measure/figure out
from a testcase perspective

30ex is always equal to 30ex regardless of the font used and regardless
of font-size used.

---------

By the way,
http://test.csswg.org/suites/css2.1/20101210/html4/numbers-units-020.htm
was removed for RC5 but it could have been just redone, replaced. The
purpose of that testcase was testcase-able.

regards, Gérard
-- 
Contributions to the CSS 2.1 test suite:
http://www.gtalbot.org/BrowserBugsSection/css21testsuite/

CSS 2.1 test suite (RC4; December 10th 2010):
http://test.csswg.org/suites/css2.1/20101210/html4/toc.html

CSS 2.1 test suite contributors:
http://test.csswg.org/source/contributors/
Received on Monday, 10 January 2011 19:00:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 10 January 2011 19:01:05 GMT