[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [tm-dev] TextCanvas in automatic testing - a method to read the content is missing
|
Thanks Martin,
I took a look and played a bit.
Let's call the method, that I need in TextCanvas.java,
getTextContent().
My first and very naive attempt was like:
public String getTextContent() {
ITerminalTextDataReadOnly terminalText
= terminalText.getTerminalText();
// Collect all snapshot.getChars(i), skipped for brevity.
// Return the "sum" of them.
}
This didn't work - all "scrolled out" lines came out as empty.
In other words, I got only lines actually visible at the
respective moment.
OK, I took a look how getSelectedText() and getSelectedText()
work, as they are the gist of my current workaround. From them
I distilled a new attempt:
public String getTextContent() {
ITerminalTextDataReadOnly terminalText
= fCellCanvasModel.getTerminalText();
ITerminalTextDataSnapshot snapshot
= ((ITerminalTextDataSnapshot)terminalText)
.getTerminalTextData().makeSnapshot();
snapshot.updateSnapshot(true);
snapshot.detach();
// Collect all snapshot.getChars(i), skipped for brevity.
}
This seems to work, at least as a proof of concept. However,
the need to cast terminalText to ITerminalTextDataSnapshot
indicates that I'm working on a wrong level of abstraction. But
I haven't intended to spread my changes outside of TextCanvas.
At this moment I'm not sure how to proceed further. Any
suggestion?
Thanks in advance
Vaclav
----- Original Message -----
> Hello Vaclav,
>
> Thanks for the background information, and for your drive towards test
> automation!
>
> Code contributions would be welcome to provide the APIs that you need.
>
> Thanks,
> Martin
> --
> Martin Oberhuber, SMTS / Product Owner – Development Tools, Wind River
>
> On 29/05/17 12:22, "tm-dev-bounces@xxxxxxxxxxx on behalf of Vaclav Kadlcik"
> <tm-dev-bounces@xxxxxxxxxxx on behalf of vkadlcik@xxxxxxxxxx> wrote:
>
> Hello list!
>
> o.e.tm.terminal has become *the* text interface in several other
> Eclipse projects, e.g.
> - Docker containers' terminal in Linuxtools
> - Debugger Console view in CDT
> therefore its accessibility in automatic testing is more and
> more important. Testing frameworks (for example SWTBot or Red
> Deer) need to locate widgets and perform some actions on them.
> In case of o.e.tm.terminal, these tasks roughly translate to:
>
> 1. locating instances of TextCanvas
> 2. typing some text
> 3. reading the content
>
> There's no major obstacle in achieving 1 and 2. However, 3 isn't
> that easy; at least I cannot see a public method in TextCanvas
> that would provide that. For now, I'm using a "clipboard"
> workaround:
>
> textCanvas.selectAll();
> content = textCanvas.getSelectionText();
>
> which sort of works but is obviously bad and inherently fragile.
>
> I already filed this as a RFE [1] but then it came to me that
> bringing the issue to the mailing list (and adding some
> background) could be a good idea...
>
> Best regards
> Vaclav
>
> [1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=517358
> _______________________________________________
> tm-dev mailing list
> tm-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/tm-dev
>
>
> _______________________________________________
> tm-dev mailing list
> tm-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/tm-dev