MCPcopy Create free account
hub / github.com/defold/defold / TEST_F

Function TEST_F

engine/script/src/test/test_script_graphics.cpp:28–50  ·  view source on GitHub ↗

Drives the full Lua-side suite via test_graphics.lua's `functions.test_graphics`. The Lua side asserts on shape/types and on the "no graphics context" baseline that the script test harness produces (no HContext is wired into dmScript here).

Source from the content-addressed store, hash-verified

26// The Lua side asserts on shape/types and on the "no graphics context" baseline
27// that the script test harness produces (no HContext is wired into dmScript here).
28TEST_F(ScriptGraphicsTest, TestGraphics)
29{
30 int top = lua_gettop(L);
31
32 ASSERT_TRUE(RunFile(L, "test_graphics.luac"));
33
34 lua_getglobal(L, "functions");
35 ASSERT_EQ(LUA_TTABLE, lua_type(L, -1));
36 lua_getfield(L, -1, "test_graphics");
37 ASSERT_EQ(LUA_TFUNCTION, lua_type(L, -1));
38 int result = dmScript::PCall(L, 0, LUA_MULTRET);
39 if (result == LUA_ERRRUN)
40 {
41 ASSERT_TRUE(false);
42 }
43 else
44 {
45 ASSERT_EQ(0, result);
46 }
47 lua_pop(L, 1);
48
49 ASSERT_EQ(top, lua_gettop(L));
50}
51
52// Spot-check from C++ side: graphics.get_engine_adapters must include "null"
53// when the test binary links GRAPHICS_NULL. This guards against the Lua

Callers

nothing calls this directly

Calls 8

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_getfieldFunction · 0.85
PCallFunction · 0.85
lua_pushnilFunction · 0.85
lua_nextFunction · 0.85
RunFileFunction · 0.70
RunStringFunction · 0.70

Tested by

no test coverage detected