use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.
the class WListRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WList list = new WList(WList.Type.STRIPED);
list.setRepeatedComponent(new WText());
assertXpathNotExists("//ui:panel/ui:margin", list);
Margin margin = new Margin(0);
list.setMargin(margin);
assertXpathNotExists("//ui:panel/ui:margin", list);
margin = new Margin(Size.SMALL);
list.setMargin(margin);
assertSchemaMatch(list);
assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@all", list);
assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@north", list);
assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@east", list);
assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@south", list);
assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@west", list);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
list.setMargin(margin);
assertSchemaMatch(list);
assertXpathEvaluatesTo("", "//ui:panel/ui:margin/@all", list);
assertXpathEvaluatesTo("sm", "//ui:panel/ui:margin/@north", list);
assertXpathEvaluatesTo("med", "//ui:panel/ui:margin/@east", list);
assertXpathEvaluatesTo("lg", "//ui:panel/ui:margin/@south", list);
assertXpathEvaluatesTo("xl", "//ui:panel/ui:margin/@west", list);
}
use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.
the class WRowRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WRow row = new WRow();
row.add(new WColumn(100));
assertXpathNotExists("//ui:row/ui:margin", row);
Margin margin = new Margin(0);
row.setMargin(margin);
assertXpathNotExists("//ui:row/ui:margin", row);
margin = new Margin(GAP);
row.setMargin(margin);
assertSchemaMatch(row);
assertXpathEvaluatesTo(GAP.toString(), "//ui:row/ui:margin/@all", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@north", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@east", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@south", row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@west", row);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
row.setMargin(margin);
assertSchemaMatch(row);
assertXpathEvaluatesTo("", "//ui:row/ui:margin/@all", row);
assertXpathEvaluatesTo(Size.SMALL.toString(), "//ui:row/ui:margin/@north", row);
assertXpathEvaluatesTo(Size.MEDIUM.toString(), "//ui:row/ui:margin/@east", row);
assertXpathEvaluatesTo(Size.LARGE.toString(), "//ui:row/ui:margin/@south", row);
assertXpathEvaluatesTo(Size.XL.toString(), "//ui:row/ui:margin/@west", row);
}
use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.
the class WSectionRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WSection section = new WSection("");
assertXpathNotExists("//ui:section/ui:margin", section);
Margin margin = new Margin(0);
section.setMargin(margin);
assertXpathNotExists("//ui:section/ui:margin", section);
margin = new Margin(Size.SMALL);
section.setMargin(margin);
assertSchemaMatch(section);
assertXpathEvaluatesTo("sm", "//ui:section/ui:margin/@all", section);
assertXpathEvaluatesTo("", "//ui:section/ui:margin/@north", section);
assertXpathEvaluatesTo("", "//ui:section/ui:margin/@east", section);
assertXpathEvaluatesTo("", "//ui:section/ui:margin/@south", section);
assertXpathEvaluatesTo("", "//ui:section/ui:margin/@west", section);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
section.setMargin(margin);
assertSchemaMatch(section);
assertXpathEvaluatesTo("", "//ui:section/ui:margin/@all", section);
assertXpathEvaluatesTo("sm", "//ui:section/ui:margin/@north", section);
assertXpathEvaluatesTo("med", "//ui:section/ui:margin/@east", section);
assertXpathEvaluatesTo("lg", "//ui:section/ui:margin/@south", section);
assertXpathEvaluatesTo("xl", "//ui:section/ui:margin/@west", section);
}
use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.
the class WCollapsibleRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.EAGER);
assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
Margin margin = new Margin(0);
collapsible.setMargin(margin);
assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
margin = new Margin(Size.SMALL);
collapsible.setMargin(margin);
assertSchemaMatch(collapsible);
assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@all", collapsible);
assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@north", collapsible);
assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@east", collapsible);
assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@south", collapsible);
assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@west", collapsible);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
collapsible.setMargin(margin);
assertSchemaMatch(collapsible);
assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@all", collapsible);
assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@north", collapsible);
assertXpathEvaluatesTo("med", "//ui:collapsible/ui:margin/@east", collapsible);
assertXpathEvaluatesTo("lg", "//ui:collapsible/ui:margin/@south", collapsible);
assertXpathEvaluatesTo("xl", "//ui:collapsible/ui:margin/@west", collapsible);
}
use of com.github.bordertech.wcomponents.Margin in project wcomponents by BorderTech.
the class WDefinitionListRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WDefinitionList section = new WDefinitionList();
assertXpathNotExists("//ui:definitionlist/ui:margin", section);
Margin margin = new Margin(0);
section.setMargin(margin);
assertXpathNotExists("//ui:definitionlist/ui:margin", section);
margin = new Margin(Size.SMALL);
section.setMargin(margin);
assertSchemaMatch(section);
assertXpathEvaluatesTo("sm", "//ui:definitionlist/ui:margin/@all", section);
assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@north", section);
assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@east", section);
assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@south", section);
assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@west", section);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
section.setMargin(margin);
assertSchemaMatch(section);
assertXpathEvaluatesTo("", "//ui:definitionlist/ui:margin/@all", section);
assertXpathEvaluatesTo("sm", "//ui:definitionlist/ui:margin/@north", section);
assertXpathEvaluatesTo("med", "//ui:definitionlist/ui:margin/@east", section);
assertXpathEvaluatesTo("lg", "//ui:definitionlist/ui:margin/@south", section);
assertXpathEvaluatesTo("xl", "//ui:definitionlist/ui:margin/@west", section);
}
Aggregations