mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
There may be several facets with the same underlying facet, so many-to-one connection should be used. GitOrigin-RevId: ca1c8fda14381e108c62219e78e5dd8bd600452d
50 lines
1.7 KiB
Java
50 lines
1.7 KiB
Java
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
|
|
package com.intellij.facet;
|
|
|
|
import com.intellij.facet.impl.ui.actions.AddFacetToModuleAction;
|
|
import com.intellij.facet.mock.MockFacetConfiguration;
|
|
import com.intellij.facet.mock.MockFacetEditorFacade;
|
|
import com.intellij.facet.mock.MockFacetType;
|
|
import com.intellij.facet.mock.MockSubFacetType;
|
|
|
|
public class AddFacetActionTest extends FacetTestCase {
|
|
private MockFacetEditorFacade myEditorFacade;
|
|
|
|
@Override
|
|
protected void setUp() throws Exception {
|
|
super.setUp();
|
|
myEditorFacade = new MockFacetEditorFacade();
|
|
}
|
|
|
|
@Override
|
|
protected void tearDown() throws Exception {
|
|
myEditorFacade = null;
|
|
super.tearDown();
|
|
}
|
|
|
|
public void testAddFacet() {
|
|
assertTrue(isVisible(MockFacetType.getInstance()));
|
|
assertFalse(isVisible(MockSubFacetType.getInstance()));
|
|
|
|
final FacetInfo info = new FacetInfo(MockFacetType.getInstance(), "239", new MockFacetConfiguration(), null);
|
|
myEditorFacade.getModel().addFacetInfo(info);
|
|
assertTrue(isVisible(MockFacetType.getInstance()));
|
|
assertFalse(isVisible(MockSubFacetType.getInstance()));
|
|
|
|
myEditorFacade.setSelectedFacet(info);
|
|
assertTrue(isVisible(MockFacetType.getInstance()));
|
|
assertTrue(isVisible(MockSubFacetType.getInstance()));
|
|
|
|
final FacetInfo subInfo = new FacetInfo(MockSubFacetType.getInstance(), "42", new MockFacetConfiguration(), info);
|
|
myEditorFacade.getModel().addFacetInfo(subInfo);
|
|
|
|
assertTrue(isVisible(MockFacetType.getInstance()));
|
|
assertTrue(isVisible(MockSubFacetType.getInstance()));
|
|
}
|
|
|
|
private boolean isVisible(FacetType type) {
|
|
return AddFacetToModuleAction.isVisible(myEditorFacade, type);
|
|
}
|
|
}
|