diff options
| author | Xu Cheng | 2015-02-18 15:53:43 +0800 |
|---|---|---|
| committer | Mike McQuaid | 2015-02-18 13:57:28 +0000 |
| commit | 40306b41e65ce0c40490050c303620c4bd5394f7 (patch) | |
| tree | c1d8a5f1adcee18136786f1c8c2ee3fdb0ac53b2 /Library/Formula | |
| parent | 7cf28d030e3322f41aba2d84a9fe275b7a6a01ce (diff) | |
| download | homebrew-40306b41e65ce0c40490050c303620c4bd5394f7.tar.bz2 | |
gl2ps: add test
Closes #36924.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/gl2ps.rb | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/Library/Formula/gl2ps.rb b/Library/Formula/gl2ps.rb index e0113962a..666cd0b2c 100644 --- a/Library/Formula/gl2ps.rb +++ b/Library/Formula/gl2ps.rb @@ -1,5 +1,3 @@ -require "formula" - class Gl2ps < Formula homepage "http://www.geuz.org/gl2ps/" url "http://geuz.org/gl2ps/src/gl2ps-1.3.8.tgz" @@ -13,4 +11,40 @@ class Gl2ps < Formula system "cmake", ".", *std_cmake_args system "make", "install" end + + test do + (testpath/"test.c").write <<-EOS.undent + #include <GLUT/glut.h> + #include <gl2ps.h> + + int main(int argc, char *argv[]) + { + glutInit(&argc, argv); + glutInitDisplayMode(GLUT_DEPTH); + glutInitWindowSize(400, 400); + glutInitWindowPosition(100, 100); + glutCreateWindow(argv[0]); + GLint viewport[4]; + glGetIntegerv(GL_VIEWPORT, viewport); + FILE *fp = fopen("test.eps", "wb"); + GLint buffsize = 0, state = GL2PS_OVERFLOW; + while( state == GL2PS_OVERFLOW ){ + buffsize += 1024*1024; + gl2psBeginPage ( "Test", "Homebrew", viewport, + GL2PS_EPS, GL2PS_BSP_SORT, GL2PS_SILENT | + GL2PS_SIMPLE_LINE_OFFSET | GL2PS_NO_BLENDING | + GL2PS_OCCLUSION_CULL | GL2PS_BEST_ROOT, + GL_RGBA, 0, NULL, 0, 0, 0, buffsize, + fp, "test.eps" ); + gl2psText("Homebrew Test", "Courier", 12); + state = gl2psEndPage(); + } + fclose(fp); + return 0; + } + EOS + system ENV.cc, "-lgl2ps", "-framework", "OpenGL", "-framework", "GLUT", "-framework", "Cocoa", "test.c", "-o", "test" + system "./test" + assert File.exist?("test.eps") && File.size("test.eps") > 0 + end end |
