2
* $Header: /home/cvs/jakarta-struts/src/test/org/apache/struts/taglib/html/TestImageTag1.java,v 1.9 2004/03/14 06:23:41 sraeburn Exp $
4
* $Date: 2004/03/14 06:23:41 $
6
* Copyright 1999-2004 The Apache Software Foundation.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
12
* http://www.apache.org/licenses/LICENSE-2.0
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
20
package org.apache.struts.taglib.html;
22
import java.util.Locale;
24
import javax.servlet.jsp.PageContext;
26
import junit.framework.Test;
27
import junit.framework.TestSuite;
29
import org.apache.cactus.JspTestCase;
30
import org.apache.struts.Globals;
31
import org.apache.struts.taglib.SimpleBeanForTesting;
34
* Suite of unit tests for the
35
* <code>org.apache.struts.taglib.html.ImageTag</code> class.
38
public class TestImageTag1 extends JspTestCase {
41
* Defines the testcase name for JUnit.
43
* @param theName the testcase's name.
45
public TestImageTag1(String theName) {
52
* @param theArgs the arguments. Not used
54
public static void main(String[] theArgs) {
55
junit.awtui.TestRunner.main(new String[] {TestImageTag1.class.getName()});
59
* @return a test suite (<code>TestSuite</code>) that includes all methods
60
* starting with "test"
62
public static Test suite() {
63
// All methods starting with "test" will be executed in the test suite.
64
return new TestSuite(TestImageTag1.class);
67
private void runMyTest(String whichTest, String locale) throws Exception {
68
pageContext.setAttribute(Globals.LOCALE_KEY, new Locale(locale, locale), PageContext.SESSION_SCOPE);
69
pageContext.setAttribute(Constants.BEAN_KEY, new SimpleBeanForTesting("Test Value"), PageContext.REQUEST_SCOPE);
70
request.setAttribute("runTest", whichTest);
71
pageContext.forward("/test/org/apache/struts/taglib/html/TestImageTag1.jsp");
78
//--------Testing attributes using page------
80
public void testImagePageAccesskey() throws Exception {
81
runMyTest("testImagePageAccesskey", "");
84
public void testImagePageAlign() throws Exception {
85
runMyTest("testImagePageAlign", "");
88
public void testImagePageAlt() throws Exception {
89
runMyTest("testImagePageAlt", "");
92
public void testImagePageAltKeyDefaultBundle() throws Exception {
93
runMyTest("testImagePageAltKeyDefaultBundle", "");
96
public void testImagePageAltKeyAlternateBundle() throws Exception {
97
runMyTest("testImagePageAltKeyAlternateBundle", "");
100
public void testImagePageAltKeyDefaultBundle_fr() throws Exception {
101
runMyTest("testImagePageAltKeyDefaultBundle_fr", "fr");
104
public void testImagePageAltKeyAlternateBundle_fr() throws Exception {
105
runMyTest("testImagePageAltKeyAlternateBundle_fr", "fr");
108
public void testImagePageBorder() throws Exception {
109
runMyTest("testImagePageBorder", "");
112
public void testImagePageDisabled1() throws Exception {
113
runMyTest("testImagePageDisabled1", "");
116
public void testImagePageDisabled2() throws Exception {
117
runMyTest("testImagePageDisabled2", "");
120
public void testImagePageDisabled3() throws Exception {
121
runMyTest("testImagePageDisabled3", "");
124
public void testImagePageDisabled4() throws Exception {
125
runMyTest("testImagePageDisabled4", "");
128
public void testImagePageDisabled5() throws Exception {
129
runMyTest("testImagePageDisabled5", "");
132
public void testImagePageDisabled6() throws Exception {
133
runMyTest("testImagePageDisabled6", "");
136
public void testImagePageLocale() throws Exception {
137
pageContext.setAttribute("secret locale", new Locale("fr", "fr"), PageContext.SESSION_SCOPE);
138
runMyTest("testImagePageLocale", "");
141
public void testImagePageOnblur() throws Exception {
142
runMyTest("testImagePageOnblur", "");
145
public void testImagePageOnchange() throws Exception {
146
runMyTest("testImagePageOnchange", "");
149
public void testImagePageOnclick() throws Exception {
150
runMyTest("testImagePageOnclick", "");
153
public void testImagePageOndblclick() throws Exception {
154
runMyTest("testImagePageOndblclick", "");
157
public void testImagePageOnfocus() throws Exception {
158
runMyTest("testImagePageOnfocus", "");
161
public void testImagePageOnkeydown() throws Exception {
162
runMyTest("testImagePageOnkeydown", "");
165
public void testImagePageOnkeypress() throws Exception {
166
runMyTest("testImagePageOnkeypress", "");
169
public void testImagePageOnkeyup() throws Exception {
170
runMyTest("testImagePageOnkeyup", "");