1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for more information.
4
+
5
+ using Windows . Foundation ;
6
+ using Microsoft . Toolkit . Uwp . Extensions ;
7
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
8
+
9
+ namespace UnitTests . Extensions
10
+ {
11
+ [ TestClass ]
12
+ public class Test_PointExtensions
13
+ {
14
+ [ TestCategory ( "PointExtensions" ) ]
15
+ [ TestMethod ]
16
+ [ DataRow ( 0d , 0d , 0 , 0 ) ]
17
+ [ DataRow ( 0d , 0d , 22 , 6.89d ) ]
18
+ [ DataRow ( 3.14d , 6.55f , 3838d , 3.24724928d ) ]
19
+ [ DataRow ( double . MinValue , double . Epsilon , 22 , 0.3248d ) ]
20
+ public static void Test_PointExtensions_ToRect_FromWidthHeight ( double width , double height , int x , int y )
21
+ {
22
+ Point p = new Point ( x , y ) ;
23
+ Rect
24
+ a = p . ToRect ( width , height ) ,
25
+ b = new Rect ( x , y , width , height ) ;
26
+
27
+ Assert . AreEqual ( a , b ) ;
28
+ }
29
+
30
+ [ TestCategory ( "SizeExtensions" ) ]
31
+ [ TestMethod ]
32
+ [ DataRow ( 0d , 0d , 0 , 0 ) ]
33
+ [ DataRow ( 0d , 0d , 22 , 6.89d ) ]
34
+ [ DataRow ( 3.14d , 6.55f , 3838d , 3.24724928d ) ]
35
+ [ DataRow ( double . MinValue , double . Epsilon , 22 , 0.3248d ) ]
36
+ public static void Test_PointExtensions_ToRect_FromPoint ( double width , double height , int x , int y )
37
+ {
38
+ Point p = new Point ( x , y ) ;
39
+ Size s = new Size ( width , height ) ;
40
+ Rect
41
+ a = p . ToRect ( s ) ,
42
+ b = new Rect ( p , s ) ;
43
+
44
+ Assert . AreEqual ( a , b ) ;
45
+ }
46
+ }
47
+ }
0 commit comments