对于OpenGL应用程序的自动化测试 [英] Automated testing for OpenGL application

查看:326
本文介绍了对于OpenGL应用程序的自动化测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JOGL提供GUI的大部分Java应用程序。

I have a Java Application that uses JOGL to provide a large part of the GUI.

有没有什么工具,你知道的,或者使用其可以自动的OpenGL应用程序测试(或更多特异性地那些使用JOGL)

Is there any tool which you know of, or have used which can automate the testing of OpenGL applications (or more specificly those using JOGL)

只是为了更新:该工具可以在Linux或Windows上运行

Just to update: The tool can run on either linux or windows.

推荐答案

我已经写单元测试用于C ++(QT在Linux上)及OpenGL的了。我不知道什么原因它不应该对Java工作了。

I have written unit-tests for C++ (Qt on Linux) & OpenGL before. I don't know any reason it shouldn't work for Java too.

这为我工作的事情是:


  • 摘要您的OpenGL上下文提供商所以你的code的其余部分是独立的。在我的情况下,主应用程序使用Qt的QGLWidget来,但单元测试使用基于pbuffer的,其中一个我可以完全没有窗口的基础设施(除指定X11显示等)创建。后来,我增加了一个屏幕外梅萨(纯软件OpenGL实现),所以他们会连一具无头构建机器在没有GPU在所有的工作。

  • Abstract your OpenGL context provider so the rest of your code is independent of it. In my case the main app used Qt's QGLWidget, but the unittests used a pbuffer-based one which I could create with no windowing infrastructure at all (other than a designated X11 DISPLAY). Later I added an "offscreen Mesa" (pure software OpenGL implementation) so they'd even work on a headless build machine with no GPU at all.

请你的OpenGL code独立于GUI code的。在我的情况下OpenGL的渲染引擎不知道关于Qt类(如鼠标事件)任何东西。定义哪些是不依赖于任何特定的GUI概念,你自己可测试API,并为它编写测试。

Keep your OpenGL code independent of your GUI code. In my case the OpenGL "rendering engine" didn't know anything about Qt classes (e.g mouse events). Define your own testable API which isn't tied to any specific GUI concepts, and write tests for it.

在单元测试,读取其中的内容从帧缓冲回用glReadPixels,要么有一些断言哪个像素应该是特定的值打他们,或下井回归测试路线和与存储的比较帧缓冲捕获你知道形象好(无论是从手动验证,或者是因为它是从其他一些参考模型制作)。

In the unittests, read the contents back from the framebuffer using glReadPixels and either hit them with some assertions about which pixels should be particular values, or go down the regression-testing route and compare the framebuffer capture with a stored image you know is good (either from manual verification, or because it's produced from some other reference model).

允许位的任何影像回归测试的模糊性;大多数OpenGL的实现产生稍有不同的输出。

Allow a bit of fuzziness in any image regression testing; most OpenGL implementations produce slightly different output.

(我没有这样做,但是......)在理想情况下,你希望能够通过声明来测试GUI层,它使调用的预期序列渲染引擎响应GUI的活动。如果这样做,而你因为上面的测试有信心渲染层的...好,无需实际做渲染。因此,创建用于渲染层的一个合适的模拟对象时,GUI测试(我从这里鼠标拖拽到那里在通话的结果渲染层设置一个特定的变换矩阵想像这样的测试......这样的东西)。

(I didn't do this, but...) Ideally you want to be able to test the GUI layer by asserting that it makes the expected sequence of calls to your rendering engine in response to GUI activity. If it does that, and you're confident of your render layer because of the above tests... well, no need to actually do the rendering. So create a suitable mock object of your rendering layer for use when GUI testing (I'd imagine tests like "mouse drag from here to there results in a call to the rendering layer to set a particular transform matrix"... stuff like that).

这篇关于对于OpenGL应用程序的自动化测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