Run swift-format
This commit is contained in:
parent
102ab45e10
commit
37eb93f853
|
@ -201,8 +201,8 @@ extension ConfirmationDialogState: CustomDumpReflectable {
|
|||
extension ConfirmationDialogState: Equatable where Action: Equatable {
|
||||
public static func == (lhs: Self, rhs: Self) -> Bool {
|
||||
lhs.title == rhs.title
|
||||
&& lhs.message == rhs.message
|
||||
&& lhs.buttons == rhs.buttons
|
||||
&& lhs.message == rhs.message
|
||||
&& lhs.buttons == rhs.buttons
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public struct TextState: Equatable, Hashable {
|
|||
|
||||
case let (.localized(lk, lt, lb, lc), .localized(rk, rt, rb, rc)):
|
||||
return lk.formatted(tableName: lt, bundle: lb, comment: lc)
|
||||
== rk.formatted(tableName: rt, bundle: rb, comment: rc)
|
||||
== rk.formatted(tableName: rt, bundle: rb, comment: rc)
|
||||
|
||||
case let (.verbatim(lhs), .verbatim(rhs)):
|
||||
return lhs == rhs
|
||||
|
@ -129,7 +129,7 @@ public struct TextState: Equatable, Hashable {
|
|||
let (.verbatim(string), .localized(key, tableName, bundle, comment)):
|
||||
return key.formatted(tableName: tableName, bundle: bundle, comment: comment) == string
|
||||
|
||||
// NB: We do not attempt to equate concatenated cases.
|
||||
// NB: We do not attempt to equate concatenated cases.
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
@ -455,8 +455,8 @@ extension Text {
|
|||
}
|
||||
#else
|
||||
case .accessibilityHeading,
|
||||
.accessibilityLabel,
|
||||
.accessibilityTextContentType:
|
||||
.accessibilityLabel,
|
||||
.accessibilityTextContentType:
|
||||
return text
|
||||
#endif
|
||||
case let .baselineOffset(baselineOffset):
|
||||
|
@ -611,7 +611,7 @@ extension LocalizedStringKey {
|
|||
// `LocalizedStringKey.FormatArgument` differs depending on OS/platform.
|
||||
if children[0].label == "storage" {
|
||||
(value, formatter) =
|
||||
Array(Mirror(reflecting: children[0].value).children)[0].value as! (Any, Formatter?)
|
||||
Array(Mirror(reflecting: children[0].value).children)[0].value as! (Any, Formatter?)
|
||||
} else {
|
||||
value = children[0].value
|
||||
formatter = children[1].value as? Formatter
|
||||
|
@ -718,18 +718,18 @@ extension TextState: CustomDumpRepresentable {
|
|||
case .underline(isActive: true, pattern: _, color: .none):
|
||||
tag("u")
|
||||
case .bold(isActive: false),
|
||||
.font(.none),
|
||||
.fontDesign(.none),
|
||||
.fontWeight(.none),
|
||||
.fontWidth(.none),
|
||||
.foregroundColor(.none),
|
||||
.italic(isActive: false),
|
||||
.monospacedDigit,
|
||||
.speechAlwaysIncludesPunctuation(false),
|
||||
.speechAnnouncementsQueued(false),
|
||||
.speechSpellsOutCharacters(false),
|
||||
.strikethrough(isActive: false, pattern: _, color: _),
|
||||
.underline(isActive: false, pattern: _, color: _):
|
||||
.font(.none),
|
||||
.fontDesign(.none),
|
||||
.fontWeight(.none),
|
||||
.fontWidth(.none),
|
||||
.foregroundColor(.none),
|
||||
.italic(isActive: false),
|
||||
.monospacedDigit,
|
||||
.speechAlwaysIncludesPunctuation(false),
|
||||
.speechAnnouncementsQueued(false),
|
||||
.speechSpellsOutCharacters(false),
|
||||
.strikethrough(isActive: false, pattern: _, color: _),
|
||||
.underline(isActive: false, pattern: _, color: _):
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,67 +8,67 @@ final class TextStateTests: XCTestCase {
|
|||
customDump(TextState("Hello, world!"), to: &dump)
|
||||
XCTAssertEqual(
|
||||
dump,
|
||||
"""
|
||||
"Hello, world!"
|
||||
"""
|
||||
"""
|
||||
"Hello, world!"
|
||||
"""
|
||||
)
|
||||
|
||||
dump = ""
|
||||
customDump(
|
||||
TextState("Hello, ")
|
||||
+ TextState("world").bold().italic()
|
||||
+ TextState("!"),
|
||||
+ TextState("world").bold().italic()
|
||||
+ TextState("!"),
|
||||
to: &dump
|
||||
)
|
||||
XCTAssertEqual(
|
||||
dump,
|
||||
"""
|
||||
"Hello, _**world**_!"
|
||||
"""
|
||||
"""
|
||||
"Hello, _**world**_!"
|
||||
"""
|
||||
)
|
||||
|
||||
dump = ""
|
||||
customDump(
|
||||
TextState("Offset by 10.5").baselineOffset(10.5)
|
||||
+ TextState("\n") + TextState("Headline").font(.headline)
|
||||
+ TextState("\n") + TextState("No font").font(nil)
|
||||
+ TextState("\n") + TextState("Light font weight").fontWeight(.light)
|
||||
+ TextState("\n") + TextState("No font weight").fontWeight(nil)
|
||||
+ TextState("\n") + TextState("Red").foregroundColor(.red)
|
||||
+ TextState("\n") + TextState("No color").foregroundColor(nil)
|
||||
+ TextState("\n") + TextState("Italic").italic()
|
||||
+ TextState("\n") + TextState("Kerning of 2.5").kerning(2.5)
|
||||
+ TextState("\n") + TextState("Stricken").strikethrough()
|
||||
+ TextState("\n") + TextState("Stricken green").strikethrough(color: .green)
|
||||
+ TextState("\n") + TextState("Not stricken blue").strikethrough(false, color: .blue)
|
||||
+ TextState("\n") + TextState("Tracking of 5.5").tracking(5.5)
|
||||
+ TextState("\n") + TextState("Underlined").underline()
|
||||
+ TextState("\n") + TextState("Underlined pink").underline(color: .pink)
|
||||
+ TextState("\n") + TextState("Not underlined purple").underline(false, color: .pink),
|
||||
+ TextState("\n") + TextState("Headline").font(.headline)
|
||||
+ TextState("\n") + TextState("No font").font(nil)
|
||||
+ TextState("\n") + TextState("Light font weight").fontWeight(.light)
|
||||
+ TextState("\n") + TextState("No font weight").fontWeight(nil)
|
||||
+ TextState("\n") + TextState("Red").foregroundColor(.red)
|
||||
+ TextState("\n") + TextState("No color").foregroundColor(nil)
|
||||
+ TextState("\n") + TextState("Italic").italic()
|
||||
+ TextState("\n") + TextState("Kerning of 2.5").kerning(2.5)
|
||||
+ TextState("\n") + TextState("Stricken").strikethrough()
|
||||
+ TextState("\n") + TextState("Stricken green").strikethrough(color: .green)
|
||||
+ TextState("\n") + TextState("Not stricken blue").strikethrough(false, color: .blue)
|
||||
+ TextState("\n") + TextState("Tracking of 5.5").tracking(5.5)
|
||||
+ TextState("\n") + TextState("Underlined").underline()
|
||||
+ TextState("\n") + TextState("Underlined pink").underline(color: .pink)
|
||||
+ TextState("\n") + TextState("Not underlined purple").underline(false, color: .pink),
|
||||
to: &dump
|
||||
)
|
||||
XCTAssertNoDifference(
|
||||
dump,
|
||||
#"""
|
||||
"""
|
||||
<baseline-offset=10.5>Offset by 10.5</baseline-offset>
|
||||
Headline
|
||||
No font
|
||||
<font-weight=light>Light font weight</font-weight>
|
||||
No font weight
|
||||
<foreground-color=red>Red</foreground-color>
|
||||
No color
|
||||
_Italic_
|
||||
<kerning=2.5>Kerning of 2.5</kerning>
|
||||
~~Stricken~~
|
||||
<s color=green>Stricken green</s>
|
||||
Not stricken blue
|
||||
<tracking=5.5>Tracking of 5.5</tracking>
|
||||
<u>Underlined</u>
|
||||
<u color=pink>Underlined pink</u>
|
||||
Not underlined purple
|
||||
"""
|
||||
"""#
|
||||
#"""
|
||||
"""
|
||||
<baseline-offset=10.5>Offset by 10.5</baseline-offset>
|
||||
Headline
|
||||
No font
|
||||
<font-weight=light>Light font weight</font-weight>
|
||||
No font weight
|
||||
<foreground-color=red>Red</foreground-color>
|
||||
No color
|
||||
_Italic_
|
||||
<kerning=2.5>Kerning of 2.5</kerning>
|
||||
~~Stricken~~
|
||||
<s color=green>Stricken green</s>
|
||||
Not stricken blue
|
||||
<tracking=5.5>Tracking of 5.5</tracking>
|
||||
<u>Underlined</u>
|
||||
<u color=pink>Underlined pink</u>
|
||||
Not underlined purple
|
||||
"""
|
||||
"""#
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue