Bug 305189 - add reveal method to SWTBotGefEditPart
Summary: add reveal method to SWTBotGefEditPart
Status: NEW
Alias: None
Product: SWTBot
Classification: Technology
Component: GEFBot (show other bugs)
Version: 2.0.0-dev   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-09 11:45 EST by Cédric Chabanois CLA
Modified: 2013-05-30 03:44 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cédric Chabanois CLA 2010-03-09 11:45:31 EST
Build Identifier: M20100211-1343

SWTBotGefEditPart.click() or SWTBotGefEditPart.doubleClick() do nothing if the editPart figure is not in the visible portion of the ScrollPane.

I have to do the following to click on an editPart :

final GraphicalViewer graphicalViewer = (GraphicalViewer)jobEditorPart.getAdapter(GraphicalViewer.class);
		
SWTBotGefEditor gefEditorBot = gefBot.gefEditor("testAdvancedPropertySection");
final SWTBotGefEditPart editPart = gefEditorBot.getEditPart("Record Success");
UIThreadRunnable.syncExec(new VoidResult() {
	public void run() {
		try {
			graphicalViewer.reveal(editPart.part());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
});
editPart.click();

Reproducible: Always
Comment 1 Mariot Chauvin CLA 2010-03-09 11:52:39 EST
(In reply to comment #0)
> Build Identifier: M20100211-1343
> 
> SWTBotGefEditPart.click() or SWTBotGefEditPart.doubleClick() do nothing if the
> editPart figure is not in the visible portion of the ScrollPane.
> 
> I have to do the following to click on an editPart :
> 
> final GraphicalViewer graphicalViewer =
> (GraphicalViewer)jobEditorPart.getAdapter(GraphicalViewer.class);
> 
> SWTBotGefEditor gefEditorBot = gefBot.gefEditor("testAdvancedPropertySection");
> final SWTBotGefEditPart editPart = gefEditorBot.getEditPart("Record Success");
> UIThreadRunnable.syncExec(new VoidResult() {
>     public void run() {
>         try {
>             graphicalViewer.reveal(editPart.part());
>         } catch (Exception e) {
>             throw new RuntimeException(e);
>         }
>     }
> });
> editPart.click();
> 
> Reproducible: Always

Hi Cédric,

It seems to me to be the correct behavior. If an end user is not able to click unless he made the edit part visible using the ascensor of the scroll pane, the bot should not allow to do it.

Regards
Comment 2 Cédric Chabanois CLA 2010-03-10 03:37:14 EST
Ok, I agree but there should be a reveal method on SWTBotGefEditPart then (or another way to make the EditPart figure visible).

Did I miss something ?
Comment 3 Laurent Redor CLA 2010-04-19 09:48:54 EDT
(In reply to comment #2)
> Ok, I agree but there should be a reveal method on SWTBotGefEditPart then (or
> another way to make the EditPart figure visible).
> 
> Did I miss something ?

I think a method like this one can be added to SWTBotGefEditor :


    /**
     * Reveal the edit part with the label as a single selection.
     * 
     * @param label
     *            The label of the searched edit part
     */
    public void reveal(String label) {
        final SWTBotGefEditPart revealedEP = getEditPart(label);
        if (revealedEP == null) {
            throw new WidgetNotFoundException(String.format("Expected to find widget %s", label));
        }
        UIThreadRunnable.syncExec(new VoidResult() {
            public void run() {
                graphicalViewer.reveal(revealedEP.part());
            }
        });
    }

Regards, 

Laurent
Comment 4 Udo Walker CLA 2010-12-08 12:32:31 EST
I would like to have this method:

/**
 * Reveal the edit part .
 * 
 * @param editPart
 *            The edit part.
*/
public void reveal(final SWTBotGefEditPart editPart) {
   UIThreadRunnable.syncExec(new VoidResult() {
       public void run() {
           graphicalViewer.reveal(editPart.part());
       }
   });
}

For my test environment I created a selector where I can give a path to my element . The selector selects that. But the selector should be able to reveal a given SWTBotGefEditPart  which the selector knows by the path. For me it is not sufficient to have a method where I give a label.
Comment 5 Mickael Istria CLA 2013-05-30 03:44:08 EDT
Please provide a patch with Gerrit (ideally with a test case that validates your code, that would be added to the automated tests) http://wiki.eclipse.org/SWTBot/Contributing