Test line extensions generated by EditorLinePainter

Planned

Is it possible to test line extensions generated using EditorLinePainter? I didnt find any information about it.

I didnt find any useful function for that in:

https://github.com/JetBrains/intellij-community/blob/master/platform/testFramework/src/com/intellij/testFramework/fixtures/CodeInsightTestFixture.java

Thank you for your help

Tomas

 

5 comments

Hi Tomas,

Sorry, it's not clear what are you trying to do, can you please specify? Are you working on custom plugin?

0

Hi,

i am sorry. I am developing plugin, where i paint additional text at the end of some lines (line extensions). For this, i am using EditorLinePainter.class and i am overriding getLineExtensions method to paint a text.

And i would like to write unittest for this functionality, to check if the text was painted at specified line.

I would expect testHighlighting() from  CodeInsightTestFixture.class would run my plugin code and paint the text or something similar. But it doesnt work and i didnt find any function to do that. 

How can i test EditorLinePainter?

 

 

0

Hello Tomas,

If possible please describe in more details what are you planning to test. Thank you

0

Hi Olga,

of course. So firsly i will describe functionality of my plugin. As i said i have a class which extend from:
https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/openapi/editor/EditorLinePainter.java

In this class i override method getLineExtensions(). Inside the method, i create instances of the object:
https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/com/intellij/openapi/editor/LineExtensionInfo.java
I return collection of these instances.

This way i am able to paint custom text at different lines to different files in editor. Example:

The red text (its not clickable and cannot be edited, its just painted there) is result. And i want to unit test this.

 

Tomas

0
Hello Tomas, Sorry for a long time to reply. Unfortunately, IntelliJ Platform does not provide a way to unit test Line Extensions. They are rendered as graphical elements, not the text, and you may test them using some image comparison tool.
0

Please sign in to leave a comment.