mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Add support for sixtyfps::Image::size() in C++
Also added a unit test for the C++ implementation.
This commit is contained in:
parent
0fdb87cc69
commit
85474f7670
6 changed files with 66 additions and 9 deletions
|
@ -13,6 +13,7 @@ LICENSE END */
|
|||
#include "catch2/catch.hpp"
|
||||
|
||||
#include <sixtyfps.h>
|
||||
#include <sixtyfps_image.h>
|
||||
|
||||
SCENARIO("SharedString API")
|
||||
{
|
||||
|
@ -72,3 +73,24 @@ TEST_CASE("Property Tracker")
|
|||
REQUIRE(!tracker1.is_dirty());
|
||||
}
|
||||
|
||||
TEST_CASE("Image")
|
||||
{
|
||||
using namespace sixtyfps;
|
||||
|
||||
// ensure a backend exists, using private api
|
||||
private_api::ComponentWindow wnd;
|
||||
|
||||
Image img;
|
||||
{
|
||||
auto size = img.size();
|
||||
REQUIRE(size.width == 0.);
|
||||
REQUIRE(size.height == 0.);
|
||||
}
|
||||
|
||||
img = Image::load_from_path(SOURCE_DIR "/../../vscode_extension/extension-logo.png");
|
||||
{
|
||||
auto size = img.size();
|
||||
REQUIRE(size.width == 128.);
|
||||
REQUIRE(size.height == 128.);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue