Problem by tests with Editor [message #41443] |
Thu, 02 July 2009 08:40  |
Eclipse User |
|
|
|
Hallo Ketan,
Im trying to get access to a confirmation dialog, that comes after
closing of a dirty(!) editor. (I mean this one: "do you want to save
changes? Yes/No/Cancel").
If I close the editor manually, then this dialog appears ...
But if I try to close the editor via SWTBot ( myEditor.close() ), then the
editor is closed without to show me the dialog (and it doesnt save any
changes in editor).
Is it smth. wrong with SWTBot (version .340), or I use this method
incorrect?
How can I get the access to this confirmation dialog?
Thanx in advance!
Pavel. C.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Problem by tests with Editor [message #41896 is a reply to message #41805] |
Mon, 06 July 2009 14:52   |
Eclipse User |
|
|
|
Pavel Cybulskij wrote:
> Ok. The whole story from A till Z:
>
> - I have in my perspective a view that contains a list of file names;
> - a double click on a file name opens the embedded editor with file
> content; - I make some changes in file content and the editor becomes
> dirty;
> - Now I want to close the editor so, that the confirmation menu comes;
> - Then I want to click buttons "Yes" or "No" in confirmation menu
> (question: "Do you want so save changes?");
> - And finally I want to check, if the content of a file was really
> changed (or wasn't changed);
>
> You see, I can't do the last step if I call the dialog via File/Exit,
> because the whole GUI will be closed after clicking on "Yes/No"
> And as I already said, if I try to close only the editor via
> editor.close(), I get no confirmation menu ...
> That's it :-)
I still don't see why you need that dialog.
In the case you want it to close and save (same as clicking yes in the
dialog), call the method editor.saveAndClose().
In the case you don't want it to save your modification (same as
clicking no in the dialog), call the method editor.close().
In the case you don't want it to close (same as clicking cancel in the
dialog), don't call any of the methods.
Then, after each calls, you do whatever check you need to do.
I seem to have the same test case as you: I open an editor, edit the
content, close without saving then check if my modifications were
applied. I never needed that dialog for my test and I don't see why you
would need it...
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
|
|
|
|
Re: Problem by tests with Editor [message #42022 is a reply to message #41958] |
Tue, 07 July 2009 08:25   |
Eclipse User |
|
|
|
Isn't that confirmation dialog supplied by SWT/JFace automatically when
you close an editor? If so, its not your responsibility to test it. I
mean, if you didn't build it, I don't see why you should test it...
The way I see it, that dialog is part of the application's GUI, but it
is not part of the codebase of the application. Your tests should only
target the codebase of your application. My guess is that you don't test
SWT component such as how an image is painted (for example), so why
would you test a dialog that is part of SWT/JFace codebase?
Pavel Cybulskij wrote:
> .. because i don't want to test the methods of SWTBot (e.g.
> SaveAndCose() etc.) itself. I want to test my(!) GUI.
I don't see why calling those method makes you test them... those method
emulates (more or less) the confirmation dialog, just as every other
method in SWTBot, such as click() or select(), emulates UI interaction.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/
*Because performance matters.*
|
|
|
|
Powered by
FUDForum. Page generated in 0.06782 seconds