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

32 lines
1.2 KiB
Swift

#if canImport(UIKit)
import XCTest
import UIKit
@testable import RichTextEditorUIKit
import RichTextEditorCore
final class CanvasLayoutTests: XCTestCase {
func test_boxesStackVerticallyWithoutOverlap() {
let v = DocumentCanvasView()
v.setParagraphs([
ParagraphBlock(id: BlockID("a"), runs: [TextRun(text: "Alpha")]),
ParagraphBlock(id: BlockID("b"), runs: [TextRun(text: "Beta")]),
], width: 300)
v.frame = CGRect(x: 0, y: 0, width: 300, height: 200)
v.layoutIfNeeded()
XCTAssertEqual(v.boxes[0].frame.minY, 0, accuracy: 0.5)
XCTAssertEqual(v.boxes[1].frame.minY, v.boxes[0].frame.maxY, accuracy: 0.5)
XCTAssertGreaterThan(v.intrinsicContentSize.height, v.boxes[0].frame.height)
}
func test_rendersNonBlankImage() {
let v = DocumentCanvasView()
v.setParagraphs([ParagraphBlock(id: BlockID("a"), runs: [TextRun(text: "Hello")])], width: 300)
v.frame = CGRect(x: 0, y: 0, width: 300, height: 80); v.layoutIfNeeded()
let image = UIGraphicsImageRenderer(bounds: v.bounds).image { _ in
v.drawHierarchy(in: v.bounds, afterScreenUpdates: true)
}
XCTAssertNotNil(image.cgImage)
}
}
#endif