Refactor the testing backend

Move code around and gate the internal functions used in our own tests
so we can make the testing backend public
This commit is contained in:
Olivier Goffart 2024-04-18 11:29:51 +02:00
parent 583eadbdbc
commit 8030732f46
12 changed files with 335 additions and 324 deletions

View file

@ -26,7 +26,8 @@ name = "slint_cpp"
# the C++ crate's CMakeLists.txt
[features]
interpreter = ["slint-interpreter", "std"]
testing = ["i-slint-backend-testing"] # Enable some function used by the integration tests
# Enable some function used by the integration tests
internal-testing = ["i-slint-backend-testing"]
backend-qt = ["i-slint-backend-selector/backend-qt", "std"]
backend-winit = ["i-slint-backend-selector/backend-winit", "std"]
@ -50,7 +51,7 @@ default = ["std", "backend-winit", "renderer-femtovg", "backend-qt"]
[dependencies]
i-slint-backend-selector = { workspace = true, optional = true }
i-slint-backend-testing = { workspace = true, features = ["default"], optional = true }
i-slint-backend-testing = { workspace = true, optional = true }
i-slint-renderer-skia = { workspace = true, features = ["default", "x11", "wayland"], optional = true }
i-slint-core = { workspace = true, features = ["ffi"] }
slint-interpreter = { workspace = true, features = ["ffi", "compat-1-2"], optional = true }

View file

@ -138,7 +138,7 @@ pub unsafe extern "C" fn slint_register_bitmap_font(
window_adapter.renderer().register_bitmap_font(font_data);
}
#[cfg(feature = "testing")]
#[cfg(feature = "internal-testing")]
#[no_mangle]
pub unsafe extern "C" fn slint_testing_init_backend() {
i_slint_backend_testing::init();