author | coleenp |
Wed, 15 Nov 2017 08:14:31 -0500 | |
changeset 47894 | 352b17f62ff7 |
parent 47216 | 71c04702a3d5 |
child 48275 | b2190c70a1ac |
permissions | -rw-r--r-- |
44570 | 1 |
/* |
2 |
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/** |
|
25 |
* @test |
|
26 |
* @bug 8178077 |
|
27 |
* @summary Check the UI behavior of editing history. |
|
28 |
* @modules |
|
29 |
* jdk.compiler/com.sun.tools.javac.api |
|
30 |
* jdk.compiler/com.sun.tools.javac.main |
|
44811
32c15978a3af
8178035: MergedTabShiftTabTest sometimes time outs
jlahoda
parents:
44570
diff
changeset
|
31 |
* jdk.jshell/jdk.internal.jshell.tool.resources:open |
44570 | 32 |
* jdk.jshell/jdk.jshell:open |
33 |
* @library /tools/lib |
|
34 |
* @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask |
|
35 |
* @build Compiler UITesting |
|
36 |
* @build HistoryUITest |
|
37 |
* @run testng HistoryUITest |
|
38 |
*/ |
|
39 |
||
40 |
import org.testng.annotations.Test; |
|
41 |
||
42 |
@Test |
|
43 |
public class HistoryUITest extends UITesting { |
|
44 |
||
45 |
public void testPrevNextSnippet() throws Exception { |
|
46 |
doRunTest((inputSink, out) -> { |
|
47 |
inputSink.write("void test1() {\nSystem.err.println(1);\n}\n"); |
|
48 |
waitOutput(out, "\u0005"); |
|
49 |
inputSink.write("void test2() {\nSystem.err.println(2);\n}\n"); |
|
50 |
waitOutput(out, "\u0005"); |
|
51 |
inputSink.write(CTRL_UP); |
|
52 |
waitOutput(out, "^void test2\\(\\) \\{"); |
|
53 |
inputSink.write(CTRL_UP); |
|
54 |
waitOutput(out, "^" + clearOut("2() {") + "1\\(\\) \\{"); |
|
55 |
inputSink.write(CTRL_DOWN); |
|
56 |
waitOutput(out, "^" + clearOut("1() {") + "2\\(\\) \\{"); |
|
57 |
inputSink.write(ENTER); |
|
58 |
waitOutput(out, "^\n\u0006"); |
|
59 |
inputSink.write(UP); |
|
60 |
waitOutput(out, "^}"); |
|
61 |
inputSink.write(UP); |
|
62 |
waitOutput(out, "^" + clearOut("}") + "System.err.println\\(2\\);"); |
|
63 |
inputSink.write(UP); |
|
64 |
waitOutput(out, "^" + clearOut("System.err.println(2);") + "void test2\\(\\) \\{"); |
|
65 |
inputSink.write(UP); |
|
66 |
waitOutput(out, "^\u0007"); |
|
67 |
inputSink.write(DOWN); |
|
68 |
waitOutput(out, "^" + clearOut("void test2() {") + "System.err.println\\(2\\);"); |
|
69 |
inputSink.write(DOWN); |
|
70 |
waitOutput(out, "^" + clearOut("System.err.println(2);") + "}"); |
|
71 |
inputSink.write(DOWN); |
|
72 |
waitOutput(out, "^" + clearOut("}")); |
|
73 |
inputSink.write(DOWN); |
|
74 |
waitOutput(out, "^\u0007"); |
|
75 |
}); |
|
76 |
} |
|
77 |
//where: |
|
78 |
private static final String CTRL_UP = "\033[1;5A"; |
|
79 |
private static final String CTRL_DOWN = "\033[1;5B"; |
|
80 |
private static final String UP = "\033[A"; |
|
81 |
private static final String DOWN = "\033[B"; |
|
82 |
private static final String ENTER = "\n"; |
|
83 |
||
84 |
} |