Use the testing backend for the C++ integration tests

This commit is contained in:
Olivier Goffart 2021-05-11 09:57:04 +02:00
parent a0e910abf0
commit 988c2b0b9d
6 changed files with 18 additions and 2 deletions

View file

@ -17,8 +17,12 @@ crate-type = ["lib", "cdylib"]
# In the future, this shouldn't be a default feature, but should be enabled by cmake
default = ["sixtyfps-interpreter"]
# Enable some function used by the integration tests
testing = ["sixtyfps-rendering-backend-testing"]
[dependencies]
sixtyfps-corelib = { version = "=0.0.6", path="../../sixtyfps_runtime/corelib", features = ["ffi"] }
sixtyfps-rendering-backend-default = { version = "=0.0.6", path="../../sixtyfps_runtime/rendering_backends/default" }
sixtyfps-rendering-backend-testing = { version = "=0.0.6", path="../../sixtyfps_runtime/rendering_backends/testing", optional = true }
sixtyfps-interpreter = { version = "=0.0.6", path="../../sixtyfps_runtime/interpreter", features = ["ffi"], optional = true }

View file

@ -12,6 +12,11 @@ LICENSE END */
#include <iostream>
namespace sixtyfps::testing {
inline void init() {
cbindgen_private::sixtyfps_testing_init_backend();
}
inline void mock_elapsed_time(int64_t time_in_ms)
{
cbindgen_private::sixtyfps_mock_elapsed_time(time_in_ms);

View file

@ -56,3 +56,9 @@ pub unsafe extern "C" fn sixtyfps_register_font_from_path(
},
)
}
#[cfg(feature = "testing")]
#[no_mangle]
pub unsafe extern "C" fn sixtyfps_testing_init_backend() {
sixtyfps_rendering_backend_testing::init();
}