Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

26 changes: 26 additions & 0 deletions Example/OpenSwiftUIUITests/View/Text/TextUITests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// TextUITests.swift
// OpenSwiftUIUITests

import SnapshotTesting
import Testing
@testable import TestingHost

@MainActor
@Suite(.snapshots(record: .never, diffTool: diffTool))
struct TextHeightUITests {
@Test
func foregroundColor() {
openSwiftUIAssertSnapshot(of: TextForegroundExample())
}

@Test
func dateFormatStyleExample() {
openSwiftUIAssertSnapshot(of: TextFormatStyleExample())
}

@Test("Verify text background height is normal")
func textHeight() {
openSwiftUIAssertSnapshot(of: TextBackgroundHeightExample())
}
}
22 changes: 21 additions & 1 deletion Example/Shared/View/Text/TextExample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// TextExample.swift
// Shared

import Foundation
#if OPENSWIFTUI
import OpenSwiftUI
#else
import SwiftUI
#endif

struct TextExample: View {
struct TextForegroundExample: View {
var body: some View {
VStack {
Text("Hello World")
Expand All @@ -17,3 +18,22 @@ struct TextExample: View {
}
}
}

struct TextFormatStyleExample: View {
@State private var myDate = Date(timeIntervalSince1970: 1_767_225_600)

var body: some View {
VStack {
Text(myDate, format: Date.FormatStyle(date: .numeric, time: .omitted))
Text(myDate, format: Date.FormatStyle(date: .complete, time: .complete))
Text(myDate, format: Date.FormatStyle().hour(.defaultDigitsNoAMPM).minute())
}
}
}

struct TextBackgroundHeightExample: View {
var body: some View {
Text("Hello, world!")
.background(Color.red)
}
}
23 changes: 0 additions & 23 deletions Example/Shared/View/Text/TextFormatStyleExample.swift

This file was deleted.

11 changes: 11 additions & 0 deletions Sources/OpenSwiftUICore/View/Text/Text/Text+Renderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1026,3 +1026,14 @@ extension Text {
}
}
}

extension _ShapeStyle_Shape.PreparedTextResult {
package func apply(to text: Text) -> Text {
Comment thread
Kyle-Ye marked this conversation as resolved.
switch self {
case let .foregroundColor(color):
text.modified(with: .color(color))
case .foregroundKeyColor:
text.modified(with: .foregroundKeyColor())
}
}
}
Loading
Loading