tests: Use joinRenderingAllThreads() and waitForTiles() instead of sleeping for an arbitrary amount of time to wait for the rendering to complete.