use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class FlowLayoutRenderer_Test method testRenderAlignment.
@Test
public void testRenderAlignment() throws IOException, SAXException, XpathException {
WPanel panel = new WPanel();
String expected;
for (FlowLayout.Alignment a : FlowLayout.Alignment.values()) {
panel.setLayout(new FlowLayout(a));
assertSchemaMatch(panel);
assertXpathExists("//ui:panel/ui:flowlayout", panel);
expected = a.toString().toLowerCase();
assertXpathEvaluatesTo(expected, "//ui:panel/ui:flowlayout/@align", panel);
}
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class FlowLayoutRenderer_Test method testRenderGap.
@Test
public void testRenderGap() throws IOException, SAXException, XpathException {
WPanel panel = new WPanel();
for (FlowLayout.Alignment a : FlowLayout.Alignment.values()) {
panel.setLayout(new FlowLayout(a, GAP));
assertSchemaMatch(panel);
assertXpathEvaluatesTo(GAP.toString(), "//ui:panel/ui:flowlayout/@gap", panel);
}
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class GridLayoutRenderer_Test method testDoRenderWhenEmpty.
@Test
public void testDoRenderWhenEmpty() throws IOException, SAXException, XpathException {
WPanel panel = new WPanel();
panel.setLayout(new GridLayout(0, 1));
assertSchemaMatch(panel);
assertXpathExists("//ui:panel/ui:gridlayout", panel);
assertXpathNotExists("//ui:panel/ui:gridlayout/ui:cell", panel);
assertXpathEvaluatesTo("0", "//ui:panel/ui:gridlayout/@rows", panel);
assertXpathEvaluatesTo("1", "//ui:panel/ui:gridlayout/@cols", panel);
assertXpathNotExists("//ui:panel/ui:gridlayout/@hgap", panel);
assertXpathNotExists("//ui:panel/ui:gridlayout/@vgap", panel);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class GridLayoutRenderer_Test method testDoRender.
@Test
public void testDoRender() throws IOException, SAXException, XpathException {
final String text1 = "GridRenderer_Test.testPaint.text1";
final String text2 = "GridRenderer_Test.testPaint.text2";
WPanel panel = new WPanel();
panel.setLayout(new GridLayout(1, 2, GAP, BIG_GAP));
assertSchemaMatch(panel);
assertXpathEvaluatesTo("1", "//ui:panel/ui:gridlayout/@rows", panel);
assertXpathEvaluatesTo("2", "//ui:panel/ui:gridlayout/@cols", panel);
assertXpathEvaluatesTo(GAP.toString(), "//ui:panel/ui:gridlayout/@hgap", panel);
assertXpathEvaluatesTo(BIG_GAP.toString(), "//ui:panel/ui:gridlayout/@vgap", panel);
assertXpathNotExists("//ui:panel/ui:gridlayout/ui:cell", panel);
panel.add(new WText(text1));
panel.add(new WText(text2));
assertXpathEvaluatesTo("2", "count(//ui:panel/ui:gridlayout/ui:cell)", panel);
assertXpathEvaluatesTo(text1, "normalize-space(//ui:panel/ui:gridlayout/ui:cell[1])", panel);
assertXpathEvaluatesTo(text2, "normalize-space(//ui:panel/ui:gridlayout/ui:cell[2])", panel);
}
use of com.github.bordertech.wcomponents.WPanel in project wcomponents by BorderTech.
the class ListLayoutRenderer_Test method testDoRenderWhenEmpty.
@Test
public void testDoRenderWhenEmpty() throws IOException, SAXException, XpathException {
WPanel panel = new WPanel();
panel.setLayout(new ListLayout(ListLayout.Type.FLAT, ListLayout.Alignment.LEFT, ListLayout.Separator.NONE, false));
assertSchemaMatch(panel);
assertXpathExists("//ui:panel/ui:listlayout", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/ui:cell", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@gap", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@align", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@separator", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@ordered", panel);
assertXpathEvaluatesTo("flat", "//ui:panel/ui:listlayout/@type", panel);
panel.setLayout(new ListLayout(ListLayout.Type.STRIPED, ListLayout.Alignment.CENTER, ListLayout.Separator.NONE, false));
assertXpathEvaluatesTo("striped", "//ui:panel/ui:listlayout/@type", panel);
assertXpathEvaluatesTo("center", "//ui:panel/ui:listlayout/@align", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/ui:cell", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@gap", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@separator", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@ordered", panel);
panel.setLayout(new ListLayout(ListLayout.Type.STACKED, ListLayout.Alignment.RIGHT, ListLayout.Separator.NONE, false, GAP));
assertXpathEvaluatesTo("stacked", "//ui:panel/ui:listlayout/@type", panel);
assertXpathEvaluatesTo("right", "//ui:panel/ui:listlayout/@align", panel);
assertXpathEvaluatesTo(GAP.toString(), "//ui:panel/ui:listlayout/@gap", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/ui:cell", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@separator", panel);
assertXpathNotExists("//ui:panel/ui:listlayout/@ordered", panel);
}
Aggregations