1- using FlaUI . Core ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Drawing ;
4+ using System . Linq ;
5+
6+ using FlaUI . Core ;
27using FlaUI . Core . AutomationElements ;
38using FlaUI . Core . Definitions ;
49using FlaUI . Core . Patterns ;
1015
1116using RichCanvasUITests . App . Automation ;
1217
13- using System ;
14- using System . Collections . Generic ;
15- using System . Drawing ;
16- using System . Linq ;
17-
1818namespace RichCanvas . UITests
1919{
20- public partial class RichItemsControlAutomation : AutomationElement
20+ public partial class RichCanvasAutomation : AutomationElement
2121 {
22- public Point ViewportLocation => RichItemsControlData . ViewportLocation . AsDrawingPoint ( ) ;
22+ public Point ViewportLocation => RichCanvasData . ViewportLocation . AsDrawingPoint ( ) ;
2323
24- public Size ViewportSizeInteger => new Size ( ( int ) RichItemsControlData . ViewportSize . Width , ( int ) RichItemsControlData . ViewportSize . Height ) ;
24+ public Size ViewportSizeInteger => new Size ( ( int ) RichCanvasData . ViewportSize . Width , ( int ) RichCanvasData . ViewportSize . Height ) ;
2525
2626 public RichItemContainerAutomation [ ] Items
2727 {
2828 get
2929 {
30- if ( Patterns . ItemContainer . TryGetPattern ( out var itemContainerPattern ) )
30+ if ( Patterns . ItemContainer . TryGetPattern ( out IItemContainerPattern itemContainerPattern ) )
3131 {
3232 var allItems = new List < RichItemContainerAutomation > ( ) ;
3333 AutomationElement item = null ;
@@ -36,7 +36,7 @@ public RichItemContainerAutomation[] Items
3636 item = itemContainerPattern . FindItemByProperty ( item , null , null ) ;
3737 if ( item != null )
3838 {
39- allItems . Add ( item . AsRichItemContainerAutomation ( ) ) ;
39+ allItems . Add ( item . AsRichCanvasContainerAutomation ( ) ) ;
4040 }
4141 }
4242 while ( item != null ) ;
@@ -50,14 +50,14 @@ public RichItemContainerAutomation[] SelectedItems
5050 {
5151 get
5252 {
53- if ( Patterns . Selection . TryGetPattern ( out var selectionPattern ) )
53+ if ( Patterns . Selection . TryGetPattern ( out ISelectionPattern selectionPattern ) )
5454 {
5555 var allItems = new List < RichItemContainerAutomation > ( ) ;
56- foreach ( var selection in selectionPattern . Selection . ValueOrDefault )
56+ foreach ( AutomationElement selection in selectionPattern . Selection . ValueOrDefault )
5757 {
5858 if ( selection != null )
5959 {
60- allItems . Add ( selection . AsRichItemContainerAutomation ( ) ) ;
60+ allItems . Add ( selection . AsRichCanvasContainerAutomation ( ) ) ;
6161 }
6262 }
6363 return allItems . ToArray ( ) ;
@@ -70,27 +70,27 @@ public RichItemContainerAutomation SelectedItem
7070 {
7171 get
7272 {
73- if ( Patterns . Selection . TryGetPattern ( out var selectionPattern ) && ! selectionPattern . CanSelectMultiple )
73+ if ( Patterns . Selection . TryGetPattern ( out ISelectionPattern selectionPattern ) && ! selectionPattern . CanSelectMultiple )
7474 {
75- return selectionPattern . Selection . ValueOrDefault . SingleOrDefault ( ) . AsRichItemContainerAutomation ( ) ;
75+ return selectionPattern . Selection . ValueOrDefault . SingleOrDefault ( ) . AsRichCanvasContainerAutomation ( ) ;
7676 }
7777 return null ;
7878 }
7979 }
8080
81- public RichItemsControlData RichItemsControlData => Patterns . Value . Pattern . Value . Value . AsRichItemsControlData ( ) ;
81+ public RichCanvasData RichCanvasData => Patterns . Value . Pattern . Value . Value . AsRichCanvasData ( ) ;
8282
8383 public IScrollPattern ScrollInfo => Patterns . Scroll . PatternOrDefault ;
8484
8585 public Window ParentWindow { get ; internal set ; }
8686
87- public RichItemsControlAutomation ( FrameworkAutomationElementBase frameworkAutomationElement ) : base ( frameworkAutomationElement )
87+ public RichCanvasAutomation ( FrameworkAutomationElementBase frameworkAutomationElement ) : base ( frameworkAutomationElement )
8888 {
8989 }
9090
9191 public void ScrollByArrowKeyOrButton ( Direction scrollingMode )
9292 {
93- if ( Patterns . Scroll . TryGetPattern ( out var scrollPattern ) )
93+ if ( Patterns . Scroll . TryGetPattern ( out IScrollPattern scrollPattern ) )
9494 {
9595 if ( scrollingMode == Direction . Up )
9696 {
@@ -113,7 +113,7 @@ public void ScrollByArrowKeyOrButton(Direction scrollingMode)
113113
114114 public void ScrollByPage ( Direction scrollingMode )
115115 {
116- if ( Patterns . Scroll . TryGetPattern ( out var scrollPattern ) )
116+ if ( Patterns . Scroll . TryGetPattern ( out IScrollPattern scrollPattern ) )
117117 {
118118 if ( scrollingMode == Direction . Up )
119119 {
@@ -136,7 +136,7 @@ public void ScrollByPage(Direction scrollingMode)
136136
137137 public void ScrollByScrollbarsDragging ( Direction scrollingMode )
138138 {
139- if ( Patterns . Scroll . TryGetPattern ( out var scrollPattern ) )
139+ if ( Patterns . Scroll . TryGetPattern ( out IScrollPattern scrollPattern ) )
140140 {
141141 if ( scrollingMode == Direction . Up )
142142 {
@@ -159,17 +159,17 @@ public void ScrollByScrollbarsDragging(Direction scrollingMode)
159159
160160 public void SetScrollPercent ( double horizontalOffset , double verticalOffset )
161161 {
162- if ( Patterns . Scroll . TryGetPattern ( out var scrollPattern ) )
162+ if ( Patterns . Scroll . TryGetPattern ( out IScrollPattern scrollPattern ) )
163163 {
164164 scrollPattern . SetScrollPercent ( horizontalOffset , verticalOffset ) ;
165165 }
166166 }
167167
168168 public void DragContainerOutsideViewportWithOffset ( RichItemContainerAutomation richItemContainer , Direction direction , int offsetDistance , System . Windows . Size visualViewportSize )
169169 {
170- var containerLocation = richItemContainer . BoundingRectangle . Location ;
171- var currentItemBounds = richItemContainer . BoundingRectangle ;
172- var offset = direction == Direction . Left ? new Point ( offsetDistance , 0 ) : new Point ( 0 , 0 ) ;
170+ Point containerLocation = richItemContainer . BoundingRectangle . Location ;
171+ Rectangle currentItemBounds = richItemContainer . BoundingRectangle ;
172+ Point offset = direction == Direction . Left ? new Point ( offsetDistance , 0 ) : new Point ( 0 , 0 ) ;
173173 Point draggingEndPoint = direction switch
174174 {
175175 Direction . Left => new Point ( - offsetDistance , containerLocation . Y ) ,
@@ -189,8 +189,8 @@ public void DefferedDragContainerOutsideViewportWithOffset(RichItemContainerAuto
189189 Action < Point , int > assertStepAction ,
190190 System . Windows . Size visualViewportSize )
191191 {
192- var currentItemBounds = richItemContainer . BoundingRectangle ;
193- var containerLocation = currentItemBounds . Location ;
192+ Rectangle currentItemBounds = richItemContainer . BoundingRectangle ;
193+ Point containerLocation = currentItemBounds . Location ;
194194
195195 Point firstDraggingPoint = direction switch
196196 {
0 commit comments