0.10.6
This commit is contained in:
commit
92660a4ba0
228 files changed
+24496
No files matched your search
@@ -0,0 +1,81 @@
|
||||
import CoreGraphics
|
||||
import XCTest
|
||||
@testable import Luma
|
||||
|
||||
final class ComposerRecordingGestureTests: XCTestCase {
|
||||
func testShortMovementKeepsRecording() {
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.resolution(
|
||||
for: CGSize(width: -35, height: -24)
|
||||
),
|
||||
.continueRecording
|
||||
)
|
||||
}
|
||||
|
||||
func testHorizontalSwipeCancelsRecording() {
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.resolution(
|
||||
for: CGSize(width: -110, height: -18)
|
||||
),
|
||||
.cancel
|
||||
)
|
||||
}
|
||||
|
||||
func testVerticalSwipeLocksRecording() {
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.resolution(
|
||||
for: CGSize(width: -12, height: -95)
|
||||
),
|
||||
.lock
|
||||
)
|
||||
}
|
||||
|
||||
func testDominantDiagonalDirectionWins() {
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.resolution(
|
||||
for: CGSize(width: -105, height: -82)
|
||||
),
|
||||
.cancel
|
||||
)
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.resolution(
|
||||
for: CGSize(width: -94, height: -105)
|
||||
),
|
||||
.lock
|
||||
)
|
||||
}
|
||||
|
||||
func testCancelHintOpacityUsesCGFloatMathAndReturnsDouble() {
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.cancelHintOpacity(for: .zero),
|
||||
1,
|
||||
accuracy: 0.0001
|
||||
)
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.cancelHintOpacity(
|
||||
for: CGSize(width: -75, height: 0)
|
||||
),
|
||||
0.5,
|
||||
accuracy: 0.0001
|
||||
)
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.cancelHintOpacity(
|
||||
for: CGSize(width: -200, height: 0)
|
||||
),
|
||||
0.28,
|
||||
accuracy: 0.0001
|
||||
)
|
||||
XCTAssertEqual(
|
||||
ComposerRecordingGesturePolicy.cancelHintOpacity(
|
||||
for: CGSize(width: 50, height: 0)
|
||||
),
|
||||
1,
|
||||
accuracy: 0.0001
|
||||
)
|
||||
}
|
||||
|
||||
func testDelayedMainActorStillRecognizesPhysicalLongPress() {
|
||||
XCTAssertFalse(ComposerRecordingGesturePolicy.isLongPress(elapsed: 0.1))
|
||||
XCTAssertTrue(ComposerRecordingGesturePolicy.isLongPress(elapsed: 0.3))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user