Files
ichmagmaus111andClaude Opus 5.5 0622057a4f Ghostgram: open-source release
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:57:09 +01:00

28 lines
1.1 KiB
Swift

#if canImport(UIKit)
import XCTest
import UIKit
@testable import RichTextEditorUIKit
final class SelectionFillDirectionTests: XCTestCase {
private func layout() -> BlockLayoutEngine {
// Short single-line content so there is exactly one selection segment.
makeBlockLayout(attributedString: NSAttributedString(
string: "abcd", attributes: [.font: UIFont.systemFont(ofSize: 17)]), width: 200)
}
func test_ltr_coveredFromStart_fillsToLeftEdge_notRight() {
let l = layout()
let r = l.selectionFillRects(start: 0, end: 4, fillTrailingLine: false, isRTL: false)
XCTAssertEqual(r.count, 1)
XCTAssertLessThan(r[0].maxX, l.containerWidth - 5, "LTR leading fills left, stops at glyph end")
}
func test_rtl_coveredFromStart_fillsToRightEdge() {
let l = layout()
let r = l.selectionFillRects(start: 0, end: 4, fillTrailingLine: false, isRTL: true)
XCTAssertEqual(r.count, 1)
XCTAssertEqual(r[0].maxX, l.containerWidth, accuracy: 1, "RTL leading fills to the right edge")
}
}
#endif