From d35c92bdc207d9c7505bc1f28038d3bcaeb462fb Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 6 Sep 2021 18:14:26 +0200 Subject: [PATCH] Make tests/cases/text/default_color.60 not depend on the style --- tests/cases/text/default_color.60 | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/cases/text/default_color.60 b/tests/cases/text/default_color.60 index 9e61873f4..3aa9e3b1f 100644 --- a/tests/cases/text/default_color.60 +++ b/tests/cases/text/default_color.60 @@ -7,14 +7,22 @@ This file is also available under commercial licensing terms. Please contact info@sixtyfps.io for more information. LICENSE END */ + +import { StyleMetrics } from "sixtyfps_widgets.60"; + TestCase := Rectangle { + // This binding allow the test to set the style's default color so that we can compare it + property binding_to_default_text_color <=> StyleMetrics.default-text-color; + default_text := Text { } text_with_color := Text { - color: #ffffffff; + color: #ffff00ff; } property default_text_color: default_text.color; property color_of_initialized_text: text_with_color.color; + + property test: default_text_color == StyleMetrics.default-text-color && color-of-initialized-text == #ffff00ff; } @@ -23,14 +31,16 @@ TestCase := Rectangle { ```cpp auto handle = TestCase::create(); const TestCase &instance = *handle; -assert_eq(instance.get_default_text_color(), sixtyfps::Color::from_rgb_uint8(0, 0, 0)); -assert_eq(instance.get_color_of_initialized_text(), sixtyfps::Color::from_rgb_uint8(255, 255, 255)); +instance.set_binding_to_default_text_color(sixtyfps::Color::from_rgb_uint8(0, 0, 255)); +assert_eq(instance.get_default_text_color(), sixtyfps::Color::from_rgb_uint8(0, 0, 255)); +assert_eq(instance.get_color_of_initialized_text(), sixtyfps::Color::from_rgb_uint8(255, 255, 0)); ``` ```rust let instance = TestCase::new(); -assert_eq!(instance.get_default_text_color(), sixtyfps::Color::from_rgb_u8(0, 0, 0)); -assert_eq!(instance.get_color_of_initialized_text(), sixtyfps::Color::from_rgb_u8(255, 255, 255)); +instance.set_binding_to_default_text_color(sixtyfps::Color::from_rgb_u8(0, 0, 133)); +assert_eq!(instance.get_default_text_color(), sixtyfps::Color::from_rgb_u8(0, 0, 133)); +assert_eq!(instance.get_color_of_initialized_text(), sixtyfps::Color::from_rgb_u8(255, 255, 0)); ``` */