mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-04 22:52:45 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
870 B
Swift
21 lines
870 B
Swift
#if canImport(UIKit)
|
|
import XCTest
|
|
import UIKit
|
|
@testable import RichTextEditorUIKit
|
|
import RichTextEditorCore
|
|
|
|
final class CanvasBlockTests: XCTestCase {
|
|
func test_blockBox_conformsToCanvasBlock_withParagraphTokenMath() {
|
|
let p = ParagraphBlock(id: BlockID("p"), runs: [TextRun(text: "Hello")])
|
|
let box: CanvasBlock = BlockBox(paragraph: p, mapper: AttributedStringMapper(), width: 300)
|
|
box.nodeStart = 1
|
|
XCTAssertEqual(box.textLength, 5)
|
|
XCTAssertEqual(box.nodeSize, 7) // textLength + 2
|
|
XCTAssertEqual(box.textStart, 1) // == nodeStart for a paragraph
|
|
XCTAssertEqual(box.textRef, .paragraph(BlockID("p")))
|
|
guard case .paragraph(let out) = box.currentBlock() else { return XCTFail("expected paragraph") }
|
|
XCTAssertEqual(out.runs.map(\.text).joined(), "Hello")
|
|
}
|
|
}
|
|
#endif
|