mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-07 21:25:33 +00:00

Some checks failed
autofix.ci / format_fix (push) Has been cancelled
autofix.ci / lint_typecheck (push) Has been cancelled
CI / files-changed (push) Has been cancelled
CI / ffi_32bit_build (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, macos-14, stable) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, 1.85) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, beta) (push) Has been cancelled
CI / build_and_test (--exclude ffmpeg --exclude gstreamer-player, windows-2022, stable) (push) Has been cancelled
CI / build_and_test (ubuntu-22.04, 1.85) (push) Has been cancelled
CI / build_and_test (ubuntu-22.04, nightly) (push) Has been cancelled
CI / node_test (macos-14) (push) Has been cancelled
CI / node_test (ubuntu-22.04) (push) Has been cancelled
CI / node_test (windows-2022) (push) Has been cancelled
CI / python_test (macos-14) (push) Has been cancelled
CI / python_test (ubuntu-22.04) (push) Has been cancelled
CI / python_test (windows-2022) (push) Has been cancelled
CI / cpp_test_driver (macos-13) (push) Has been cancelled
CI / cpp_test_driver (ubuntu-22.04) (push) Has been cancelled
CI / cpp_test_driver (windows-2022) (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / cpp_cmake (macos-14, 1.85) (push) Has been cancelled
CI / cpp_cmake (ubuntu-22.04, stable) (push) Has been cancelled
CI / cpp_cmake (windows-2022, nightly) (push) Has been cancelled
CI / cpp_package_test (push) Has been cancelled
CI / wasm (push) Has been cancelled
CI / wasm_demo (push) Has been cancelled
CI / vsce_build_test (push) Has been cancelled
CI / mcu (pico-st7789, thumbv6m-none-eabi) (push) Has been cancelled
CI / mcu (pico2-st7789, thumbv8m.main-none-eabihf) (push) Has been cancelled
CI / mcu (stm32h735g, thumbv7em-none-eabihf) (push) Has been cancelled
CI / mcu-embassy (push) Has been cancelled
CI / tree-sitter (push) Has been cancelled
CI / updater_test (0.3.0) (push) Has been cancelled
CI / fmt_test (push) Has been cancelled
CI / esp-idf-quick (push) Has been cancelled
CI / android (push) Has been cancelled
CI / miri (push) Has been cancelled
CI / test-figma-inspector (push) Has been cancelled
CMake 4.0 remove some deprecated code < 3.5 Catch2 old version still depend against cmake 3.0 + deprecated method. Necessary to increase version otherwise when we try to compile example with cmake 4.0 it will failed to configure it
42 lines
1.4 KiB
C++
42 lines
1.4 KiB
C++
// Copyright © SixtyFPS GmbH <info@slint.dev>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
#include <slint-testing.h>
|
|
#include "../app.h"
|
|
|
|
#define CATCH_CONFIG_MAIN
|
|
#include "catch2/catch_all.hpp"
|
|
|
|
SCENARIO("Basic TEST")
|
|
{
|
|
slint::testing::init();
|
|
auto state = create_ui();
|
|
using todo_ui::TodoItem;
|
|
state.todo_model->set_vector({ TodoItem { "first", true } });
|
|
|
|
auto line_edit = slint::testing::ElementHandle::visit_elements(
|
|
state.mainWindow,
|
|
[](slint::testing::ElementHandle element)
|
|
-> std::optional<slint::testing::ElementHandle> {
|
|
if (element.accessible_placeholder_text() == "What needs to be done?") {
|
|
return element;
|
|
} else {
|
|
return {};
|
|
}
|
|
});
|
|
|
|
REQUIRE(line_edit);
|
|
line_edit->set_accessible_value("second");
|
|
|
|
auto results = slint::testing::ElementHandle::find_by_accessible_label(state.mainWindow,
|
|
"Add New Entry");
|
|
REQUIRE(results.size() == 1);
|
|
auto button = results[0];
|
|
button.invoke_accessible_default_action();
|
|
|
|
REQUIRE(state.todo_model->row_count() == 2);
|
|
REQUIRE(state.todo_model->row_data(0).value() == TodoItem { "first", true });
|
|
REQUIRE(state.todo_model->row_data(1).value() == TodoItem { "second", false });
|
|
|
|
REQUIRE(line_edit->accessible_value() == "");
|
|
}
|