This commit is contained in:
wt committed 2026-07-30 20:07:51 +07:00
commit 92660a4ba0
228 files changed
+24496

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import XCTest
@testable import Luma
final class ChatScrollPositionPolicyTests: XCTestCase {
func testBottomSentinelCrossesOnlyTheTelegramButtonThreshold() {
XCTAssertTrue(ChatScrollPositionPolicy.isNearBottom(
bottomY: 796,
viewportHeight: 700
))
XCTAssertFalse(ChatScrollPositionPolicy.isNearBottom(
bottomY: 797,
viewportHeight: 700
))
}
func testInvalidFirstLayoutDoesNotFlashTheButton() {
XCTAssertTrue(ChatScrollPositionPolicy.isNearBottom(
bottomY: 0,
viewportHeight: 0
))
}
func testNativeScrollDistanceCanHideAndRestoreButtonRepeatedly() {
XCTAssertFalse(ChatScrollPositionPolicy.isNearBottom(distanceFromBottom: 180))
XCTAssertTrue(ChatScrollPositionPolicy.isNearBottom(distanceFromBottom: 0))
XCTAssertFalse(ChatScrollPositionPolicy.isNearBottom(distanceFromBottom: 220))
XCTAssertTrue(ChatScrollPositionPolicy.isNearBottom(distanceFromBottom: -12))
}
}