Lines 39-44
Link Here
|
39 |
|
39 |
|
40 |
package org.netbeans.modules.openide.awt; |
40 |
package org.netbeans.modules.openide.awt; |
41 |
|
41 |
|
|
|
42 |
import java.io.File; |
42 |
import java.awt.Component; |
43 |
import java.awt.Component; |
43 |
import javax.swing.JComponent; |
44 |
import javax.swing.JComponent; |
44 |
import javax.swing.JMenuItem; |
45 |
import javax.swing.JMenuItem; |
Lines 843-849
Link Here
|
843 |
assertFalse("Compilation has to fail:\n" + os, r); |
844 |
assertFalse("Compilation has to fail:\n" + os, r); |
844 |
} |
845 |
} |
845 |
|
846 |
|
846 |
/* #196933: will only pass when using JDK 7 javac: |
|
|
847 |
public void testWrongPointerToIcon() throws IOException { |
847 |
public void testWrongPointerToIcon() throws IOException { |
848 |
clearWorkDir(); |
848 |
clearWorkDir(); |
849 |
AnnotationProcessorTestUtils.makeSource(getWorkDir(), "test.A", |
849 |
AnnotationProcessorTestUtils.makeSource(getWorkDir(), "test.A", |
Lines 863-873
Link Here
|
863 |
); |
863 |
); |
864 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
864 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
865 |
boolean r = AnnotationProcessorTestUtils.runJavac(getWorkDir(), null, getWorkDir(), null, os); |
865 |
boolean r = AnnotationProcessorTestUtils.runJavac(getWorkDir(), null, getWorkDir(), null, os); |
866 |
assertFalse("Compilation has to fail:\n" + os, r); |
866 |
if (ActionProcessor.isJDK7()) { |
|
|
867 |
assertFalse("Compilation has to fail:\n" + os, r); |
868 |
} else { |
869 |
assertTrue("Too bad on JDK6 we have to succeed:\n" + os, r); |
870 |
} |
867 |
if (!os.toString().contains("does/not/exist.png")) { |
871 |
if (!os.toString().contains("does/not/exist.png")) { |
868 |
fail("Shall contain warning about does/not/exist.png resource:\n" + os); |
872 |
fail("Shall contain warning about does/not/exist.png resource:\n" + os); |
869 |
} |
873 |
} |
870 |
} |
874 |
} |
871 |
*/ |
875 |
public void testGoodPointerToIcon() throws IOException { |
872 |
|
876 |
clearWorkDir(); |
|
|
877 |
|
878 |
File icons = new File(getWorkDir(), "icons"); |
879 |
File existsPng = new File(new File(icons, "does"), "exist.png"); |
880 |
existsPng.getParentFile().mkdirs(); |
881 |
existsPng.createNewFile(); |
882 |
|
883 |
AnnotationProcessorTestUtils.makeSource(getWorkDir(), "test.A", |
884 |
"import org.openide.awt.ActionRegistration;\n" + |
885 |
"import org.openide.awt.ActionReference;\n" + |
886 |
"import org.openide.awt.ActionID;\n" + |
887 |
"import org.openide.util.actions.Presenter;\n" + |
888 |
"import java.awt.event.*;\n" + |
889 |
"import java.util.List;\n" + |
890 |
"import javax.swing.*;\n" + |
891 |
"@ActionID(category=\"Tools\",id=\"my.action\")" + |
892 |
"@ActionRegistration(displayName=\"AAA\", key=\"K\", iconBase=\"does/exist.png\") " + |
893 |
"@ActionReference(path=\"manka\", position=11)" + |
894 |
"public class A implements ActionListener {\n" + |
895 |
" public void actionPerformed(ActionEvent e) {}" + |
896 |
"}\n" |
897 |
); |
898 |
ByteArrayOutputStream os = new ByteArrayOutputStream(); |
899 |
boolean r = AnnotationProcessorTestUtils.runJavac(getWorkDir(), null, getWorkDir(), new File[] { icons, null }, os); |
900 |
assertTrue("Compilation has to succeed:\n" + os, r); |
901 |
} |
873 |
} |
902 |
} |