Skip to content

Commit

Permalink
Automatically init App::impl for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Oct 6, 2023
1 parent ed0405c commit 2bd09d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ App& App::instance() {
}

void App::init(AppParameters params) {
assert(impl == nullptr);
impl = std::make_unique<App::Impl>(
App::Impl{ std::move(params.displayName), params.pixelArt, params.steamAppId });
}
Expand Down Expand Up @@ -83,6 +84,9 @@ void App::setPixelArt(const bool pixelArt) {
}

void App::registerShaderProgram(ShaderProgram* shaderProgram) {
if (!impl) { // unit tests
init({});
}
impl->shaderPrograms.insert(shaderProgram);
}

Expand Down

0 comments on commit 2bd09d6

Please sign in to comment.