diff --git a/libs/openFrameworksCompiled/project/makefileCommon/compile.core.mk b/libs/openFrameworksCompiled/project/makefileCommon/compile.core.mk index 78a80027e60..4224dd4bae9 100644 --- a/libs/openFrameworksCompiled/project/makefileCommon/compile.core.mk +++ b/libs/openFrameworksCompiled/project/makefileCommon/compile.core.mk @@ -48,7 +48,7 @@ endif ifdef ${ccache} $(info 💿 Using CCACHE - compile.core.mk ) CXX := ${ccache} $(CXX) - CC := ${ccache} $(CXX) + CC := ${ccache} $(CC) endif $(info 💾 CXX = $(CXX)) diff --git a/libs/openFrameworksCompiled/project/makefileCommon/config.project.mk b/libs/openFrameworksCompiled/project/makefileCommon/config.project.mk index 094ad477364..4062048e0c3 100644 --- a/libs/openFrameworksCompiled/project/makefileCommon/config.project.mk +++ b/libs/openFrameworksCompiled/project/makefileCommon/config.project.mk @@ -423,7 +423,7 @@ endif ifdef ${ccache} $(info 💿 Using CCACHE -- config.project.mk ) CXX := ${ccache} $(CXX) - CC := ${ccache} $(CXX) + CC := ${ccache} $(CC) endif ifdef PROJECT_RESOURCE_COMPILER diff --git a/libs/openFrameworksCompiled/project/msys2/config.msys2.default.mk b/libs/openFrameworksCompiled/project/msys2/config.msys2.default.mk index bb5e17076c0..7b5709fcddc 100644 --- a/libs/openFrameworksCompiled/project/msys2/config.msys2.default.mk +++ b/libs/openFrameworksCompiled/project/msys2/config.msys2.default.mk @@ -27,7 +27,8 @@ #MINGW_PREFIX ?= /mingw32 MINGW_PREFIX ?= /mingw64 -PLATFORM_CFLAGS += -std=gnu++17 -DUNICODE -D_UNICODE +PLATFORM_CXXFLAGS += -std=gnu++17 +PLATFORM_CFLAGS += -DUNICODE -D_UNICODE #PLATFORM_CFLAGS += -IC:/msys64/mingw32/include/gstreamer-1.0 -DOF_VIDEO_PLAYER_GSTREAMER CC = $(MINGW_PREFIX)/bin/gcc diff --git a/scripts/ci/linux64/install.sh b/scripts/ci/linux64/install.sh index fae3e3a30e8..2ae068325eb 100755 --- a/scripts/ci/linux64/install.sh +++ b/scripts/ci/linux64/install.sh @@ -19,6 +19,7 @@ echo "checking assimp versions" apt-cache policy libassimp-dev sudo $OF_ROOT/scripts/linux/ubuntu/install_dependencies.sh -y; +sudo apt-get install -y xvfb || true #commenting out below so we can get it working with default in Ubuntu 18.04 #sudo add-apt-repository -y ppa:dns/gnu diff --git a/scripts/ci/linux64/run_tests.sh b/scripts/ci/linux64/run_tests.sh index 2f247e16e1e..f9d60c9dd6f 100755 --- a/scripts/ci/linux64/run_tests.sh +++ b/scripts/ci/linux64/run_tests.sh @@ -9,6 +9,10 @@ ROOT=${TRAVIS_BUILD_DIR:-"$( cd "$(dirname "$0")/../../.." ; pwd -P )"} echo "##[group]**** Running unit tests ****" cd $ROOT/tests for group in *; do + # android / ios / emscripten have their own CI jobs; native linux Makefile can't run them + case "$group" in + android|ios|tvOS|emscripten) continue ;; + esac if [ -d $group ]; then echo "##[group] $group" for test in $group/*; do @@ -23,8 +27,12 @@ for group in *; do binname=$(basename ${test}) if [[ -f ./${binname}_debug ]]; then - gdb -batch -ex "run" -ex "bt" -ex "q \$_exitcode" ./${binname}_debug - #./${binname}_debug + # GitHub linux runners have no DISPLAY; xvfb gives GLFW a software GL context + if [ -z "${DISPLAY:-}" ] && command -v xvfb-run >/dev/null 2>&1; then + xvfb-run -a gdb -batch -ex "run" -ex "bt" -ex "q \$_exitcode" ./${binname}_debug + else + gdb -batch -ex "run" -ex "bt" -ex "q \$_exitcode" ./${binname}_debug + fi else echo "Binary not found: ${binname}_debug" exit 1 diff --git a/scripts/ci/macos/run_tests.sh b/scripts/ci/macos/run_tests.sh index 3fe804c1a79..2add698c4a6 100755 --- a/scripts/ci/macos/run_tests.sh +++ b/scripts/ci/macos/run_tests.sh @@ -22,6 +22,9 @@ make -j Debug echo "**** Running unit tests ****" cd $ROOT/tests for group in *; do + case "$group" in + android|ios|tvOS|emscripten) continue ;; + esac if [ -d $group ]; then for test in $group/*; do if [ -d $test ]; then diff --git a/scripts/ci/msys2/run_tests.sh b/scripts/ci/msys2/run_tests.sh index 49be1664722..79c10087eba 100755 --- a/scripts/ci/msys2/run_tests.sh +++ b/scripts/ci/msys2/run_tests.sh @@ -6,6 +6,9 @@ ROOT=$(pwd -P) echo "##[group]**** Running unit tests ****" cd $ROOT/tests for group in *; do + case "$group" in + android|ios|tvOS|emscripten) continue ;; + esac if [ -d $group ]; then echo "##[group] $group" for test in $group/*; do diff --git a/scripts/ci/osx/run_tests.sh b/scripts/ci/osx/run_tests.sh index 43908338bc2..a1be4fa55cf 100755 --- a/scripts/ci/osx/run_tests.sh +++ b/scripts/ci/osx/run_tests.sh @@ -23,6 +23,9 @@ echo "##[endgroup]" echo "##[group]**** Running unit tests ****" cd $ROOT/tests for group in *; do + case "$group" in + android|ios|tvOS|emscripten) continue ;; + esac if [ -d $group ]; then echo "##[group] $group" for test in $group/*; do @@ -42,4 +45,4 @@ for group in *; do echo "##[endgroup]" fi done -echo "##[endgroup]" \ No newline at end of file +echo "##[endgroup]" diff --git a/tests/emscripten/glRenderSmokeTest/bin/data/.gitkeep b/tests/emscripten/glRenderSmokeTest/bin/data/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/emscripten/glRenderSmokeTest/src/GLSmokeTestCore.h b/tests/emscripten/glRenderSmokeTest/src/GLSmokeTestCore.h new file mode 120000 index 00000000000..8348b55e4e7 --- /dev/null +++ b/tests/emscripten/glRenderSmokeTest/src/GLSmokeTestCore.h @@ -0,0 +1 @@ +../../../gl/glRenderSmokeTest/src/GLSmokeTestCore.h \ No newline at end of file diff --git a/tests/emscripten/glRenderSmokeTest/src/main.cpp b/tests/emscripten/glRenderSmokeTest/src/main.cpp new file mode 120000 index 00000000000..1759b2cfa9c --- /dev/null +++ b/tests/emscripten/glRenderSmokeTest/src/main.cpp @@ -0,0 +1 @@ +../../../gl/glRenderSmokeTest/src/main.cpp \ No newline at end of file diff --git a/tests/emscripten/glRenderSmokeTest/src/ofApp.cpp b/tests/emscripten/glRenderSmokeTest/src/ofApp.cpp new file mode 120000 index 00000000000..f964b43be2e --- /dev/null +++ b/tests/emscripten/glRenderSmokeTest/src/ofApp.cpp @@ -0,0 +1 @@ +../../../gl/glRenderSmokeTest/src/ofApp.cpp \ No newline at end of file diff --git a/tests/emscripten/glRenderSmokeTest/src/ofApp.h b/tests/emscripten/glRenderSmokeTest/src/ofApp.h new file mode 120000 index 00000000000..23cba82a42e --- /dev/null +++ b/tests/emscripten/glRenderSmokeTest/src/ofApp.h @@ -0,0 +1 @@ +../../../gl/glRenderSmokeTest/src/ofApp.h \ No newline at end of file diff --git a/tests/gl/glRenderSmokeTest/README.md b/tests/gl/glRenderSmokeTest/README.md new file mode 100644 index 00000000000..1a3bea4ae12 --- /dev/null +++ b/tests/gl/glRenderSmokeTest/README.md @@ -0,0 +1,27 @@ +# GL render smoke test + +Exercises the code paths touched by the OpenGL ES 3.0/3.1 support work: +an indexed `ofVboMesh` drawn both directly (`drawElements`) and instanced +(`drawElementsInstanced`), a tessellated `ofPath` (tess2 / `ofIndexType`), +and an `ofFbo` round trip with a pixel readback to catch garbage/blank +triangles caused by an index-type/size mismatch. + +The actual test logic lives in `src/GLSmokeTestCore.h` and is shared, +unmodified, by every platform target (desktop here, `tests/emscripten/glRenderSmokeTest`, +`tests/ios/glRenderSmokeTest`) — only the platform bridge (`ofApp`/`main`) +differs. + +On desktop this is a normal windowed openFrameworks app picked up +automatically by the existing `tests/` CI harness (`scripts/ci/*/run_tests.sh`): +it runs a fixed number of frames, logs `GL_SMOKE_TEST RESULT=PASS` or +`RESULT=FAIL reason=...`, and exits with a matching process exit code. + +To run manually: + +```sh +cd tests/gl/glRenderSmokeTest +cp ../../../scripts/templates/osx/Makefile . # or linux/linux64 template +cp ../../../scripts/templates/osx/config.make . +make Debug +make RunDebug +``` diff --git a/tests/gl/glRenderSmokeTest/bin/data/.gitkeep b/tests/gl/glRenderSmokeTest/bin/data/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/gl/glRenderSmokeTest/src/GLSmokeTestCore.h b/tests/gl/glRenderSmokeTest/src/GLSmokeTestCore.h new file mode 100644 index 00000000000..511d94788a1 --- /dev/null +++ b/tests/gl/glRenderSmokeTest/src/GLSmokeTestCore.h @@ -0,0 +1,173 @@ +#pragma once + +#include "ofMain.h" + +// Shared by every platform target of glRenderSmokeTest (desktop, Emscripten, +// iOS, Android). Exercises the code paths touched by the OpenGL ES 3.0/3.1 +// support work: indexed ofVboMesh draw + drawInstanced (drawElements / +// drawElementsInstanced), a tessellated ofPath (tess2 / ofIndexType), and an +// ofFbo round trip, on whatever GL/GLES context the host window created. +// +// No custom shader is used deliberately: the GLSL version/#define story +// differs per platform (desktop core profile vs GLES2 vs GLES3 "300 es" vs +// Emscripten) and isn't what this PR touches. Using the renderer's own +// default shader keeps the test focused on the index-type and tess2 paths +// while still exercising the ES-version #ifdef branches in +// ofGLProgrammableRenderer indirectly (every draw call goes through them). +class GLSmokeTestCore { +public: + static constexpr int framesToRun = 12; + + void allocate() { + release(); + + indexedMesh.setMode(OF_PRIMITIVE_TRIANGLES); + indexedMesh.addVertices({ + {-60.f, -60.f, 0.f}, {60.f, -60.f, 0.f}, + {60.f, 60.f, 0.f}, {-60.f, 60.f, 0.f} + }); + indexedMesh.addColors({ofColor::red, ofColor::green, ofColor::blue, ofColor::yellow}); + indexedMesh.addIndices({0, 1, 2, 0, 2, 3}); + + tessellatedPath.clear(); + tessellatedPath.setFilled(true); + tessellatedPath.setFillColor(ofColor(255, 140, 20)); + tessellatedPath.setPolyWindingMode(OF_POLY_WINDING_ODD); + for (int i = 0; i < 12; ++i) { + const float radius = (i % 2 == 0) ? 55.f : 22.f; + const float angle = ofDegToRad(i * 30.f - 90.f); + const glm::vec2 point(std::cos(angle) * radius, std::sin(angle) * radius); + if (i == 0) { + tessellatedPath.moveTo(point); + } else { + tessellatedPath.lineTo(point); + } + } + tessellatedPath.close(); + + ofFbo::Settings settings; + settings.width = 128; + settings.height = 128; + settings.internalformat = GL_RGBA; + settings.useDepth = false; + settings.numSamples = 0; + fbo.allocate(settings); + + allocated = fbo.isAllocated(); + if (!allocated) { + fail("ofFbo failed to allocate"); + } + } + + void release() { + fbo.clear(); + allocated = false; + } + + void drawFrame() { + if (!allocated) { + fail("resources not allocated"); + return; + } + + clearGLErrors(); + + fbo.begin(); + ofClear(0, 0, 0, 255); + ofSetColor(255); + ofPushMatrix(); + ofTranslate(fbo.getWidth() * 0.5f, fbo.getHeight() * 0.5f); + indexedMesh.draw(); // ofGLProgrammableRenderer::draw(ofVboMesh) -> drawElements + indexedMesh.drawInstanced(OF_MESH_FILL, 2); // forces the drawElementsInstanced path (primCount > 1) + ofPopMatrix(); + fbo.end(); + checkGLErrors("after mesh draw"); + + ofSetColor(255); + fbo.draw(0.f, 0.f, static_cast(fbo.getWidth()), static_cast(fbo.getHeight())); + + ofPushMatrix(); + ofTranslate(180.f, 160.f); + tessellatedPath.draw(); // tess2 triangulation -> ofIndexType-sized indices + ofPopMatrix(); + checkGLErrors("after path draw"); + + if (frame == framesToRun - 1) { + verifyPixels(); + } + ++frame; + } + + bool finished() const { + return frame >= framesToRun; + } + + bool passed() const { + return allocated && glErrorCount == 0 && pixelCheckPassed && failureReason.empty(); + } + + std::string resultLine() const { + if (passed()) { + return "GL_SMOKE_TEST RESULT=PASS frames=" + ofToString(frame); + } + std::string reason = failureReason; + if (reason.empty() && glErrorCount > 0) { + reason = "glGetError seen " + ofToString(glErrorCount) + " time(s), last=" + ofToHex(lastGLError); + } + if (reason.empty() && !pixelCheckPassed) { + reason = "FBO readback did not contain the expected non-background color"; + } + return "GL_SMOKE_TEST RESULT=FAIL reason=" + reason; + } + +private: + void fail(const std::string & reason) { + if (failureReason.empty()) { + failureReason = reason; + } + ofLogError("glRenderSmokeTest") << reason; + } + + void clearGLErrors() { + while (glGetError() != GL_NO_ERROR) { + } + } + + void checkGLErrors(const std::string & where) { + GLenum error = glGetError(); + while (error != GL_NO_ERROR) { + ++glErrorCount; + lastGLError = error; + ofLogError("glRenderSmokeTest") << "glGetError=" << ofToHex(error) << " " << where; + error = glGetError(); + } + } + + void verifyPixels() { + ofPixels pixels; + fbo.readToPixels(pixels); + if (!pixels.isAllocated()) { + fail("FBO readToPixels produced no pixels"); + return; + } + const ofColor center = pixels.getColor(pixels.getWidth() / 2, pixels.getHeight() / 2); + // Background is cleared to black; any of the mesh's red/green/blue/yellow + // vertex colors interpolating in means the indexed draw actually reached + // the GPU with correctly-sized indices instead of reading garbage/nothing. + pixelCheckPassed = (center.r > 10 || center.g > 10 || center.b > 10); + if (!pixelCheckPassed) { + ofLogError("glRenderSmokeTest") << "center pixel=" << center << " (expected non-background)"; + } + } + + ofVboMesh indexedMesh; + ofPath tessellatedPath; + ofFbo fbo; + + bool allocated = false; + bool pixelCheckPassed = false; + int frame = 0; + int glErrorCount = 0; + GLenum lastGLError = GL_NO_ERROR; + std::string failureReason; +}; diff --git a/tests/gl/glRenderSmokeTest/src/main.cpp b/tests/gl/glRenderSmokeTest/src/main.cpp new file mode 100644 index 00000000000..05d0805d001 --- /dev/null +++ b/tests/gl/glRenderSmokeTest/src/main.cpp @@ -0,0 +1,23 @@ +#include "ofMain.h" +#include "ofApp.h" +#if defined(TARGET_GLFW_WINDOW) +#include "ofAppGLFWWindow.h" +#endif + +int main() { + ofGLWindowSettings settings; + settings.setSize(320, 240); + settings.windowMode = OF_WINDOW; + + auto window = ofCreateWindow(settings); +#if defined(TARGET_GLFW_WINDOW) + auto glfw = dynamic_cast(window.get()); + if (!glfw || !glfw->getGLFWWindow()) { + ofLogWarning("glRenderSmokeTest") << "no GL window (headless / GLFW init failed) — skip"; + return 0; + } +#endif + + ofRunApp(window, std::make_shared()); + return ofRunMainLoop(); +} diff --git a/tests/gl/glRenderSmokeTest/src/ofApp.cpp b/tests/gl/glRenderSmokeTest/src/ofApp.cpp new file mode 100644 index 00000000000..e6be032f18d --- /dev/null +++ b/tests/gl/glRenderSmokeTest/src/ofApp.cpp @@ -0,0 +1,42 @@ +#include "ofApp.h" + +#include +#ifdef __EMSCRIPTEN__ +#include +#endif + +namespace { +// std::exit() alone doesn't stop Emscripten's requestAnimationFrame loop +// (the runtime stays alive for pending async work), so draw() keeps getting +// called forever after "finishing" unless we guard against it below, and the +// process itself needs emscripten_force_exit() to actually stop. +void terminateProcess(int code) { +#ifdef __EMSCRIPTEN__ + emscripten_force_exit(code); +#else + std::exit(code); +#endif +} +} + +void ofApp::setup() { + ofSetLogLevel(OF_LOG_NOTICE); + ofSetFrameRate(60); + ofBackground(0); + ofLogNotice("glRenderSmokeTest") << "renderer=" << glGetString(GL_RENDERER) + << " version=" << glGetString(GL_VERSION); + core.allocate(); +} + +void ofApp::draw() { + if (core.finished()) { + return; + } + + core.drawFrame(); + + if (core.finished()) { + ofLogNotice("glRenderSmokeTest") << core.resultLine(); + terminateProcess(core.passed() ? 0 : 1); + } +} diff --git a/tests/gl/glRenderSmokeTest/src/ofApp.h b/tests/gl/glRenderSmokeTest/src/ofApp.h new file mode 100644 index 00000000000..ab09390ce4b --- /dev/null +++ b/tests/gl/glRenderSmokeTest/src/ofApp.h @@ -0,0 +1,13 @@ +#pragma once + +#include "ofMain.h" +#include "GLSmokeTestCore.h" + +class ofApp : public ofBaseApp { +public: + void setup() override; + void draw() override; + +private: + GLSmokeTestCore core; +}; diff --git a/tests/ios/glRenderSmokeTest/addons.make b/tests/ios/glRenderSmokeTest/addons.make new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/ios/glRenderSmokeTest/bin/data/.gitkeep b/tests/ios/glRenderSmokeTest/bin/data/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/Contents.json b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..f01c3b410b6 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,14 @@ +{ + "images" : [ + { + "filename" : "of_ios.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/of_ios.png b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/of_ios.png new file mode 100644 index 00000000000..47dc7fcc845 Binary files /dev/null and b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/AppIcon.appiconset/of_ios.png differ diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Contents.json b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Contents.json new file mode 100644 index 00000000000..73c00596a7f --- /dev/null +++ b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/Contents.json b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/Contents.json new file mode 100644 index 00000000000..6b61fc25943 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "of.svg", + "idiom" : "universal" + } + ] +} diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/of.svg b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/of.svg new file mode 100644 index 00000000000..44fe31c4634 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/mediaAssets/Images.xcassets/Logo.symbolset/of.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/ios/glRenderSmokeTest/mediaAssets/LaunchScreen.storyboard b/tests/ios/glRenderSmokeTest/mediaAssets/LaunchScreen.storyboard new file mode 100644 index 00000000000..e46c7b16d1c --- /dev/null +++ b/tests/ios/glRenderSmokeTest/mediaAssets/LaunchScreen.storyboard @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ios/glRenderSmokeTest/src/GLSmokeTestCore.h b/tests/ios/glRenderSmokeTest/src/GLSmokeTestCore.h new file mode 120000 index 00000000000..8348b55e4e7 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/src/GLSmokeTestCore.h @@ -0,0 +1 @@ +../../../gl/glRenderSmokeTest/src/GLSmokeTestCore.h \ No newline at end of file diff --git a/tests/ios/glRenderSmokeTest/src/main.mm b/tests/ios/glRenderSmokeTest/src/main.mm new file mode 100644 index 00000000000..f8a3ad8e008 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/src/main.mm @@ -0,0 +1,19 @@ +#include "ofApp.h" + +int main() { + + // here are the most commonly used iOS window settings. + //------------------------------------------------------ + ofiOSWindowSettings settings; + settings.enableRetina = true; // enables retina resolution if the device supports it. + settings.enableDepth = false; // enables depth buffer for 3d drawing. + settings.enableAntiAliasing = true; // enables anti-aliasing which smooths out graphics on the screen. + settings.numOfAntiAliasingSamples = 4; // number of samples used for anti-aliasing. + settings.enableHardwareOrientation = false; // enables native view orientation. + settings.enableHardwareOrientationAnimation = false; // enables native orientation changes to be animated. + settings.glesVersion = OFXIOS_RENDERER_ES3; // type of renderer to use, ES1, ES2, ES3. + + ofCreateWindow(settings); + + return ofRunApp(new ofApp); +} diff --git a/tests/ios/glRenderSmokeTest/src/ofApp.h b/tests/ios/glRenderSmokeTest/src/ofApp.h new file mode 100644 index 00000000000..324996637e5 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/src/ofApp.h @@ -0,0 +1,27 @@ +#pragma once + +#include "ofxiOS.h" +#include "GLSmokeTestCore.h" + +class ofApp : public ofxiOSApp { +public: + void setup(); + void update(); + void draw(); + void exit(); + + void touchDown(ofTouchEventArgs & touch); + void touchMoved(ofTouchEventArgs & touch); + void touchUp(ofTouchEventArgs & touch); + void touchDoubleTap(ofTouchEventArgs & touch); + void touchCancelled(ofTouchEventArgs & touch); + + void lostFocus(); + void gotFocus(); + void gotMemoryWarning(); + void deviceOrientationChanged(int newOrientation); + +private: + GLSmokeTestCore core; + bool resultLogged = false; +}; diff --git a/tests/ios/glRenderSmokeTest/src/ofApp.mm b/tests/ios/glRenderSmokeTest/src/ofApp.mm new file mode 100644 index 00000000000..1d75df32dd5 --- /dev/null +++ b/tests/ios/glRenderSmokeTest/src/ofApp.mm @@ -0,0 +1,82 @@ +#include "ofApp.h" + +//-------------------------------------------------------------- +void ofApp::setup(){ + ofSetLogLevel(OF_LOG_NOTICE); + ofSetVerticalSync(false); + ofBackground(0); + ofLogNotice("glRenderSmokeTest") << "renderer=" << glGetString(GL_RENDERER) + << " version=" << glGetString(GL_VERSION); + core.allocate(); +} + +//-------------------------------------------------------------- +void ofApp::update(){ + +} + +//-------------------------------------------------------------- +void ofApp::draw(){ + if(core.finished()) { + if(!resultLogged) { + resultLogged = true; + // simctl/logcat-style scraping: the runner script greps device log + // output for this exact marker rather than relying on process exit + // codes, since a foreground iOS app can't cleanly exit(0)/exit(1). + ofLogNotice("glRenderSmokeTest") << core.resultLine(); + } + return; + } + + core.drawFrame(); +} + +//-------------------------------------------------------------- +void ofApp::exit(){ + +} + +//-------------------------------------------------------------- +void ofApp::touchDown(ofTouchEventArgs & touch){ + +} + +//-------------------------------------------------------------- +void ofApp::touchMoved(ofTouchEventArgs & touch){ + +} + +//-------------------------------------------------------------- +void ofApp::touchUp(ofTouchEventArgs & touch){ + +} + +//-------------------------------------------------------------- +void ofApp::touchDoubleTap(ofTouchEventArgs & touch){ + +} + +//-------------------------------------------------------------- +void ofApp::touchCancelled(ofTouchEventArgs & touch){ + +} + +//-------------------------------------------------------------- +void ofApp::lostFocus(){ + +} + +//-------------------------------------------------------------- +void ofApp::gotFocus(){ + +} + +//-------------------------------------------------------------- +void ofApp::gotMemoryWarning(){ + +} + +//-------------------------------------------------------------- +void ofApp::deviceOrientationChanged(int newOrientation){ + +}