Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Powerful and easy way to testing text

Hi Mickael,

I love it your idea. As codemining is more and more used, we MUST write test, because rendering of codemining is very hard to manage (because rendering is done with CompletableFuture when mining is resolved) and each time we try to improve the renderer, we break every time a iven gusecase.

For codemining tests, I would like to have simple written test like:

--------------------------------------------------------------
String actual = "class A {}"
String expected = "[0 references]
                               class A {}"  
CodeMiningAssert.assert(actual, expected, classCodeMiningProvider);
-------------------------------------------------------------- 

I find it's very easy to read the test. I would like to test too when text changed (codemining changed too).

Thanks for investigating about this test topic.

Regard's Angelo

Le ven. 23 nov. 2018 à 15:42, Mickael Istria <mistria@xxxxxxxxxx> a écrit :
Hi all,

As we're having fun with StyledText and editors these days, some of us contributors have had discussions about how to test things.
I'd like to share with you a simple and powerful approach to test Text rendering (in a widget, in an editor, wherever): using an OCR like Tesseract.

I've tried the following:
* Open a Java editor with codeminings enabled
* Took a screenshot of the editor (cropped to remove ruler and keep only text)
* then ran from CLI `tesseract /path/to/screenshot.png stdout -psm 6` and got as output a string that matches almost perfectly the text in the editor; more particularly showing the codeminings were rendered and read properly.

I think it's an extremely powerful way to do rendering test for StyledText and the family (editors, code minings...).
Would is seem acceptable to start adopting such OCR-based tests where needed in Platform? I really think it's 1000 times worth it.

Cheers,

--
Mickael Istria
Eclipse IDE developer, for Red Hat Developers
_______________________________________________
platform-ui-dev mailing list
platform-ui-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/platform-ui-dev

Back to the top