001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.wicket.markup;
018:
019: import java.util.Locale;
020:
021: import org.apache.wicket.Request;
022: import org.apache.wicket.Response;
023: import org.apache.wicket.Session;
024: import org.apache.wicket.WicketTestCase;
025: import org.apache.wicket.protocol.http.WebApplication;
026: import org.apache.wicket.util.tester.WicketTester;
027: import org.apache.wicket.util.tester.WicketTester.DummyWebApplication;
028:
029: /**
030: * Simple application that demonstrates the mock http application code (and
031: * checks that it is working)
032: *
033: * @author Chris Turner
034: */
035: public class ComponentCreateTagTest extends WicketTestCase {
036: /**
037: * Create the test.
038: *
039: * @param name
040: * The test name
041: */
042: public ComponentCreateTagTest(String name) {
043: super (name);
044: }
045:
046: /**
047: * Simple Label
048: *
049: * @throws Exception
050: */
051: public void testRenderHomePage_1() throws Exception {
052: tester.getApplication().getMarkupSettings().setStripWicketTags(
053: true);
054: executeTest(ComponentCreateTag_1.class,
055: "ComponentCreateTagExpectedResult_1.html");
056: }
057:
058: /**
059: * A Table with X rows and a label inside
060: *
061: * @throws Exception
062: */
063: public void testRenderHomePage_2() throws Exception {
064: tester.getApplication().getMarkupSettings().setStripWicketTags(
065: true);
066: executeTest(ComponentCreateTag_2.class,
067: "ComponentCreateTagExpectedResult_2.html");
068: }
069:
070: /**
071: * A Border
072: *
073: * @throws Exception
074: */
075: public void testRenderHomePage_3() throws Exception {
076: tester.getApplication().getMarkupSettings().setStripWicketTags(
077: true);
078: executeTest(ComponentCreateTag_3.class,
079: "ComponentCreateTagExpectedResult_3.html");
080: }
081:
082: /**
083: * A Border inside another Border (nested <wicket:components>)
084: *
085: * @throws Exception
086: */
087: public void testRenderHomePage_4() throws Exception {
088: tester.getApplication().getMarkupSettings().setStripWicketTags(
089: true);
090: executeTest(ComponentCreateTag_4.class,
091: "ComponentCreateTagExpectedResult_4.html");
092: }
093:
094: /**
095: *
096: *
097: * @throws Exception
098: */
099: public void testRenderHomePage_6() throws Exception {
100: WebApplication myApplication = new DummyWebApplication() {
101: /**
102: * @see org.apache.wicket.protocol.http.WebApplication#newSession(org.apache.wicket.Request, org.apache.wicket.Response)
103: */
104: public Session newSession(Request request, Response response) {
105: Session session = super .newSession(request, response);
106: session.setLocale(Locale.ENGLISH);
107: return session;
108: }
109: };
110:
111: tester = new WicketTester(myApplication);
112:
113: tester.getApplication().getMarkupSettings().setStripWicketTags(
114: true);
115: executeTest(ComponentCreateTag_6.class,
116: "ComponentCreateTagExpectedResult_6.html");
117: }
118: }
|