mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix testScrollPane
This commit is contained in:
+26
-15
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.PluginPathManager;
|
||||
import com.intellij.openapi.components.BaseState;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.ui.components.JBTabbedPane;
|
||||
@@ -29,11 +30,13 @@ import com.intellij.uiDesigner.compiler.NestedFormLoader;
|
||||
import com.intellij.uiDesigner.compiler.Utils;
|
||||
import com.intellij.uiDesigner.lw.CompiledClassPropertiesProvider;
|
||||
import com.intellij.uiDesigner.lw.LwRootContainer;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.sun.tools.javac.Main;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import junit.framework.TestCase;
|
||||
import kotlin.reflect.KDeclarationContainer;
|
||||
import org.jetbrains.org.objectweb.asm.ClassWriter;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -47,10 +50,10 @@ import java.lang.reflect.Method;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -66,7 +69,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
|
||||
final String swingPath = PathUtil.getJarPathForClass(AbstractButton.class);
|
||||
|
||||
java.util.List<URL> cp = new ArrayList<>();
|
||||
List<URL> cp = new ArrayList<>();
|
||||
appendPath(cp, JBTabbedPane.class);
|
||||
appendPath(cp, TIntObjectHashMap.class);
|
||||
appendPath(cp, UIUtil.class);
|
||||
@@ -76,6 +79,8 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
appendPath(cp, PathManager.getResourceRoot(this.getClass(), "/RuntimeBundle.properties"));
|
||||
appendPath(cp, GridLayoutManager.class); // forms_rt
|
||||
appendPath(cp, DataProvider.class);
|
||||
appendPath(cp, BaseState.class);
|
||||
appendPath(cp, KDeclarationContainer.class);
|
||||
myClassFinder = new MyClassFinder(
|
||||
new URL[] {new File(swingPath).toURI().toURL()},
|
||||
cp.toArray(new URL[cp.size()])
|
||||
@@ -93,13 +98,17 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myNestedFormLoader = null;
|
||||
final MyClassFinder classFinder = myClassFinder;
|
||||
if (classFinder != null) {
|
||||
classFinder.releaseResources();
|
||||
myClassFinder = null;
|
||||
try {
|
||||
myNestedFormLoader = null;
|
||||
final MyClassFinder classFinder = myClassFinder;
|
||||
if (classFinder != null) {
|
||||
classFinder.releaseResources();
|
||||
myClassFinder = null;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
super.tearDown();
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private AsmCodeGenerator initCodeGenerator(final String formFileName, final String className) throws Exception {
|
||||
@@ -228,7 +237,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
}
|
||||
|
||||
private static Object invokeMethod(Object obj, String methodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
return invokeMethod(obj, methodName, new Class[0], new Object[0]);
|
||||
return invokeMethod(obj, methodName, ArrayUtil.EMPTY_CLASS_ARRAY, ArrayUtil.EMPTY_OBJECT_ARRAY);
|
||||
}
|
||||
|
||||
private static Object invokeMethod(Object obj, String methodName, Class[] params, Object[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
@@ -236,7 +245,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
return method.invoke(obj, args);
|
||||
}
|
||||
|
||||
private static Method findMethod(Class<? extends Object> aClass, String methodName, Class[] params) {
|
||||
private static Method findMethod(Class<?> aClass, String methodName, Class[] params) {
|
||||
try {
|
||||
final Method method = aClass.getDeclaredMethod(methodName, params);
|
||||
method.setAccessible(true);
|
||||
@@ -262,7 +271,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
public void testCardLayoutShow() throws Exception {
|
||||
JComponent rootComponent = getInstrumentedRootComponent("TestCardLayoutShow.form", "BindingTest");
|
||||
assertTrue(rootComponent.getLayout() instanceof CardLayout);
|
||||
assertEquals(rootComponent.getComponentCount(), 2);
|
||||
assertThat(rootComponent.getComponentCount()).isEqualTo(2);
|
||||
assertFalse(rootComponent.getComponent(0).isVisible());
|
||||
assertTrue(rootComponent.getComponent(1).isVisible());
|
||||
}
|
||||
@@ -452,6 +461,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
myClassData.put(name.replace('.', '/'), bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputStream lookupClassBeforeClasspath(String internalClassName) {
|
||||
final byte[] bytes = myClassData.get(internalClassName);
|
||||
if (bytes != null) {
|
||||
@@ -460,6 +470,7 @@ public class AsmCodeGeneratorTest extends TestCase {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getResourceAsStream(String name) throws IOException {
|
||||
if (name.equals("TestProperties.properties")) {
|
||||
return new ByteArrayInputStream(myTestProperties, 0, TEST_PROPERTY_CONTENT.length());
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<orderEntry type="module" module-name="jps-builders" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="properties-psi-api" />
|
||||
<orderEntry type="library" scope="TEST" name="assertJ" level="project" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
Reference in New Issue
Block a user