@@ -181,3 +181,40 @@ struct ModifierTests {
181181 #expect( flag? . args [ " value " ] == . bool( true ) )
182182 }
183183}
184+
185+ // MARK: - Graphics
186+
187+ @Suite ( " Graphics " )
188+ struct GraphicsTests {
189+
190+ @Test ( " Shapes emit a Shape node with their kind and fill " )
191+ func shapes( ) {
192+ let rect = ViewHost ( Rectangle ( ) . fill ( . blue) ) . evaluate ( )
193+ #expect( rect. type == " Shape " )
194+ #expect( rect. props [ " shape " ] == . string( " rectangle " ) )
195+ #expect( rect. props [ " fill " ] == Color . blue. propValue)
196+
197+ let rounded = ViewHost ( RoundedRectangle ( cornerRadius: 12 ) ) . evaluate ( )
198+ #expect( rounded. props [ " shape " ] == . string( " roundedRectangle " ) )
199+ #expect( rounded. props [ " cornerRadius " ] == . double( 12 ) )
200+
201+ #expect( ViewHost ( Circle ( ) ) . evaluate ( ) . props [ " shape " ] == . string( " circle " ) )
202+ #expect( ViewHost ( Capsule ( ) ) . evaluate ( ) . props [ " shape " ] == . string( " capsule " ) )
203+ }
204+
205+ @Test ( " LinearGradient emits its colors and endpoints " )
206+ func gradient( ) {
207+ let node = ViewHost ( LinearGradient ( colors: [ . blue, . purple] , startPoint: . leading, endPoint: . trailing) ) . evaluate ( )
208+ #expect( node. type == " LinearGradient " )
209+ #expect( node. props [ " colors " ] == . array( [ Color . blue. propValue, Color . purple. propValue] ) )
210+ #expect( node. props [ " startX " ] == . double( 0 ) )
211+ #expect( node. props [ " endX " ] == . double( 1 ) )
212+ }
213+
214+ @Test ( " Image(systemName:) carries the symbol name " )
215+ func systemImage( ) {
216+ let node = ViewHost ( Image ( systemName: " star.fill " ) ) . evaluate ( )
217+ #expect( node. type == " Image " )
218+ #expect( node. props [ " systemName " ] == . string( " star.fill " ) )
219+ }
220+ }
0 commit comments