Skip to content

TextHeightUITests.foregroundColor renders differently on macOS #971

Description

@Kyle-Ye

Summary

TextHeightUITests/foregroundColor() fails its macOS snapshot comparison.

The rendered text differs from the SwiftUI reference even though both display lists place the two text items directly adjacent to each other.

Reproduction

The failing view is:

VStack {
    Text("Hello World")
    Text("From OpenSwiftUI")
        .foregroundStyle(.red)
}

Run TextHeightUITests/foregroundColor() on macOS and compare the OpenSwiftUI result with the SwiftUI reference.

Current behavior

OpenSwiftUI produces a snapshot mismatch for the foreground color example.

Display list comparison

OpenSwiftUI

View 0x0000000101d04980 at Time(seconds: 0.13566520833319373):
(display-list
  (item #:identity 1 #:version 7
    (frame (215.0 134.0; 71.0 16.0))
    (content-seed 15)
    (text "Hello World" #:size (71.0, 16.0)))
  (item #:identity 2 #:version 8
    (frame (195.0 150.0; 111.0 16.0))
    (content-seed 17)
    (text "From OpenSwiftUI" #:size (111.0, 16.0))))

SwiftUI

View 0x0000000158808200 at Time(seconds: 1.1519964583333149):
(display-list
  (item #:identity 1 #:version 37
    (frame (415.0 223.0; 70.5 16.0))
    (effect
      (item #:version 23
        (frame (0.0 0.0; 70.5 16.0))
        (content-seed 47)
        (text "Hello World" #:size (70.5, 16.0)))))
  (item #:identity 2 #:version 36
    (frame (394.5 239.0; 111.0 16.0))
    (effect
      (item #:version 21
        (frame (0.0 0.0; 111.0 16.0))
        (content-seed 43)
        (text "From OpenSwiftUI" #:size (111.0, 16.0))))))

Expected behavior

The OpenSwiftUI rendering should match the SwiftUI reference on macOS, allowing TextHeightUITests/foregroundColor() to pass.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: renderingDisplayList, render backends, renderer hosts, drawing, and effects.area: testsTest suites, UI tests, fixtures, snapshots, and test support code.area: textText, labels, line style, and text rendering APIs.impact: visual-diffVisual mismatch, screenshot diff, or rendering fidelity issue.platform: macOSmacOS-specific behavior or support.type: bugSomething is not working correctly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions