-- 03: GetShapesTexture / GetFontDefault return borrowed views: they must not -- be armed and must stay stable across a GC cycle. local M = dofile("tests/helpers.lua") local R = M.load() if not M.window(64, 64) then M.skip("03_borrowed", "no window") return end M.reset() local b = M.snapshot() local a = R.GetShapesTexture() local f = R.GetFontDefault() local ida, idb = a.id, f.texture.id M.ok(ida ~= 0, "default shapes texture has an id") M.eq(M.delta(b, "armed"), 0, "borrowed shapes texture was not armed") -- Drop the views (and anything derived from them) and force a full GC. If -- these were armed, the finalizers would unload raylib's static resources. a, f = nil, nil M.gc(3) local a2 = R.GetShapesTexture() local f2 = R.GetFontDefault() M.eq(a2.id, ida, "shapes texture id survived GC") M.eq(f2.texture.id, idb, "default font texture id survived GC") M.eq(M.delta(b, "armed"), 0, "no borrowed resource was armed") M.eq(M.delta(b, "errors"), 0, "no finalizer errors") print("ok 03_borrowed")