Profile Picture

Finding NGroup's Screen or DrawingView Client Window Position for Automated UI Testing Playback

Posted By Jason Irby 15 Years Ago

Finding NGroup's Screen or DrawingView Client Window Position for...

Author
Message
Jason Irby
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 59, Visits: 77
Ivo,

Hi. I haven't had a chance to try it yet but I think that "SceneToDevice" is going to be what I need. I had looked through the View methods but I guess I missed that.

Thanks for your help,

Jason

Ivo Milanov
Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)Forum Member (35 reputation)

Group: Forum Members
Last Active: 2 Months Ago
Posts: 35, Visits: 15

Hi Jason,

You can use the current view.SceneToDevice transformation to convert between logical coordinates used by the diagram document and their pixel counterparts (e.g. client coordinates) of the drawing view. For example: if you want to get the location of a group in the drawing view client coordinate system you can use:

NPointF ptClient = view.SceneToDevice.TransformPoint(group.Location);

 

For the purpose of UI automation all methods that relate to user input are performed by public counterparts in the view. For example: the override of OnMouseDown(...) in NView is actually calling the DoMouseDown public virtual method. You can simulate or record user actions by overriding the respective DoXXX methods.

 

The diagram shapes and elements are not Windows Forms controls, because they need to support affine transformations, rendering in multiple layers, image filter effects etc. UI Automation tools only record up to control level, because they do not have any idea how the user input is processed inside the control, nor they have an idea which events to hook.

If you are interested in hit testing the document by a client point, check out the LastDocumentHit method of the NDrawingView.

 

Best regards,
Ivo



Jason Irby
questionmark Posted 15 Years Ago
View Quick Profile
Forum Member

Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 59, Visits: 77



We have implemented a feature using Nevron Diagram where customer data is mapped using various compound groups and images. (Think of a OOD class diagram as an example…)

We are now in the middle of trying to get a UI test automation tool to work properly with this feature.

The issue is that this tool uses reflection to record various interactions and later playback the actions. However, the tool can not drill down deeper than the DrawingView control as it does not see the NShapes and Groups as .Net UI controls (obviously). The result is that all interactions are recorded as simple clicks and drags within the client rectangle of the DrawingView control. So instead of recording “DiagramObjectFoo.Click()” it is recording “DrawingView.Click(465,332)”. This is obviously dependent to my current pan and zoom and even the screen size and resolution of the machine it’s running on. This isn’t very robust.

I am trying to write a method that the UI tool can call to find out the position of the desired object in either DrawingView control client window or even screen coordinates (which I can convert to DrawingView control client window coordinates).

I have a group, inside a group, on a document, at a certain pan and zoom within a DrawingView, and I’ve just been giving myself a headache! ;o)

Is there just a really simple, magic way I can ask a shape or group “What is you location in screen or DrawingView control client window coordinates?”


Thanks in advance,
Jason Irby
Developer
Targeted Convergence




Similar Topics


Reading This Topic