use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WFigureRenderer_Test method testRenderedWithMargins.
@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
WFigure figure = new WFigure(new WText(FIGURE_CONTENT), FIGURE_HEADING);
assertXpathNotExists("//ui:figure/ui:margin", figure);
Margin margin = new Margin(null);
figure.setMargin(margin);
assertXpathNotExists("//ui:figure/ui:margin", figure);
margin = new Margin(Size.SMALL);
figure.setMargin(margin);
assertSchemaMatch(figure);
assertXpathEvaluatesTo("sm", "//ui:figure/ui:margin/@all", figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:margin/@north", figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:margin/@east", figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:margin/@south", figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:margin/@west", figure);
margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
figure.setMargin(margin);
assertSchemaMatch(figure);
assertXpathEvaluatesTo("", "//ui:figure/ui:margin/@all", figure);
assertXpathEvaluatesTo("sm", "//ui:figure/ui:margin/@north", figure);
assertXpathEvaluatesTo("med", "//ui:figure/ui:margin/@east", figure);
assertXpathEvaluatesTo("lg", "//ui:figure/ui:margin/@south", figure);
assertXpathEvaluatesTo("xl", "//ui:figure/ui:margin/@west", figure);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WHeadingRenderer_Test method testPaintWithDecoratedLabel.
@Test
public void testPaintWithDecoratedLabel() throws IOException, SAXException, XpathException {
final String text1 = "WHeading_Test.testPaintWithDecoratedLabel.text1";
final String text2 = "WHeading_Test.testPaintWithDecoratedLabel.text2";
WHeading heading = new WHeading(HeadingLevel.H1, new WDecoratedLabel(new WText(text1)));
assertSchemaMatch(heading);
assertXpathEvaluatesTo(text1, "//ui:heading[@level=1]/ui:decoratedlabel/ui:labelbody/text()", heading);
// Test WHeading's WText implementation
heading.setText(text2);
assertXpathEvaluatesTo(text2 + text1, "//ui:heading[@level=1]/ui:decoratedlabel/ui:labelbody/text()", heading);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WListRenderer_Test method testRenderedFormatNoBorder.
@Test
public void testRenderedFormatNoBorder() throws IOException, SAXException {
// non-empty list, no border
WList list = new WList(WList.Type.STRIPED);
list.setRepeatedComponent(new WText());
setActiveContext(createUIContext());
list.setData(Arrays.asList(new String[] { "row1", "row2", "row3" }));
assertSchemaMatch(list);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WTabGroupRenderer_Test method testDoPaint.
@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
String groupName = "WTabGroupRenderer_Test.testDoPaint.groupName";
WTabGroup tabGroup = new WTabGroup(groupName);
WComponent wrapped = wrapTabGroup(tabGroup);
assertXpathNotExists("//ui:tab", wrapped);
tabGroup.addTab(new WText("dummy"), "dummy", TabMode.CLIENT);
assertXpathExists("//ui:tab", wrapped);
assertSchemaMatch(wrapped);
}
use of com.github.bordertech.wcomponents.WText in project wcomponents by BorderTech.
the class WTableRenderer_Test method createTableWithColumnFooters.
/**
* @return a table setup with column footers
*/
private WTable createTableWithColumnFooters() {
WTable table = new WTable();
table.addColumn(new WTableColumn(COL1_HEADING_TEST, WTextField.class, new WText("FOOTER1")));
table.addColumn(new WTableColumn(COL2_HEADING_TEST, WTextField.class));
table.addColumn(new WTableColumn(COL3_HEADING_TEST, WTextField.class, new WText("FOOTER3")));
// Turn on column footers
table.setRenderColumnFooters(true);
TableModel tableModel = createTableModel();
table.setTableModel(tableModel);
return table;
}
Aggregations