Lines 19-24
Link Here
|
19 |
import org.eclipse.jdt.core.formatter.IndentManipulation; |
19 |
import org.eclipse.jdt.core.formatter.IndentManipulation; |
20 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter; |
20 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter; |
21 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions; |
21 |
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions; |
|
|
22 |
import org.eclipse.jdt.internal.formatter.align.Alignment; |
22 |
|
23 |
|
23 |
public class FormatterBugsTests extends FormatterRegressionTests { |
24 |
public class FormatterBugsTests extends FormatterRegressionTests { |
24 |
|
25 |
|
Lines 4018-4021
Link Here
|
4018 |
"}\n" |
4019 |
"}\n" |
4019 |
); |
4020 |
); |
4020 |
} |
4021 |
} |
|
|
4022 |
|
4023 |
/** |
4024 |
* @bug 302552: [Formatter] Wrap when necessary too aggressive on short qualifiers |
4025 |
* @test |
4026 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=302552" |
4027 |
*/ |
4028 |
public void testBug302552_LW0() { |
4029 |
this.formatterPrefs.page_width = 20; |
4030 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_NO_ALIGNMENT; |
4031 |
String source = |
4032 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4033 |
formatSource(source, |
4034 |
"class Sample2 {\n" + |
4035 |
" int foo(Some a) {\n" + |
4036 |
" return a.getFirst();\n" + |
4037 |
" }\n" + |
4038 |
"}\n" |
4039 |
); |
4040 |
} |
4041 |
public void testBug302552_LW1() { |
4042 |
this.formatterPrefs.page_width = 20; |
4043 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT; |
4044 |
String source = |
4045 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4046 |
formatSource(source, |
4047 |
"class Sample2 {\n" + |
4048 |
" int foo(Some a) {\n" + |
4049 |
" return a.getFirst();\n" + |
4050 |
" }\n" + |
4051 |
"}\n" |
4052 |
); |
4053 |
} |
4054 |
public void testBug302552_LW2() { |
4055 |
this.formatterPrefs.page_width = 20; |
4056 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_FIRST_BREAK_SPLIT; |
4057 |
String source = |
4058 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4059 |
formatSource(source, |
4060 |
"class Sample2 {\n" + |
4061 |
" int foo(Some a) {\n" + |
4062 |
" return a\n" + |
4063 |
" .getFirst();\n" + |
4064 |
" }\n" + |
4065 |
"}\n" |
4066 |
); |
4067 |
} |
4068 |
public void testBug302552_LW3() { |
4069 |
this.formatterPrefs.page_width = 20; |
4070 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_ONE_PER_LINE_SPLIT; |
4071 |
String source = |
4072 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4073 |
formatSource(source, |
4074 |
"class Sample2 {\n" + |
4075 |
" int foo(Some a) {\n" + |
4076 |
" return a\n" + |
4077 |
" .getFirst();\n" + |
4078 |
" }\n" + |
4079 |
"}\n" |
4080 |
); |
4081 |
} |
4082 |
public void testBug302552_LW4() { |
4083 |
this.formatterPrefs.page_width = 20; |
4084 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_NEXT_SHIFTED_SPLIT; |
4085 |
String source = |
4086 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4087 |
formatSource(source, |
4088 |
"class Sample2 {\n" + |
4089 |
" int foo(Some a) {\n" + |
4090 |
" return a\n" + |
4091 |
" .getFirst();\n" + |
4092 |
" }\n" + |
4093 |
"}\n" |
4094 |
); |
4095 |
} |
4096 |
public void testBug302552_LW5() { |
4097 |
this.formatterPrefs.page_width = 20; |
4098 |
this.formatterPrefs.alignment_for_selector_in_method_invocation = Alignment.M_NEXT_PER_LINE_SPLIT; |
4099 |
String source = |
4100 |
"class Sample2 {int foo(Some a) {return a.getFirst();}}\n"; |
4101 |
formatSource(source, |
4102 |
"class Sample2 {\n" + |
4103 |
" int foo(Some a) {\n" + |
4104 |
" return a.getFirst();\n" + |
4105 |
" }\n" + |
4106 |
"}\n" |
4107 |
); |
4108 |
} |
4109 |
|
4021 |
} |
4110 |
} |