Lines 43-48
Link Here
|
43 |
|
43 |
|
44 |
import java.awt.event.KeyEvent; |
44 |
import java.awt.event.KeyEvent; |
45 |
|
45 |
|
|
|
46 |
import java.io.File; |
47 |
import java.util.concurrent.atomic.AtomicLong; |
48 |
import javax.swing.JEditorPane; |
49 |
import org.netbeans.api.java.source.SourceUtils; |
46 |
import org.netbeans.modules.performance.utilities.PerformanceTestCase; |
50 |
import org.netbeans.modules.performance.utilities.PerformanceTestCase; |
47 |
import org.netbeans.performance.j2se.setup.J2SESetup; |
51 |
import org.netbeans.performance.j2se.setup.J2SESetup; |
48 |
|
52 |
|
Lines 56-61
Link Here
|
56 |
import org.netbeans.jemmy.operators.ComponentOperator; |
60 |
import org.netbeans.jemmy.operators.ComponentOperator; |
57 |
import org.netbeans.junit.NbTestSuite; |
61 |
import org.netbeans.junit.NbTestSuite; |
58 |
import org.netbeans.junit.NbModuleSuite; |
62 |
import org.netbeans.junit.NbModuleSuite; |
|
|
63 |
import org.openide.cookies.EditorCookie; |
64 |
import org.openide.filesystems.FileObject; |
65 |
import org.openide.filesystems.FileUtil; |
66 |
import org.openide.util.Exceptions; |
67 |
import org.openide.util.Utilities; |
59 |
|
68 |
|
60 |
/** |
69 |
/** |
61 |
* Test of Paste text to opened source editor. |
70 |
* Test of Paste text to opened source editor. |
Lines 81-86
Link Here
|
81 |
} |
90 |
} |
82 |
|
91 |
|
83 |
public static NbTestSuite suite() { |
92 |
public static NbTestSuite suite() { |
|
|
93 |
CountingSecurityManager.initialize("non-existing"); |
84 |
NbTestSuite suite = new NbTestSuite(); |
94 |
NbTestSuite suite = new NbTestSuite(); |
85 |
suite.addTest(NbModuleSuite.create(NbModuleSuite.createConfiguration(J2SESetup.class) |
95 |
suite.addTest(NbModuleSuite.create(NbModuleSuite.createConfiguration(J2SESetup.class) |
86 |
.addTest(PasteInEditorTest.class) |
96 |
.addTest(PasteInEditorTest.class) |
Lines 109-115
Link Here
|
109 |
new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_C, KeyEvent.CTRL_MASK)).perform(editorOperator1); |
119 |
new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_C, KeyEvent.CTRL_MASK)).perform(editorOperator1); |
110 |
editorOperator2.makeComponentVisible(); |
120 |
editorOperator2.makeComponentVisible(); |
111 |
editorOperator2.setCaretPositionToLine(29); |
121 |
editorOperator2.setCaretPositionToLine(29); |
112 |
new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_END, KeyEvent.CTRL_MASK)).perform(editorOperator2); |
122 |
EditorCookie ec = Utilities.actionsGlobalContext().lookup(EditorCookie.class); |
|
|
123 |
assertNotNull("Editor is selected", ec); |
124 |
int len = ec.getDocument().getLength(); |
125 |
JEditorPane[] arr = ec.getOpenedPanes(); |
126 |
assertNotNull("Pane opened", arr); |
127 |
assertEquals("One Pane opened", 1, arr.length); |
128 |
arr[0].setCaretPosition(len); |
129 |
try { |
130 |
SourceUtils.waitScanFinished(); |
131 |
} catch (InterruptedException ex) { |
132 |
fail("No interrupts please"); |
133 |
} |
134 |
|
135 |
FileObject fo = Utilities.actionsGlobalContext().lookup(FileObject.class); |
136 |
assertNotNull("File object found", fo); |
137 |
assertEquals("Correct name", "TestClassForCopyPaste.java", fo.getNameExt()); |
138 |
File dir = FileUtil.toFile(fo.getParent()); |
139 |
assertNotNull("Directory is backed by java.io.File", dir); |
140 |
|
141 |
AtomicLong l = new AtomicLong(); |
142 |
new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_ENTER, 0)).perform(editorOperator2); |
143 |
CountingSecurityManager.initialize(dir.getPath()); |
144 |
new ActionNoBlock(null, null, new Shortcut(KeyEvent.VK_ENTER, 0)).perform(editorOperator2); |
145 |
CountingSecurityManager.assertCounts("No files touched", 0, l); |
113 |
} |
146 |
} |
114 |
|
147 |
|
115 |
public ComponentOperator open(){ |
148 |
public ComponentOperator open(){ |