Some checks failed
release / linux/x86_64 (pull_request) Failing after 1m54s
release / freebsd/x86_64 (pull_request) Successful in 5m1s
release / linux/aarch64 (pull_request) Failing after 1m54s
release / linux/armv7 (pull_request) Failing after 2m12s
release / linux/i686 (pull_request) Failing after 1m59s
release / android (pull_request) Successful in 2m54s
release / windows/i686 (pull_request) Successful in 2m3s
release / windows/x86_64 (pull_request) Successful in 2m15s
32 lines
1,014 B
Lua
32 lines
1,014 B
Lua
-- 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")
|