private void check_ANCHOR(boolean horizontal,
Anchor initialAnchor,
String initialDesc,
Anchor newAnchor,
String expectedDesc) throws Exception {
RootLayoutPanelInfo frame =
parseJavaInfo(
"public class Test implements EntryPoint {",
" public void onModuleLoad() {",
" RootLayoutPanel rootPanel = RootLayoutPanel.get();",
" {",
" Button button = new Button();",
" rootPanel.add(button);",
" " + getAnchorLine(initialDesc),
" }",
" }",
"}");
anchor_removeEmptyLine_inEditor();
frame.refresh();
WidgetInfo button = getJavaInfoByName("button");
// initial anchor
{
Anchor anchor = frame.getAnchor(button, horizontal);
assertSame(initialAnchor, anchor);
assertNotNull(anchor.getImage(horizontal));
assertNotNull(anchor.getSmallImage(horizontal));
}
// set new anchor
frame.command_ANCHOR(button, horizontal, newAnchor);
anchor_assertEditor(
"public class Test implements EntryPoint {",
" public void onModuleLoad() {",
" RootLayoutPanel rootPanel = RootLayoutPanel.get();",
" {",
" Button button = new Button();",
" rootPanel.add(button);",
" " + getAnchorLine(expectedDesc),
" }",
" }",
"}");
{
Anchor anchor = frame.getAnchor(button, horizontal);
assertSame(newAnchor, anchor);
}
}