Skip to content

API Support Tests

Report on SplashKit API functionality in SplashKit Online

Overview

While much of the SplashKit API already works in browsers thanks to Emscripten, there are still areas of functionality that do not. This report will outline what is working, what isn’t, and the general reason why.

SplashKit Tests

It was decided that the most efficient way to test SplashKit’s functionality was to use the existing suite of tests that exist inside splashkit-core. To test the JavaScript language backend, these tests had to be converted. To assist with this, a small C++ to JavaScript conversion utility was written; the result of this was then patched up manually. For C++, a few of the tests had to be slightly modified, but all in all are practically identical to their original source.

The project file containing these tests will be added to the SplashKit Online DemoProjects folder for reproducibility. Here are the results grouped by API category.

FieldJavaScriptC++Details
AnimationsFull SupportFull Support
AudioNear Full SupportNear Full SupportNo FLAC support or MOD support.
CameraFull SupportFull Support
ColorFull SupportFull Support
GeometryFull SupportFull Support
GraphicsFull SupportNear Full SupportC++ backend doesn’t support reading pixels currently (so no take_screenshot, etc).
InputNear Full SupportNear Full SupportIME doesn’t show up when using Start Reading Text.
JsonFull SupportFull Support
LoggingFull SupportFull Support
NetworkingNo SupportNo SupportAll networking functionality is replaced with stubs currently, due to no cURL support.
PhysicsFull SupportFull Support
RaspberryNo SupportNo SupportDisabled during build.
Resource BundlesFull SupportFull Support
ResourcesFull SupportFull Support
SpritesFull SupportFull Support
TerminalPartial SupportLimited SupportJavaScript: it all works, but no terminal input bar. ‘Input’ popup appears, that has confusing behaviour of only sending data once cancelled. This may be fixed very shortly however.
C++: all the read functions return immediately with no input.
TimersFull SupportFull Support
UtilitiesNear Full SupportFull SupportDisplay Dialog does not work in JavaScript backend, as it enters a busy loop that freezes the page.
WindowsPartial SupportPartial SupportNo support for multiple windows, or for moving the window. No way to close the current window.

And here are the results specific to each test - some tests test multiple things unfortunately, so some of these results aren’t very helpful.

TestJavaScriptC++Details
AnimationsWorks fullyWorks fully
AudioPartially worksPartially worksCannot download test audio.
BundlesWorks fullyworks mostly
CameraWorks fullyWorks fully
GeometryWorks fullyWorks fully (Note)Cannot close the first screen - replaced with delay
GraphicsFailsFails
InputPartially worksPartially worksOnly support for one window currently
LoggingWorks fullyWorks fully
PhysicsWorks fullyFailsDue to use of read pixel
ResourcesWorks fullyWorks fully
Shape drawingWorks fullyMostly worksHave to disable take_screenshot usage for C++ backend
Sprite testsWorks fullyWorks fully
TerminalPossible failurePossible failureSlightly unsure what the behaviour should be
TextMostly WorksMostly WorksJust fails to download font
TimersworksWorks fully
WindowsFailsFailsJavaScript backend freezes (due to Display Dialog). C++ fails after clicking okay, with Cannot read properties of null (reading 'createTexture') in console - works if display_dialog(...) line is removed.
Cave EscapeWorks fullyWorks fully
Web ServerFailsFails
RESTful Web ServiceFailsFails
UDP Networking TestFailsFails
TCP Networking TestFailsFails
JSON Unit TestWorks fullyWorks fully