Automated testing for OpenGL application - user-interface

I have a Java Application that uses JOGL to provide a large part of the GUI.
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)
Just to update: The tool can run on either linux or windows.

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.
The things which worked for me are:
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.
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.
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).
Allow a bit of fuzziness in any image regression testing; most OpenGL implementations produce slightly different output.
(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).

You can test your JOGL based application using Sikuli which performs UI automation via image recognition techonolgy on screen-shots.
I am currently using Sikuli to functional-test a Java app that is predominantly based on the NASA Worldwind Java SDK (which is based on JOGL). Using the Sikuli Java API my test suite can recognise icons within the OpenGL canvas, click on them and also drag them around. Sikuli can also recognise and extract text from the canvas via OCR, however the performance of this seems to be a little hit-and-miss (depending on language, font, size and background colours behind the text).
I have done a lot of automated UI-Testing using other tools that work by introspecting the windowing toolkit (e.g. Swing, SWT, native Windows) and found that Sikuli runs much slower than those, however that is understandable given the amount of image-processing it needs to do behind the scenes. Also note that Sikuli currently requires your application to run in a Window (not in full screen mode).
Sikuli runs on both Windows and Linux. I'd recommend you try it out. I couldn't find any other tool capable of doing that level of functional-testing of an OpenGL based application.

I've been thinking of using a picture-diff tool such as PDiff to test OpenGL code, by taking snapshots, saving them to disk and comparing with previous regression output. That way, really bad stuff (missing textures) pop up but humanly unnoticable things (such as the above mentioned small diffs between implementation) go through fine.
Also, for automating user interaction, either the GUI classes should be sufficiently open for you to send events or call 'clicked' on a button, or you have to inject OS events manually to your apps. This is possible, but much more troublesome. Might be easier to open up the GUI layer, if it's Open Source.

Related

How to make a GUI in Julia?

I'm new at programming in Julia and I need to create a GUI.
I've been looking for information and I can't find anything useful. I tried to search information in the Julia official web page, but it seems to be down. I wonder if any of you guys knows where I can find information about it.
This is quite a generic question, but I'll try and layout the environment so that you can make an informed decision based on your needs. You might want to check out this article on 6 Julia Frameworks to Create Desktop GUI’s 🖥 and Web Apps.
If you are developing your code within an [Jupyter/IJulia] notebook, and need very simple interaction, such as a slider to change some input values, the Interact package is the easiest thing to get started with.
To develop full-fledged web UIs, take a look at Escher. Inspired by the Elm, it provides a functional library of UI components. Interactive web UIs are created in 100% Julia. There is no differentiation in code between the client and server sides. The framework handles all of that.
Another web framework worth looking at is Genie, which is based on the traditional MVC design pattern. It also includes an ORM.
Stipple is a reactive UI library for building interactive data applications in pure Julia. It uses Genie.jl (on the server-side) and Vue.js (on the client).
Dash ties modern UI elements like dropdowns, sliders, and graphs directly to your analytical Julia code.
All the above solutions are for creating web user interfaces, accessed via a browser. If you want to create cross-platform desktop apps, but want to work with web technologies (i.e. HTML/CSS/Javascript), use Blink. This is a Julia wrapper around the Electron. You could potentially write a Dash or Stipple application, and wrap it in Blink.jl to create a desktop app.
To create desktop UI applications using the Gtk library, use the Gtk.jl package in Julia. If you are familiar with the Gtk API, it is easy to get started. Note however that there are some significant known issues running GTK.jl on Windows.
If your UI framework of choice is QT, a Julia binding is available via QML.jl
If you are happy painting the buffer yourself and just want a window to render the pixels on the screen, then there is nothing simpler than MiniFB. Note however that this does not give you a widget library -- you are responsible for drawing each and every pixel yourself.
ClmGui.jl is a Julia wrapper around the immediate mode GUI toolkit known as Dear ImGui
And last, but not the least, the venerable Tk framework has a wrapper in Julia. The UI's created using TK are sometimes considered ugly compared with modern aesthetics, but sometimes this is the quickest way to get a window up.
[Edited Jan 2022]
QML.jl
https://github.com/barche/QML.jl
The QML.jl package enables using the QML markup language from the Qt library to build graphical user interfaces for Julia programs. The package follows the recommended Qt practices and promotes separation between the GUI code and application logic. All user-facing code is pure Julia and QML, no C++ knowledge is required to use the package.
There is a new package called Genie. It is a web framework comparable with Django in python. You can create web ui using Genie. Until now (Aug. 2017), the package is functional with some nice demos, the documentation is not quite complete though.

