Eric Ipsum
Eric Ipsum

Reputation: 745

get the current view which is displayed to user and verify

I am testing my eclipse rcp app GUI using a tool called RCPTT.

In rcptt, i want to check that a specific editor is opened or not.

right now i am using

get-view "Console" | get-table | is-disabled | verify-false

but this is wrong way to do verification.

using this code, if the console is not opened, than it click on console and do verification. It passed all time.

So, is there any way to

- first get the current view(which view is displaying currently to user.)
- then verify this view.

Thanks

Upvotes: 3

Views: 620

Answers (1)

Adam Horvath
Adam Horvath

Reputation: 1286

You can not solve it within ECL, there's no support for this.

However you can solve it with Java code. It's not easy, could be a few hours of work.

1) Write a Java method that detects the name of the active View and returns it as a String

2) Make sure it's part of your application as a static class's static method

3) Invoke it from your ECL script with the invoke-static command

4) Compare the returned value in ECL script to what you've expected

Check methods parseComposites(), viewOrEditorIsFocused() and checkNextComposite() from this tutorial:

https://openchrom.wordpress.com/2011/08/12/capture-a-snapshot-of-the-active-vieweditor-in-a-rcp-application/

You do not need all the code from it and you need some editing too.

If you make an error/typo at points 2) or 3), then RCPTT-runner will simply throw an Exception without further explanation; be careful there.

Upvotes: 1

Related Questions