Skip to content

Commit a3a8f58

Browse files
committed
Use text blocks in ExpandableCompositeTest
1 parent 061cb1c commit a3a8f58

File tree

1 file changed

+67
-71
lines changed

1 file changed

+67
-71
lines changed
Lines changed: 67 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2011 Google, Inc.
2+
* Copyright (c) 2011, 2025 Google, Inc. and others.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License 2.0 which is available at
@@ -27,14 +27,13 @@
2727
public class ExpandableCompositeTest extends AbstractFormsTest {
2828
@Test
2929
public void test_properties() throws Exception {
30-
CompositeInfo shell =
31-
parseComposite(
32-
"public class Test extends Shell {",
33-
" public Test() {",
34-
" setLayout(new RowLayout());",
35-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER, ExpandableComposite.TREE_NODE);",
36-
" }",
37-
"}");
30+
CompositeInfo shell = parseComposite("""
31+
public class Test extends Shell {
32+
public Test() {
33+
setLayout(new RowLayout());
34+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER, ExpandableComposite.TREE_NODE);
35+
}
36+
}""");
3837
shell.refresh();
3938
ExpandableCompositeInfo composite =
4039
(ExpandableCompositeInfo) shell.getChildrenControls().get(0);
@@ -49,31 +48,30 @@ public void test_properties() throws Exception {
4948
*/
5049
@Test
5150
public void test_CREATE_setTextClient() throws Exception {
52-
CompositeInfo shell =
53-
parseComposite(
54-
"public class Test extends Shell {",
55-
" public Test() {",
56-
" setLayout(new RowLayout());",
57-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
58-
" }",
59-
"}");
51+
CompositeInfo shell = parseComposite("""
52+
public class Test extends Shell {
53+
public Test() {
54+
setLayout(new RowLayout());
55+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
56+
}
57+
}""");
6058
shell.refresh();
6159
ExpandableCompositeInfo composite =
6260
(ExpandableCompositeInfo) shell.getChildrenControls().get(0);
6361
// when
6462
ControlInfo button = BTestUtils.createButton();
6563
composite.command_CREATE(button, "setTextClient");
66-
assertEditor(
67-
"public class Test extends Shell {",
68-
" public Test() {",
69-
" setLayout(new RowLayout());",
70-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
71-
" {",
72-
" Button button = new Button(composite, SWT.NONE);",
73-
" composite.setTextClient(button);",
74-
" }",
75-
" }",
76-
"}");
64+
assertEditor("""
65+
public class Test extends Shell {
66+
public Test() {
67+
setLayout(new RowLayout());
68+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
69+
{
70+
Button button = new Button(composite, SWT.NONE);
71+
composite.setTextClient(button);
72+
}
73+
}
74+
}""");
7775
}
7876

7977
/**
@@ -83,32 +81,31 @@ public void test_CREATE_setTextClient() throws Exception {
8381
*/
8482
@Test
8583
public void test_CREATE_setClient() throws Exception {
86-
CompositeInfo shell =
87-
parseComposite(
88-
"public class Test extends Shell {",
89-
" public Test() {",
90-
" setLayout(new RowLayout());",
91-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
92-
" }",
93-
"}");
84+
CompositeInfo shell = parseComposite("""
85+
public class Test extends Shell {
86+
public Test() {
87+
setLayout(new RowLayout());
88+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
89+
}
90+
}""");
9491
shell.refresh();
9592
ExpandableCompositeInfo composite =
9693
(ExpandableCompositeInfo) shell.getChildrenControls().get(0);
9794
// when
9895
ControlInfo button = BTestUtils.createButton();
9996
composite.command_CREATE(button, "setClient");
100-
assertEditor(
101-
"public class Test extends Shell {",
102-
" public Test() {",
103-
" setLayout(new RowLayout());",
104-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
105-
" composite.setExpanded(true);",
106-
" {",
107-
" Button button = new Button(composite, SWT.NONE);",
108-
" composite.setClient(button);",
109-
" }",
110-
" }",
111-
"}");
97+
assertEditor("""
98+
public class Test extends Shell {
99+
public Test() {
100+
setLayout(new RowLayout());
101+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
102+
composite.setExpanded(true);
103+
{
104+
Button button = new Button(composite, SWT.NONE);
105+
composite.setClient(button);
106+
}
107+
}
108+
}""");
112109
}
113110

114111
/**
@@ -118,34 +115,33 @@ public void test_CREATE_setClient() throws Exception {
118115
*/
119116
@Test
120117
public void test_MOVE_setClient() throws Exception {
121-
CompositeInfo shell =
122-
parseComposite(
123-
"public class Test extends Shell {",
124-
" public Test() {",
125-
" setLayout(new RowLayout());",
126-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
127-
" {",
128-
" Button button = new Button(this, SWT.NONE);",
129-
" }",
130-
" }",
131-
"}");
118+
CompositeInfo shell = parseComposite("""
119+
public class Test extends Shell {
120+
public Test() {
121+
setLayout(new RowLayout());
122+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
123+
{
124+
Button button = new Button(this, SWT.NONE);
125+
}
126+
}
127+
}""");
132128
shell.refresh();
133129
ExpandableCompositeInfo composite =
134130
(ExpandableCompositeInfo) shell.getChildrenControls().get(0);
135131
ControlInfo button = shell.getChildrenControls().get(1);
136132
// when
137133
composite.command_MOVE(button, "setClient");
138-
assertEditor(
139-
"public class Test extends Shell {",
140-
" public Test() {",
141-
" setLayout(new RowLayout());",
142-
" ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);",
143-
" composite.setExpanded(true);",
144-
" {",
145-
" Button button = new Button(composite, SWT.NONE);",
146-
" composite.setClient(button);",
147-
" }",
148-
" }",
149-
"}");
134+
assertEditor("""
135+
public class Test extends Shell {
136+
public Test() {
137+
setLayout(new RowLayout());
138+
ExpandableComposite composite = new ExpandableComposite(this, SWT.BORDER);
139+
composite.setExpanded(true);
140+
{
141+
Button button = new Button(composite, SWT.NONE);
142+
composite.setClient(button);
143+
}
144+
}
145+
}""");
150146
}
151147
}

0 commit comments

Comments
 (0)