Browser GUI for local desktop application?

So far I have only been developing desktop applications using C++ or C#.
Now I am considering building a local standalone application using a browser GUI. The application would be similar to something I could e.g. build with C#. It should have local database access and offer some limited image editing (line drawing, polygon filling) and user defined, clickable graphical elements (basically polygons the user draws).
The application should not be web or server based. The application will also not be very complex.
The main thought behind this is to have the GUI be OS independent and as platform independent as possible.
Is that feasible? Or should I go about something as Swing, SWT or Java FX (which I have just read about)?
What programming language should I use for the application (Java, Python, ...)?
Are there toolkits for a programming language you recommend that offer an abstraction layer from OS specific stuff like file system handling?
Are there toolkits or tools that would help me in creating the browser GUI?
Well you can use c++ for this :) and for your GUI use OpenGL, and then you can use glut... You can take a look at OpenGL superbible book, it mostly about 3D drawing, but there is also something about gui... and it comes with examples for linux, windows, mac... basicly it is OS independent...

Does every window running use System.Windows.Forms.Form?

Does every window running use System.Windows.Forms.Form?
The title says it. From Java to C++ to Visual Basic to Console Apps. Does every compiled window use the class System.Drawing.Forms.Form?
No.
In .NET, System.Windows.Forms is (essentially) just a tool to draw windows, but it is not the only tool. Other languages have their own tools; Java has the Swing libraries, Python and Perl have several other GUI toolkits, each which do things differently. Console Apps use an entirely different way of presenting information. How things are drawn not only depends on the language, but also the GUI API used. For example, a window might be entirely drawn using C++ and DirectX and custom drawing routines; these would not use .NET at all, nor any underlying tools that .NET uses. That same window might be drawn with C++ and Open GL; the same data might be displayed, but the routines invoked to draw it would be different. In fact, you could do all the drawing with assembly if you were really masochistic!
Short answer No.
System.Windows.Forms.Form is an abstraction used by the WinForms .Net library to interact with the actual Windows provided by the OS.
Other languages have other abstractions: Java could use Swing or AWT or any other UI library which offer different ways to draw forms.
Likewise C++ could employ an abstraction over the OS provided objects (i.e. the MFC library) or use the Windows API directly.
All the UI libraries need in the end to use the Windows API to draw their windows, but not all of them do it to the same extent, so .Net's UI libraries will use some of the same API calls as Java's or C++'s UI libraries.
I'll update this answer if I find a good explanation of how the UI and UI libraries work on windows.
I remember reading a good one not long ago with some of the history and the changes in Windows 8 but don't remember where.

is pure c/c++ code possible in webOs intead of javascript?

HP webOS needs javascript,HTML to develop applications.but is it possible whatever we can do through javascript in c++ or c? have they given any API list for it?I found PDK is for openGL game porting .Have they given any option for C++ developers?
If using C/C++, you are essentially on-your-own when it comes to the interface unless you build a plugin in for a hybrid PDK app that uses HTML and JavaScript for the UI. You are provided with APIs for system services and accessing the hardware (drawing to the screen, keyboard presses, etc.) in C++. The intention is that you'll use C/C++ when you need speed, and JavaScript the rest of the time when speed is less critical (as in, you're not doing anything that the user will notice as slower than if you had written the code in C/C++).
To answer the question I sense lies beneath your question, you're probably going to have to learn JavaScript to program for webOS unless you want to develop openGL games only.

Compiling WebGL Into a C Library

We currently have a shared DirectX code base that renders our UI and is used in our PC side application and via an ActiveX in web pages.
I have written some WebGL demos and they perform great, no plugin mess and get rid of ancient ActiveX!
This obviously raises the problem of having a split code base for the PC application and the Web UI.
As WebGL is based on the OpenGL ES 2.0 specification would it be possible to have a standard code base and write a interpreter so that either:
-The WebGL code can be modified to compile as OpenGL
-OpenGL can be modified to work in a web page
The khronos specifications are new to me, so this is sort of speculative as I am peforming research at the moment.
Does anyone with more knowledge of 3D graphics and a better understanding of the coding syntax help me out?
One way is to have a PC app to enclose a WebGL-capable browser inside (together with a simple http server) to run the same rendering technique as the web App.
This will reduce the maintenance and development costs for both platforms.

Resources