aboutsummaryrefslogtreecommitdiff
path: root/spec/test1_spec.lua
blob: 01d6b0d25b798bb73e18ed980b766c529936470a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
if not package.path:find("spec/%?%.lua;") then
	print("including spec")
	package.path = "./spec/?.lua;" .. package.path
end
_G.assert = assert
local common = require("common")
--[[Create the headless client init file]]
local f = io.open("spec/headless/deviceinit.lua","w")
f:write([=[
return {
    ["Anti Alias"] = 16,
    ["Bits Per Pixel"] = 16,
    ["Device Type"] = "BEST",
    ["Display Adapter"] = 0,
    ["Double Buffer"] = true,
    ["Multithreaded"] = false,
    ["Driver Type"] = "NULL",
    ["Fullscreen"] = false,
    ["Stencil Buffer"] = true,
    ["Stereo Buffer"] = false,
    ["VSync"] = true,
    ["Window Width"] = 640,
    ["Window Height"] = 480,
}
]=])
f:close()

describe("Brok[en]gine",function()
	it("should run #smoke",function()
		common.writegame()
		common.assert_game_runs()
	end)
	it("should provide a lua environment #smoke",function()
		common.writegame("print(\"Hello from lua!\")")
		d = common.rungame()
		assert.truthy(d:find("\nHello from lua!\n"))
	end)

	for k,v in pairs({
		buttons = "newbutton",
		checkboxes = "newcheckbox",
		colorselectors = "newcolorselector",
		editboxes = "neweditbox",
		openfiledialogs = "newfileopendialog",
		images = "newiguiimage",
		labels = "newlabel",
		spinboxes = "newspinbox",
		treeviews = "newtreeview",
		windows = "newwindow",
	}) do
		it("should provide functions to make gui " .. k,function()
			common.writegame("assert(gui." .. v .. ")")
			common.assert_game_runs()
		end)
	end

	it("should provide functions to get the width and height of the screen",function()
		common.writegame("assert(scrw)")
		common.assert_game_runs()
		common.writegame("assert(scrh)")
		common.assert_game_runs()
	end)

end)