Author: jdonnerstag Date: Sun Jun 3 09:18:27 2007 New Revision: 543933 URL: http://svn.apache.org/viewvc?view=rev&rev=543933 Log: Added junit test for localized images
Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_da_DK.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_de_DE.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_en_CA.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_nl_NL.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_zh_CN.gif (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java (with props) incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java (with props) Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_da_DK.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_da_DK.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_da_DK.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_de_DE.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_de_DE.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_de_DE.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_en_CA.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_en_CA.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_en_CA.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_nl_NL.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_nl_NL.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_nl_NL.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_zh_CN.gif URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_zh_CN.gif?view=auto&rev=543933 ============================================================================== Binary file - no diff available. Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Beer_zh_CN.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html?view=auto&rev=543933 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html (added) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html Sun Jun 3 09:18:27 2007 @@ -0,0 +1,22 @@ +<html xmlns:wicket="http://wicket.apache.org/"> +<head> + <title>Wicket Examples - pub</title> + <link rel="stylesheet" type="text/css" href="style.css"/> +</head> +<body> + <p> + This is tooootally the best beer you can get for under a buck. + </p> + <p> + <img wicket:id = "beer" src = "Beer.gif"/> + </p> + <p> + <a href="#" wicket:id="goCanadian">[go Canadian]</a> + <a href="#" wicket:id="goUS">[go US]</a> + <a href="#" wicket:id="goDutch">[go Dutch]</a> + <a href="#" wicket:id="goGerman">[go German]</a> + <a href="#" wicket:id="goChinese">[go Chinese]</a> + <a href="#" wicket:id="goDanish">[go Danish]</a> + </p> +</body> +</html> Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.html ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java?view=auto&rev=543933 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java (added) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java Sun Jun 3 09:18:27 2007 @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.image; + +import java.util.Locale; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.link.Link; + + +/** + * Demonstrates localization. + * + * @author Jonathan Locke + * @author Eelco Hillenius + */ +public final class Home extends WebPage +{ + private static final long serialVersionUID = 1L; + + /** + * Constructor + * + * @param parameters + * Page parameters (ignored since this is the home page) + */ + public Home(final PageParameters parameters) + { + add(new Image("beer")); + + // Add a couple of links to be able to play around with the session + // locale + add(new Link("goCanadian") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(Locale.CANADA); + } + }); + add(new Link("goUS") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(Locale.US); + } + }); + add(new Link("goDutch") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(new Locale("nl", "NL")); + } + }); + add(new Link("goGerman") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(new Locale("de", "DE")); + } + }); + add(new Link("goChinese") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(new Locale("zh", "CN")); + } + }); + add(new Link("goDanish") + { + private static final long serialVersionUID = 1L; + + public void onClick() + { + getSession().setLocale(new Locale("da", "DK")); + } + }); + } +} Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/Home.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java?view=auto&rev=543933 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java (added) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java Sun Jun 3 09:18:27 2007 @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.image; + +import org.apache.wicket.WicketTestCase; + +/** + * @author Juergen Donnerstag + */ +public class ImageTest extends WicketTestCase +{ + /** + * Construct. + * @param name + */ + public ImageTest(String name) + { + super(name); + } + + /** + * + * @throws Exception + */ + public void test_1() throws Exception + { + tester.startPage(Home.class); + + tester.clickLink("goCanadian"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_en_CA.gif\""); + + tester.clickLink("goChinese"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_zh_CN.gif\""); + + tester.clickLink("goDanish"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_da_DK.gif\""); + + tester.clickLink("goDutch"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_nl_NL.gif\""); + + tester.clickLink("goGerman"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_de_DE.gif\""); + + tester.clickLink("goUS"); + tester.startPage(Home.class); + tester.assertContains("src=\"resources/org.apache.wicket.markup.html.image.Home/Beer_en_US.gif\""); + } +} Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/ImageTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java?view=auto&rev=543933 ============================================================================== --- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java (added) +++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java Sun Jun 3 09:18:27 2007 @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.image; + +import org.apache.wicket.protocol.http.WebApplication; + +/** + * WicketServlet class for the linkomatic example. + * + * @author Jonathan Locke + */ +public class PubApplication extends WebApplication +{ + /** + * Constructor + */ + public PubApplication() + { + } + + /** + * @see org.apache.wicket.Application#getHomePage() + */ + public Class getHomePage() + { + return Home.class; + } + +} Propchange: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/markup/html/image/PubApplication.java ------------------------------------------------------------------------------ svn:eol-style = native