Unverified Commit bcbe88c6 authored by RobLoach's avatar RobLoach Committed by GitHub
Browse files

Merge pull request #328 from libretro/dev

0.28.0
parents 95918963 f9d414fb
class graphics_print {
var name;
var x;
var y;
class love_graphics_print {
def graphics_print() {
this.name = "graphics.print()";
def love_graphics_print() {
//this.x = 100;
}
def load() {
this.x = 100;
this.y = love.graphics.getHeight() / 2.0f - 30;
this.x = 100
this.y = love.graphics.getHeight() / 2.0f - 30
}
def draw() {
love.graphics.setColor(0, 255, 0)
love.graphics.print("Press left/right to switch tests", this.x, this.y);
love.graphics.print("Press left/right to switch tests", this.x, this.y)
}
def update(delta) {
// Nothing
}
};
class graphics_print_font {
var name;
var ttffont;
var pngfont;
class love_graphics_print_font {
def graphics_print_font() {
this.name = "graphics.print(font)";
def love_graphics_print_font() {
// Nothing.
}
def load() {
......@@ -31,5 +28,7 @@ class graphics_print_font {
love.graphics.print(text, love.graphics.getWidth() / 2.0f - width / 2.0f, love.graphics.getHeight() - height)
}
def update(delta) {}
def update(delta) {
// Nothing.
}
};
class mouse_getPosition {
var name;
class love_mouse_getPosition {
def mouse_getPosition() {
this.name = "mouse.getPosition()";
def love_mouse_getPosition() {
// Nothing.
}
def load() {}
def load() {
// Nothing.
}
def draw() {
love.graphics.setColor(255, 150, 0)
......@@ -14,5 +15,7 @@ class mouse_getPosition {
love.graphics.print(output, pos.x, pos.y);
}
def update(delta) {}
def update(delta) {
// Nothing.
}
};
......@@ -2,11 +2,13 @@
* ChaiLove: Testing Framework
*/
global testNames = [
"graphics_print",
"graphics_draw",
"graphics_point",
"mouse_getPosition",
"graphics_print_font"
"love.graphics.print",
"love.graphics.print.font",
"love.graphics.draw",
"love.graphics.point",
"love.mouse.getPosition",
"love.audio.play",
"love.graphics.draw.scaling"
]
global tests = []
global currenttest = 0
......@@ -15,17 +17,24 @@ def conf(t) {
t.window.width = 460
t.window.height = 320
t.console = true
t.version = "0.27.0"
}
def load() {
print("------------------")
print("------------------")
print("- ChaiLove Tests -")
print("------------------")
print("------------------")
// Set the background to grey, so that we can see screen size.
love.graphics.setBackgroundColor(50, 50, 50)
// Index the test cases.
for (name : testNames) {
love.filesystem.load(name + ".chai");
tests.push_back(eval(name + "()"));
var className = name.replace('.', '_')
print(className)
tests.push_back(eval(className + "()"));
}
// Load all the tests.
......@@ -46,7 +55,7 @@ def draw() {
// Use the default font.
love.graphics.setFont()
love.graphics.setColor(255, 255, 255)
love.graphics.print("Test " + to_string(currenttest + 1) + "/" + to_string(tests.size()) + ": " + tests[currenttest].name, 5, 5);
love.graphics.print("Test " + to_string(currenttest + 1) + "/" + to_string(tests.size()) + ": " + testNames[currenttest], 5, 5);
love.graphics.print("FPS " + to_string(love.timer.getFPS()), 5, 20);
love.graphics.print("Username: " + love.system.getUsername(), 5, 35)
......
/**
* Sound Test
*
* Focused sound test.
*
* retroarch -L chailove_libretro.so test/sound.chai
*/
global beat
def load() {
beat = love.audio.newSource("unittests/assets/chailove.ogg")
print("LOADED!")
if (beat.is_var_null()) {
print("NULLLL!!!!!")
}
//beat = love.audio.newSource("assets/startup.wav")
}
def draw() {
love.graphics.print("Press a joystick button!", 20, 100)
}
def joystickpressed(joystick, button) {
love.audio.play(beat)
}
......@@ -25,3 +25,10 @@ love.system.setClipboardText("Hello World!")
// getClipboardText
assert_equal(love.system.getClipboardText(), "Hello World!", "love.system.getClipboardText()")
// string::replace()
var replaceSubject = "Hello World! Hello World!"
var newReplaceString = replaceSubject.replace("World", "Space")
assert_equal(newReplaceString, "Hello Space! Hello Space!", "string::replace(string, string)")
newReplaceString = replaceSubject.replace('!', '.')
assert_equal(newReplaceString, "Hello World. Hello World.", "string::replace(char, char)")
Subproject commit 0196f2eb58ca8310640ff8b2c302d25b38eefd80
Subproject commit fe12df08508044287aba2317e13cd91596af5af1
Subproject commit 08ecd04802201920fec000778cd1fbacadc14cc3
Subproject commit 29905d94e39090dbde5f9e6d726eb2510618704a
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment