1
0
Fork 0
gobject-generator/regression/tier3/PangoSmoke.swift

38 lines
1.6 KiB
Swift

// PangoSmoke.swift
// Tier-3-only runtime smoke test for Pango (Phase E2). Proves against
// the REAL libpango, linked at runtime that:
// 1. `findBaseDir(text:length:)` reaches the real `pango_find_base_dir`
// C call, correctly marshalling a Swift `String` through `withCString`
// and marshalling the returned `PangoDirection` C enum back into the
// Swift `Direction` enum via `numericCast`.
// 2. The result reflects the REAL Unicode bidirectional algorithm run by
// libpango not stubbed/placeholder data by exercising both a
// strong-LTR script (Latin) and a strong-RTL script (Hebrew) and
// asserting the opposite directions libpango is known to report.
//
// Not generated. `scripts/smoke-test.sh <tier>` copies tier 1 and the selected
// tier's fixtures for tiers 2 through 5. Tier 6/all copies every tier's fixtures
// into one full-stack SmokeTests target. Only installed for tier >= 3.
import Testing
import GLib
import GObject
import Pango
@Suite("Tier 3 Pango smoke tests")
struct PangoSmokeTests {
@Test("findBaseDir(text:length:) reaches the real pango_find_base_dir and reports LTR for Latin script")
func findBaseDirLatinIsLTR() throws {
let text = "hello world"
let direction = findBaseDir(text: text, length: -1)
#expect(direction == .ltr)
}
@Test("findBaseDir(text:length:) reaches the real pango_find_base_dir and reports RTL for Hebrew script")
func findBaseDirHebrewIsRTL() throws {
let text = "שלום עולם"
let direction = findBaseDir(text: text, length: -1)
#expect(direction == .rtl)
}
}