From 5d970d5a49098e203a78995fe72f1f3a1b34f502 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 10 Jun 2015 14:05:41 -0700 Subject: [PATCH] add missing GL dependency for GLFW #3530 --- src/library_glfw.js | 2 +- tests/glfw_minimal.c | 27 +++++++++++++++++++++++++++ tests/test_browser.py | 4 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/glfw_minimal.c diff --git a/src/library_glfw.js b/src/library_glfw.js index 52519b85f..631aef9d3 100644 --- a/src/library_glfw.js +++ b/src/library_glfw.js @@ -32,7 +32,7 @@ ******************************************************************************/ var LibraryGLFW = { - $GLFW__deps: ['emscripten_get_now'], + $GLFW__deps: ['emscripten_get_now', '$GL'], $GLFW: { Window: function(id, width, height, title, monitor, share) { diff --git a/tests/glfw_minimal.c b/tests/glfw_minimal.c new file mode 100644 index 000000000..dee45643e --- /dev/null +++ b/tests/glfw_minimal.c @@ -0,0 +1,27 @@ +#include +#include +#include +#define GLFW_INCLUDE_ES2 +#include + +int main() { + printf("main function started\n"); + if (glfwInit() != GL_TRUE) { + printf("glfwInit() failed\n"); + glfwTerminate(); + } else { + printf("glfwInit() success\n"); + if (glfwOpenWindow(640, 480, 8, 8, 8, 8, 16, 0, GLFW_WINDOW) != GL_TRUE){ + printf("glfwOpenWindow() failed\n"); + glfwTerminate(); + } else { + printf("glfwOpenWindow() success\n"); + } + } +#ifdef REPORT_RESULT + int result = 1; + REPORT_RESULT(); +#endif + return EXIT_SUCCESS; +} + diff --git a/tests/test_browser.py b/tests/test_browser.py index d38771e55..9a2e61e0b 100644 --- a/tests/test_browser.py +++ b/tests/test_browser.py @@ -1110,6 +1110,10 @@ keydown(100);keyup(100); // trigger the end self.btest('glfw.c', '1', args=['-s', 'LEGACY_GL_EMULATION=1']) self.btest('glfw.c', '1', args=['-s', 'LEGACY_GL_EMULATION=1', '-s', 'USE_GLFW=2']) + def test_glfw_minimal(self): + self.btest('glfw_minimal.c', '1', args=[]) + self.btest('glfw_minimal.c', '1', args=['-s', 'USE_GLFW=2']) + def test_egl(self): open(os.path.join(self.get_dir(), 'test_egl.c'), 'w').write(self.with_report_result(open(path_from_root('tests', 'test_egl.c')).read()))