22 * #%L
33 * XTerm Console Addon
44 * %%
5- * Copyright (C) 2020 - 2023 Flowing Code
5+ * Copyright (C) 2020 - 2026 Flowing Code
66 * %%
77 * Licensed under the Apache License, Version 2.0 (the "License");
88 * you may not use this file except in compliance with the License.
2929public class SelectionFeatureIT extends AbstractViewTest {
3030
3131 @ Test
32- public void testSelectionFeature () throws InterruptedException {
32+ public void testSelectionFeature1 () throws InterruptedException {
3333 XTermElement term = $ (XTermElement .class ).first ();
34- Position pos ;
3534
3635 term .write ("abcd" );
37- pos = term .cursorPosition ();
36+ Position pos = term .cursorPosition ();
3837
3938 // select left, backspace
4039 term .sendKeys (Keys .SHIFT , Keys .ARROW_LEFT );
@@ -69,9 +68,14 @@ public void testSelectionFeature() throws InterruptedException {
6968 term .sendKeys (Keys .BACK_SPACE );
7069 assertThat (term .currentLine (), isEmptyString ());
7170 assertThat (term .cursorPosition (), is (pos ));
71+ }
72+
73+ @ Test
74+ public void testSelectionFeature2 () throws InterruptedException {
75+ XTermElement term = $ (XTermElement .class ).first ();
7276
7377 term .write ("abcd" );
74- pos = term .cursorPosition ();
78+ Position pos = term .cursorPosition ();
7579
7680 // select to home, delete
7781 term .sendKeys (Keys .SHIFT , Keys .HOME );
@@ -80,9 +84,16 @@ public void testSelectionFeature() throws InterruptedException {
8084 term .sendKeys (Keys .DELETE );
8185 assertThat (term .currentLine (), isEmptyString ());
8286 assertThat (term .cursorPosition (), is (pos .advance (-4 , 0 )));
87+ }
88+
89+ @ Test
90+ public void testSelectionFeature3 () throws InterruptedException {
91+ XTermElement term = $ (XTermElement .class ).first ();
8392
84- // select to end, delete
8593 term .write ("abcd" );
94+ Position pos = term .cursorPosition ();
95+
96+ // select to end, delete
8697 term .sendKeys (Keys .HOME );
8798 pos = term .cursorPosition ();
8899 term .sendKeys (Keys .SHIFT , Keys .END );
@@ -91,7 +102,11 @@ public void testSelectionFeature() throws InterruptedException {
91102 term .sendKeys (Keys .DELETE );
92103 assertThat (term .currentLine (), isEmptyString ());
93104 assertThat (term .cursorPosition (), is (pos ));
105+ }
94106
107+ @ Test
108+ public void testSelectionFeature4 () throws InterruptedException {
109+ XTermElement term = $ (XTermElement .class ).first ();
95110 String text = makeFullLine (term , true ) + makeFullLine (term , false ) + makeFullLine (term , false );
96111
97112 // select to home, delete (wrapping)
@@ -101,7 +116,12 @@ public void testSelectionFeature() throws InterruptedException {
101116 assertThat (term .getSelection (), is (text ));
102117 term .sendKeys (Keys .DELETE );
103118 assertThat (term .currentLine (), isEmptyString ());
119+ }
104120
121+ @ Test
122+ public void testSelectionFeature5 () throws InterruptedException {
123+ XTermElement term = $ (XTermElement .class ).first ();
124+ String text = makeFullLine (term , true ) + makeFullLine (term , false ) + makeFullLine (term , false );
105125 // select to end, delete (wrapping)
106126 term .write (text );
107127 assertThat (term .currentLine (), is (text ));
@@ -110,7 +130,6 @@ public void testSelectionFeature() throws InterruptedException {
110130 assertThat (term .getSelection (), is (text ));
111131 term .sendKeys (Keys .DELETE );
112132 assertThat (term .currentLine (), isEmptyString ());
113-
114133 }
115134
116135}
0 commit comments