mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
C++: Move the internal test helper in the private_api namespace
in a different file
This commit is contained in:
parent
7059d48f6f
commit
13fe59cc2e
3 changed files with 9 additions and 9 deletions
|
@ -61,8 +61,8 @@ exhale_args = {
|
|||
"kindsWithContentsDirectives": [],
|
||||
"exhaleExecutesDoxygen": True,
|
||||
"exhaleDoxygenStdin": """INPUT = ../../api/cpp/include generated_include
|
||||
EXCLUDE_SYMBOLS = slint::cbindgen_private* slint::private_api* vtable* slint::testing* SLINT_DECL_ITEM
|
||||
EXCLUDE = ../../api/cpp/include/vtable.h ../../api/cpp/include/slint_testing.h
|
||||
EXCLUDE_SYMBOLS = slint::cbindgen_private* slint::private_api* vtable* SLINT_DECL_ITEM
|
||||
EXCLUDE = ../../api/cpp/include/vtable.h ../../api/cpp/include/slint_tests_helper.h
|
||||
ENABLE_PREPROCESSING = YES
|
||||
PREDEFINED += DOXYGEN
|
||||
INCLUDE_PATH = generated_include
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include <concepts>
|
||||
#include <iostream>
|
||||
|
||||
namespace slint::testing {
|
||||
// this file contains function useful for internal testing
|
||||
|
||||
namespace slint::private_api::testing {
|
||||
|
||||
inline void init()
|
||||
{
|
||||
|
@ -44,9 +46,8 @@ inline void send_keyboard_string_sequence(const Component *component,
|
|||
}
|
||||
|
||||
#define assert_eq(A, B) \
|
||||
slint::testing::private_api::assert_eq_impl(A, B, #A, #B, __FILE__, __LINE__)
|
||||
slint::private_api::testing::assert_eq_impl(A, B, #A, #B, __FILE__, __LINE__)
|
||||
|
||||
namespace private_api {
|
||||
template<typename A, std::equality_comparable_with<A> B>
|
||||
void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str, const char *file,
|
||||
int line)
|
||||
|
@ -66,6 +67,5 @@ void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str
|
|||
std::abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace slint
|
|
@ -51,11 +51,11 @@ pub fn test(testcase: &test_driver_lib::TestCase) -> Result<(), Box<dyn Error>>
|
|||
#include <assert.h>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <slint_testing.h>
|
||||
namespace slint_testing = slint::testing;
|
||||
#include <slint_tests_helpers.h>
|
||||
namespace slint_testing = slint::private_api::testing;
|
||||
",
|
||||
)?;
|
||||
generated_cpp.write_all(b"int main() {\n slint::testing::init();\n")?;
|
||||
generated_cpp.write_all(b"int main() {\n slint::private_api::testing::init();\n")?;
|
||||
for x in test_driver_lib::extract_test_functions(&source).filter(|x| x.language_id == "cpp") {
|
||||
write!(generated_cpp, " {{\n {}\n }}\n", x.source.replace("\n", "\n "))?;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue