@@ -970,6 +970,7 @@ export component Test { in property <Foobar> test1; }"#,
970
970
971
971
#[ test]
972
972
fn test_property_brush ( ) {
973
+ use crate :: preview:: ui:: GradientStop ;
973
974
let result =
974
975
property_conversion_test ( r#"export component Test { in property <brush> test1; }"# , 0 ) ;
975
976
assert_eq ! ( result. value_kind, ui:: PropertyValueKind :: Brush ) ;
@@ -1060,6 +1061,32 @@ export component Test { in property <Foobar> test1; }"#,
1060
1061
assert_eq ! ( result. value_kind, ui:: PropertyValueKind :: Brush ) ;
1061
1062
assert_eq ! ( result. kind, ui:: PropertyValueKind :: Code ) ;
1062
1063
assert ! ( matches!( result. brush_kind, ui:: BrushKind :: Radial ) ) ;
1064
+
1065
+ let result = property_conversion_test (
1066
+ r#"export component Test { in property <brush> test1: @conic-gradient(white 36deg, #239 126deg, red 306deg); }"# ,
1067
+ 1 ,
1068
+ ) ;
1069
+ assert_eq ! ( result. value_kind, ui:: PropertyValueKind :: Brush ) ;
1070
+ assert_eq ! ( result. kind, ui:: PropertyValueKind :: Brush ) ;
1071
+ assert_eq ! ( result. brush_kind, ui:: BrushKind :: Conic ) ;
1072
+ assert_eq ! (
1073
+ result. gradient_stops. iter( ) . collect:: <Vec <_>>( ) ,
1074
+ [
1075
+ GradientStop {
1076
+ color: slint:: Color :: from_rgb_u8( 0xff , 0xff , 0xff , ) ,
1077
+ position: 36.0 / 360.0
1078
+ } ,
1079
+ GradientStop {
1080
+ color: slint:: Color :: from_rgb_u8( 0x22 , 0x33 , 0x99 ) ,
1081
+ position: 126.0 / 360.0
1082
+ } ,
1083
+ GradientStop {
1084
+ color: slint:: Color :: from_rgb_u8( 0xff , 0x00 , 0x00 ) ,
1085
+ position: 306.0 / 360.0
1086
+ } ,
1087
+ ]
1088
+ ) ;
1089
+ assert_eq ! ( result. code, "@conic-gradient(white 36deg, #239 126deg, red 306deg)" ) ;
1063
1090
}
1064
1091
1065
1092
#[ test]
0 commit comments