<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>285778</bug_id>
          
          <creation_ts>2025-01-10 15:28:11 -0800</creation_ts>
          <short_desc>shouldBe in js-test-pre.js is far too noisy when successful</short_desc>
          <delta_ts>2025-01-13 10:21:04 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=280424</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonathan Bedard">jbedard</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2086477</commentid>
    <comment_count>0</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2025-01-10 15:28:11 -0800</bug_when>
    <thetext>When two values are equal in the `shouldBe()` function, we output the value of the matched elements. That&apos;s extremely noisy when those values are pixel positions on a page determined by how the OS renders elements. We should be able to leverage the utilities of js-test-pre.js without enshrining specific pixel positions into layout test expectations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086479</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-10 15:28:33 -0800</bug_when>
    <thetext>&lt;rdar://problem/142712323&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086480</commentid>
    <comment_count>2</comment_count>
    <who name="Jonathan Bedard">jbedard</who>
    <bug_when>2025-01-10 15:28:57 -0800</bug_when>
    <thetext>https://bugs.webkit.org/show_bug.cgi?id=285778 is the bug which inspired me to take a look at this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086759</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2025-01-13 08:15:10 -0800</bug_when>
    <thetext>I think that this is just a test improperly using shouldBe(), and there is no change to be made here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086800</commentid>
    <comment_count>4</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2025-01-13 10:10:48 -0800</bug_when>
    <thetext>(In reply to Jonathan Bedard from comment #2)
&gt; https://bugs.webkit.org/show_bug.cgi?id=285778 is the bug which inspired me
&gt; to take a look at this.

This should, I believe, be https://bugs.webkit.org/show_bug.cgi?id=280424, similar to the See Also.

(In reply to Jonathan Bedard from comment #0)
&gt; When two values are equal in the `shouldBe()` function, we output the value
&gt; of the matched elements. That&apos;s extremely noisy when those values are pixel
&gt; positions on a page determined by how the OS renders elements. We should be
&gt; able to leverage the utilities of js-test-pre.js without enshrining specific
&gt; pixel positions into layout test expectations.

In general, this isn&apos;t too bad, provided there&apos;s no content which depends on how the OS renders content. We used to have guidelines in the form of https://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree#Howtowriteportablepixeltests for pixel tests, and these largely apply here too.

I&apos;d need to check, but looking at https://github.com/WebKit/WebKit/blob/21753b6e53c734d6b8969a631e2429ac41c3e219/LayoutTests/fast/table/col-and-colgroup-offsets.html makes it seem very reliant on font rendering, and font height especially. I wonder if even `table { font: 16px/1 Ahem }` would be enough to get it rendering the same cross platform, because I don&apos;t think there&apos;s anything else OS-dependent?

That said, offsetTop/offsetHeight where the positioned parent is the root always seems a bit risky — given a small change (even the description being filled in!) can change everything.

We also have very few tests with platform specific expectations doing this, which suggests it isn&apos;t a particular problem:

```
LayoutTests % rg &apos;(PASS|FAIL).*offset(Height|Top|Width|Left)&apos; platform --glob &apos;*-expected.txt&apos; --glob &apos;!imported&apos; --files-with-matches | sort -t/ -k3 -k1
platform/gtk/fast/forms/textarea-metrics-expected.txt
platform/ios/fast/shadow-dom/trusted-event-scoped-flags-expected.txt
platform/wpe/fast/sub-pixel/inline-block-with-padding-expected.txt
platform/glib/fast/table/col-and-colgroup-offsets-expected.txt
platform/ios/fast/table/col-and-colgroup-offsets-expected.txt
platform/mac/fast/table/col-and-colgroup-offsets-expected.txt
platform/wpe/fast/text/font-interstitial-invisible-width-while-loading-expected.txt
platform/ios/ios/fast/flexbox/vertical-box-form-controls-expected.txt
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2086804</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2025-01-13 10:21:04 -0800</bug_when>
    <thetext>The point is that tests should be putting the expected expression in quote marks when evaluating it causes this problem. There is no other acceptable solution - we don&apos;t have macros in JavaScript, and removing the expectation from output is not good for analyzing results (we wouldn&apos;t be able to tell how much off it is without the expected value printed in the diff).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>