aboutsummaryrefslogtreecommitdiffstats
path: root/test/pugl_test.c
AgeCommit message (Collapse)AuthorFilesLines
2020-03-08Move demo programs to examples directoryDavid Robillard1-394/+0
These are not really tests, but examples or demos, which has caused some confusion in the past. So, move them, and make room for actual tests.
2020-03-08Split graphical utilities out from test_utils.hDavid Robillard1-0/+1
2020-03-07Test: Don't reuse cube vertices for backgroundDavid Robillard1-3/+10
This was pretty confusing since it looked like the parent view was drawing the cube as well, and inefficient since only a single rect needs to be drawn here.
2020-03-07Test: Fix cube rotation via mouseDavid Robillard1-2/+2
2020-03-02Strengthen ultra-strict warnings with clangDavid Robillard1-8/+8
2019-11-21Rename "backend" headersDavid Robillard1-1/+1
Working on Vulkan clarified what has always been slightly smelly about the design and organization here: not everything that is API specific is really in a "backend" (a PuglBackend). The concrete example is puglGetProcAddress(), which only makes sense for GL and is actually implemented in the "backend" files. Arguably puglGetContext() is also such a thing. So, rename the headers so they can be the place where API-specific things go in general, which happens to include a backend most of the time. The stub is a bit of an exception to this, but whatever. The includes look tidier this way. In place of the old headers are compatibility stubs that just emit a warning and include the new version, which will be maintained for a while.
2019-11-18Add test utility function for logging errorsDavid Robillard1-6/+4
2019-11-18Add error checking option to test programsDavid Robillard1-0/+2
2019-11-09Fix various clang-tidy warningsDavid Robillard1-1/+3
2019-11-09Add puglStrerror() and improve test program error reportingDavid Robillard1-5/+7
2019-11-03Add verbose option to test programs to print all eventsDavid Robillard1-3/+5
2019-09-07Add clipboard supportDavid Robillard1-3/+11
2019-09-03Make event handler return a statusDavid Robillard1-2/+6
Currently unused, but this is to leave open the possibility of event propagation or better errror handling.
2019-09-03Factor out parsing test optionsDavid Robillard1-35/+14
2019-09-03Rename remaining init functionsDavid Robillard1-12/+12
This finishes the removal of the init/set split. While these ones are superficial, the general idea here is to provide general functions that work before or after window creation where possible. This prevents the situation where ever more dynamic counterparts to existing init functions get added over time.
2019-09-03Add puglSetClassName()David Robillard1-2/+2
2019-09-03Replace size and aspect ratio init functions with dynamic onesDavid Robillard1-2/+2
2019-09-03Add swap interval hintDavid Robillard1-0/+2
2019-09-03Make pugl_test use a nested view and test focus and movementDavid Robillard1-32/+183
2019-09-03Add functions to get and set view size and positionDavid Robillard1-1/+3
2019-09-03Add puglDispatchEvents()David Robillard1-1/+1
2019-09-03Add puglPollEvents()David Robillard1-1/+1
This allows waiting for events for any view in the world. It also improves on puglWaitForEvent() by the addition of a time parameter that allows indefinite blocking, non-blocking polling, and blocking polling with a timeout.
2019-09-03Move puglGetTime() to PuglWorldDavid Robillard1-4/+4
2019-09-03Add PuglWorldDavid Robillard1-12/+17
The old API was broken for programs that manage multiple views, since it was impossible to wait for events on any view. There are also several functions in the API which are not actually associated with views at all, so those can now be moved to the more appropriate PuglWorld to make this more clear. The old puglInit() and puglDestroy() functions are preserved for compatibility, but marked as deprecated.
2019-08-02Clean up includesDavid Robillard1-0/+1
2019-08-02Test: Remove use of static dataDavid Robillard1-39/+48
Not very becoming of a library that exists specifically to avoid static data.
2019-08-02Replace puglIgnoreKeyRepeat() with a hintDavid Robillard1-1/+1
2019-08-02Test: Remove locale hacksDavid Robillard1-3/+0
2019-08-02Test: Configure GL in configure handler instead of mainDavid Robillard1-6/+4
2019-08-02Test: Factor out FPS printerDavid Robillard1-10/+4
2019-08-01Add missing string terminationDavid Robillard1-1/+1
2019-07-31X11: Support UTF8 in window titlesJP Cimalando1-1/+3
It's possible that this does bad things if a UTF8 string is used on a system that does not support it (because XStoreName is still called), but I have no idea how likely this scenario is. Leaving it this way because it means the ASCII case will still work everywhere, and it's easy enough to avoid if this is a problem.
2019-07-29Cleanup: Clean up includes and call IWYU in lint targetDavid Robillard1-0/+1
2019-07-29Completely separate backends from platform implementationDavid Robillard1-0/+2
This removes PuglContextType and allows the user to pass a backend directly. Normally this would come from one of the two accessors declared in the headers, but it would be possible to add backends without changing any of the existing code at all. Unfortunately, it is not possible to preserve backwards compatibility and achieve the ultimate goal of linking only to the required dependencies, so puglInitContextType() has just been removed.
2019-07-29Add deprecation macro and deprecate puglInitResizable()David Robillard1-1/+1
2019-07-28Make enterContext take a drawing parameter like leaveContextDavid Robillard1-1/+1
These need to be symmetric because sometimes different things need to happen in either situation when entering the context as well.
2019-07-26Windows: Implement size constraintsDavid Robillard1-1/+1
There are two possible approaches to take here: try to expand dimensions that are not being explicitly resized (for example expand the bottom when dragging right), or just stop single-dimension resizes if they would go out of range. I chose the latter here for two reasons: it's hard to always do something smooth and unsurprising with the first approach (and it would require more code), and it can be nice from the user's perspective to easily be able to resize the window to exactly one of its aspect ratio limits. For example, it is very easy to drag pugl_test to 1:1 or 16:9. In other words, simplicity and user power wins.
2019-07-24Unify key and character fields and separate text eventsDavid Robillard1-3/+1
Only one field is necessary to store any kind of key, including special keys, since PuglKey occupies a reserved Unicode region. This is generally much simpler to deal with since there is only one value to dispatch on. Text events are separated from key events (like Windows but unlike MacOS or X11) because it is not possible to derive text events from key press events when they occur on Windows. Since merging the two has been the source of some confusion, this approach has some advantages anyway, even though it introduces the need to handle another event type. In the process, text input has been almost completely rewritten. I have tested this with a compose key on X11 and dead keys on Windows and MacOS and everything seems to work correctly, though there may (as always) still be issues with more exotic input methods.
2019-07-23Test: Move some generic code to a separate headerDavid Robillard1-124/+2
2019-07-23Test: Move test programs to a subdirectoryDavid Robillard1-0/+349