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
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import Testing
@MainActor
@Suite(.serialized)
struct TapGestureUXTests {
@Test
func onTapGestureIncrementsCount() async throws {
@Test(arguments: [1, 2])
func onTapGestureIncrementsCount(tapCount: Int) async throws {
var count = 0
let content = Color.red.onTapGesture {
let content = Color.red.onTapGesture(count: tapCount) {
count += 1
}
try await withUXTestHost(of: content) { host in
#expect(count == 0)
try await host.tap()
try await host.tap(count: tapCount)
try await host.waitUntil(count > 0)
#expect(count == 1)
}
Expand Down
6 changes: 3 additions & 3 deletions Example/OpenSwiftUIUXTests/UXTests/UXTestHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func withUXTestHost<Content: View>(
struct UXTestHost {
fileprivate let events: EventGenerator

func tap() async throws {
func tap(count: Int = 1) async throws {
#if os(macOS)
try await events.mouseClick()
try await events.mouseClick(numberOfTimes: count)
#else
try await onMainRunLoop { try events.fingerTap() }
try await onMainRunLoop { try events.fingerTap(numberOfTimes: count) }
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions Example/Tuist/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Example/Tuist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var dependencies: [PackageDescription.Package.Dependency] = [
.package(url: "https://github.com/OpenSwiftUIProject/equatable.git", branch: "main"),
.package(url: "https://github.com/OpenSwiftUIProject/SymbolLocator.git", from: "0.2.0"),
.package(url: "https://github.com/OpenSwiftUIProject/swift-snapshot-testing.git", exact: "1.19.3"),
.package(url: "https://github.com/OpenSwiftUIProject/Hammer.git", exact: "0.19.1"),
.package(url: "https://github.com/OpenSwiftUIProject/Hammer.git", exact: "0.19.2"),
]

if openCombineCondition {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ private struct ExclusivePhase<First, Second>: Rule where First: Gesture, Second:
.active(.second(value2))
case let (.failed, .possible(.some(value2))):
.possible(.second(value2))
case (.failed, .possible(.none)):
.possible(nil)
case let (.failed, .ended(value2)):
.ended(.second(value2))
case (.failed, _):
Expand Down
2 changes: 2 additions & 0 deletions Sources/OpenSwiftUICore/Event/Gesture/GestureInputs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ public struct _GestureInputs {
_ other: _ViewInputs,
viewSubgraph: Subgraph
) {
let time = viewInputs.time
self.viewInputs = other
self.viewInputs.time = time
self.viewInputs.copyCaches()
self.viewSubgraph = viewSubgraph
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenSwiftUICore/Event/Gesture/GesturePhase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ extension GesturePhase {
}

package var isActive: Bool {
guard case .active = self else {
return false
switch self {
case .possible, .failed: false
case .active, .ended: true
}
return true
}

package var isTerminal: Bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ extension AnyGestureResponder {
childSubgraph!.apply {
let subgraph = (childViewSubgraph ?? childSubgraph)!
var childInputs = inputs
childInputs.viewInputs = self.inputs
childInputs.copyCaches()
childInputs.viewSubgraph = subgraph
childInputs.mergeViewInputs(self.inputs, viewSubgraph: subgraph)
let childOutputs = makeChild(childInputs)
outputs.overrideDefaultValues(childOutputs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import OpenObservation
@_spi(ForOpenSwiftUIOnly)
import OpenSwiftUICore

@MainActor
@Suite("ObservationUtil Tests")
struct ObservationUtilTests {

Expand Down Expand Up @@ -38,7 +39,6 @@ struct ObservationUtilTests {
}

#if canImport(Darwin)
@MainActor
@Test("_withObservation with attribute installation")
func withObservationAttribute() {
let model = TestModel()
Expand Down
Loading