Search in sources :

Example 16 with UIContextImpl

use of com.github.bordertech.wcomponents.UIContextImpl in project wcomponents by BorderTech.

the class WDropdownRenderer_Test method testCrtEntryExpiration.

@Test
public void testCrtEntryExpiration() throws IOException, SAXException, XpathException {
    UIContext uic1 = new UIContextImpl();
    UIContext uic2 = new UIContextImpl() {

        @Override
        public long getCreationTime() {
            // 01 jan 1970 - should have no options
            return 0;
        }
    };
    // Test getOptions accessor
    WDropdown drop = new WDropdown(TestLookupTable.YesNoTable.class);
    // Test rendered format
    setActiveContext(uic1);
    assertSchemaMatch(drop);
    assertXpathEvaluatesTo("2", "count(//ui:dropdown/ui:option)", drop);
    setActiveContext(uic2);
    assertSchemaMatch(drop);
    assertXpathEvaluatesTo("0", "count(//ui:dropdown/ui:option)", drop);
}
Also used : WDropdown(com.github.bordertech.wcomponents.WDropdown) TestLookupTable(com.github.bordertech.wcomponents.TestLookupTable) UIContext(com.github.bordertech.wcomponents.UIContext) UIContextImpl(com.github.bordertech.wcomponents.UIContextImpl) Test(org.junit.Test)

Example 17 with UIContextImpl

use of com.github.bordertech.wcomponents.UIContextImpl in project wcomponents by BorderTech.

the class UicStats_Test method setUp.

@Before
public void setUp() {
    UIContext uic;
    uic = new UIContextImpl();
    setActiveContext(uic);
    app = new WApplication();
    button = new WButton("PUSH");
    app.add(button);
    label = new WLabel("HERE");
    app.add(label);
    uic.setUI(app);
    stats = new UicStats(uic);
}
Also used : UIContext(com.github.bordertech.wcomponents.UIContext) WApplication(com.github.bordertech.wcomponents.WApplication) UIContextImpl(com.github.bordertech.wcomponents.UIContextImpl) WButton(com.github.bordertech.wcomponents.WButton) WLabel(com.github.bordertech.wcomponents.WLabel) Before(org.junit.Before)

Aggregations

UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)17 UIContext (com.github.bordertech.wcomponents.UIContext)11 Test (org.junit.Test)7 Before (org.junit.Before)6 WLabel (com.github.bordertech.wcomponents.WLabel)5 WTextField (com.github.bordertech.wcomponents.WTextField)4 PrintWriter (java.io.PrintWriter)4 WApplication (com.github.bordertech.wcomponents.WApplication)3 WButton (com.github.bordertech.wcomponents.WButton)3 MockWEnvironment (com.github.bordertech.wcomponents.MockWEnvironment)2 RenderContext (com.github.bordertech.wcomponents.RenderContext)2 WText (com.github.bordertech.wcomponents.WText)2 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)2 NullWriter (com.github.bordertech.wcomponents.util.NullWriter)2 SystemException (com.github.bordertech.wcomponents.util.SystemException)2 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)2 IOException (java.io.IOException)2 StringWriter (java.io.StringWriter)2 FatalErrorPage (com.github.bordertech.wcomponents.FatalErrorPage)1 TestLookupTable (com.github.bordertech.wcomponents.TestLookupTable)1