mirror of
https://github.com/anomalyco/opentui.git
synced 2026-09-19 01:26:03 +08:00
ffi: preserve viewport lookup success result (#1443)
The native viewport lookup reports whether a view exists, but the FFI binding discarded that result. Preserve the boolean so callers can distinguish missing views from successful lookups.
This commit is contained in:
@@ -77,6 +77,16 @@ function readPackedColor(packed: ArrayBuffer, offset: number): number[] {
|
||||
}
|
||||
|
||||
describe("borrowed pointer call sites", () => {
|
||||
test("preserves the native viewport lookup success result", () => {
|
||||
const x = new Uint32Array([1])
|
||||
const y = new Uint32Array([1])
|
||||
const width = new Uint32Array([1])
|
||||
const height = new Uint32Array([1])
|
||||
|
||||
expect([false, 0]).toContain(symbols.editorViewGetViewport(0, x, y, width, height))
|
||||
expect([x[0], y[0], width[0], height[0]]).toEqual([0, 0, 0, 0])
|
||||
})
|
||||
|
||||
test("stabilizes retained text memory before resolving its pointer", () => {
|
||||
withStubbedSymbols(
|
||||
{
|
||||
|
||||
@@ -1238,7 +1238,7 @@ function getOpenTUILib(libPath?: string) {
|
||||
},
|
||||
editorViewGetViewport: {
|
||||
args: ["u32", "buffer", "buffer", "buffer", "buffer"],
|
||||
returns: "void",
|
||||
returns: "bool",
|
||||
},
|
||||
editorViewSetScrollMargin: {
|
||||
args: ["u32", "f32"],
|
||||
|
||||
Reference in New Issue
Block a user