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

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