Testing custom designer editor panel
I have registered my file editor provider in plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<fileEditorProvider implementation="com.designer.IXMLFileEditorProvider"></fileEditorProvider>
<fileTypeFactory implementation="com.designer.ixml.IXMLFileTypeFactory"/>
<lang.parserDefinition language="IXML" implementationClass="com.designer.ixml.IXMLParserDefinition"/>
</extensions>
IXMLFileEditorProvider created IXMLDesignerEditorPanel. When I used Plugin run configuration there are no problems in registering custom provider(IXMLFileEditorProvider) and rendering custom panel (IXMLDesignerEditorPanel).
I have tried to test my custom panel on the same manner as the AndroidDesignerEditorPanel(I have found this test in source code of Intellij IDEA-coummunity edition). But I have faced with problem - root component(RadComponent) of my editor is null.
Does anyone know some tutorials/articles related to testing custom editor panel?
P.S. Tutorial "Writing Tests for Plugins" (https://confluence.jetbrains.com/display/IntelliJIDEA/Writing+Tests+for+Plugins) is not useful in this case.
Please sign in to leave a comment.
Please show the setup code for your test.
I use setup code from LayoutEditorTestBase (parent of the AndroidDesignerEditorPanelTest).
I have found some strange thing - LayoutLibrary can't create new instance of "com.android.layoutlib.bridge.Bridge"(Object bridgeObject = constructor.newInstance(); throw exception) when I start unit test but this promlem does not reproduce when I start plugin. In both cases I have used the same classpath of module(plugin module classpath).
B-) I have done it!!!
The root cause was in "android.jar" in classpath. In LayoutLibrary we add an "icu4j.jar" & "layoutlib.jar" (with implementation of android classes) and then load "com.android.layoutlib.bridge.Bridge" from "layoutlib.jar". But other classes, used inside Bridge, classloader have taken from "android.jar" that is why I have caught echeption.