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

35 lines
1.4 KiB
Swift

#if canImport(UIKit)
import XCTest
import UIKit
@testable import RichTextEditorUIKit
import RichTextEditorCore
final class SpellCheckToggleTests: XCTestCase {
private func makeCanvas() -> DocumentCanvasView {
let v = DocumentCanvasView()
v.setBlocks([.paragraph(ParagraphBlock(id: BlockID("p"), runs: [TextRun(text: "hello wrold")]))], width: 320)
v.frame = CGRect(x: 0, y: 0, width: 320, height: 600); v.layoutIfNeeded()
return v
}
func test_disabled_clearsResultsAndReportsTraitNo() {
let v = makeCanvas()
v.applyNativeAnnotations(global: NSRange(location: v.boxes[0].textStart + 6, length: 5), style: .spelling)
XCTAssertFalse(v.spellResults.isEmpty)
v.isSpellCheckingEnabled = false
XCTAssertTrue(v.spellResults.isEmpty) // cleared
XCTAssertEqual(v.spellCheckingType, .no)
XCTAssertTrue(v.spellingUnderlineRects().isEmpty) // nothing to draw
}
func test_enabled_reportsTraitYes() {
let v = makeCanvas()
XCTAssertEqual(v.spellCheckingType, .yes)
}
func test_disabled_tapDoesNotSelectWord() {
let v = makeCanvas()
v.applyNativeAnnotations(global: NSRange(location: v.boxes[0].textStart + 6, length: 5), style: .spelling)
v.isSpellCheckingEnabled = false
XCTAssertFalse(v.beginSpellingCorrection(at: CGPoint(x: 40, y: 8)))
}
}
#endif