mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 15:14:35 +00:00
[reorg]: Move api/sixtyfps-rs/sixtyfps-* into api/rs
This commit is contained in:
parent
2813441cd9
commit
842f75e653
95 changed files with 65 additions and 72 deletions
52
api/cpp/include/sixtyfps_testing.h
Normal file
52
api/cpp/include/sixtyfps_testing.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright © SixtyFPS GmbH <info@sixtyfps.io>
|
||||
// SPDX-License-Identifier: (GPL-3.0-only OR LicenseRef-SixtyFPS-commercial)
|
||||
|
||||
#pragma once
|
||||
#include "sixtyfps.h"
|
||||
#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);
|
||||
}
|
||||
template<typename Component>
|
||||
inline void send_mouse_click(const Component *component, float x, float y)
|
||||
{
|
||||
auto crc = *component->self_weak.into_dyn().lock();
|
||||
cbindgen_private::sixtyfps_send_mouse_click(&crc, x, y, &component->m_window.window_handle());
|
||||
}
|
||||
|
||||
template<typename Component>
|
||||
inline void send_keyboard_string_sequence(const Component *component,
|
||||
const sixtyfps::SharedString &str,
|
||||
cbindgen_private::KeyboardModifiers modifiers = {})
|
||||
{
|
||||
cbindgen_private::send_keyboard_string_sequence(&str, modifiers,
|
||||
&component->m_window.window_handle());
|
||||
}
|
||||
|
||||
#define assert_eq(A, B) \
|
||||
sixtyfps::testing::private_api::assert_eq_impl(A, B, #A, #B, __FILE__, __LINE__)
|
||||
|
||||
namespace private_api {
|
||||
template<typename A, typename B>
|
||||
void assert_eq_impl(const A &a, const B &b, const char *a_str, const char *b_str, const char *file,
|
||||
int line)
|
||||
{
|
||||
if (a != b) {
|
||||
std::cerr << file << ":" << line << ": assert_eq FAILED!\n"
|
||||
<< a_str << ": " << a << "\n"
|
||||
<< b_str << ": " << b << std::endl;
|
||||
std::abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace sixtyfps
|
Loading…
Add table
Add a link
Reference in a new issue