001: /*
002: * Copyright (c) 2002-2003 by OpenSymphony
003: * All rights reserved.
004: */
005: package com.opensymphony.webwork.views.jsp.ui;
006:
007: import java.util.Locale;
008:
009: import com.opensymphony.webwork.views.jsp.AbstractUITagTest;
010: import com.opensymphony.xwork.ActionContext;
011:
012: /**
013: * RichTextEditor test case.
014: *
015: * @author tm_jee
016: * @version $Date: 2006-02-25 12:30:39 +0100 (Sat, 25 Feb 2006) $ $Id: RichTextEditorTagTest.java 2263 2006-02-25 11:30:39Z rgielen $
017: */
018: public class RichTextEditorTagTest extends AbstractUITagTest {
019:
020: public void testBasic() throws Exception {
021: RichTextEditorTag tag = new RichTextEditorTag();
022: tag.setPageContext(pageContext);
023: tag.setLabel("myLabel");
024: tag.setId("myId");
025: tag.setName("myName");
026: tag.setDefaultLanguage("en");
027:
028: tag.doStartTag();
029: tag.doEndTag();
030:
031: verify(RichTextEditorTagTest.class
032: .getResource("richtexteditor-1.txt"));
033: }
034:
035: public void testWithSomeAttributeSet() throws Exception {
036: RichTextEditorTag tag = new RichTextEditorTag();
037: tag.setPageContext(pageContext);
038: tag.setLabel("myLabel");
039: tag.setId("myId");
040: tag.setName("myName");
041: tag.setBasePath("/some/base/path/");
042: tag.setWidth("100%");
043: tag.setHeight("100%");
044: tag.setToolbarSet("MyToolBarSet");
045: tag.setCheckBrowser("true");
046: tag.setDisplayError("true");
047: tag.setValue("some text to be displayed");
048: tag.setCustomConfigurationsPath("myCustom/Configuration/Path");
049: tag.setEditorAreaCSS("/some/editor/area/css");
050: tag.setBaseHref("/base/href");
051: tag.setSkinPath("/skin/path");
052: tag.setPluginsPath("/plugins/path");
053: tag.setFullPage("true");
054: tag.setDebug("true");
055: tag.setAutoDetectLanguage("true");
056: tag.setDefaultLanguage("en");
057: tag.setContentLangDirection("ltr");
058: tag.setEnableXHTML("true");
059: tag.setEnableSourceXHTML("true");
060: tag.setFillEmptyBlocks("true");
061: tag.setFormatSource("true");
062: tag.setFormatOutput("true");
063: tag.setFormatIndentator("\\t\\t");
064: tag.setGeckoUseSPAN("true");
065: tag.setStartupFocus("false");
066: tag.setForcePasteAsPlainText("true");
067: tag.setForceSimpleAmpersand("true");
068: tag.setTabSpaces("\\t");
069: tag.setUseBROnCarriageReturn("true");
070: tag.setToolbarStartExpanded("true");
071: tag.setToolbarCanCollapse("true");
072: tag.setFontNames("Arial;Comic Sans MS");
073: tag.setFontColors("000000,993300,333300");
074: tag.setFontSizes("1/xx-small;2/x-small");
075: tag.setFontFormats("p;div;pre;address");
076: tag.setStylesXmlPath("/styles/xml/path");
077: tag.setTemplatesXmlPath("/templates/xml/path");
078: tag.setLinkBrowserURL("/link/browser/url");
079: tag.setImageBrowserURL("/image/browser/url");
080: tag.setFlashBrowserURL("/flash/browser/url");
081: tag.setLinkUploadURL("/link/upload/url");
082: tag.setImageUploadURL("/image/upload/url");
083: tag.setFlashUploadURL("/flash/upload/url");
084: tag.setAllowImageBrowse("true");
085: tag.setAllowLinkBrowse("true");
086: tag.setAllowFlashBrowse("true");
087: tag.setAllowImageUpload("false");
088: tag.setAllowLinkUpload("false");
089: tag.setAllowFlashUpload("false");
090: tag.setLinkUploadAllowedExtension("*.*");
091: tag.setLinkUploadDeniedExtension("*.*");
092: tag.setImageUploadAllowedExtension(".(jpg|gif|jpeg|png)$");
093: tag.setImageUploadDeniedExtension(".(jpg|gif|jpeg|png)$");
094: tag.setFlashUploadAllowedExtension(".(swf|fla)$");
095: tag.setFlashUploadDeniedExtension(".(swf|fla)$");
096: tag.setSmileyPath("/smiley/path");
097: tag.setSmileyImages("['regular_smile.gif','sad_smile.gif']");
098:
099: tag.doStartTag();
100: tag.doEndTag();
101:
102: verify(RichTextEditorTagTest.class
103: .getResource("richtexteditor-2.txt"));
104: }
105:
106: public void testWithSomeAttributeSetFromStack() throws Exception {
107: stack.getContext().put("mySomeText",
108: "This Is Some Text From The Stack");
109: RichTextEditorTag tag = new RichTextEditorTag();
110: tag.setPageContext(pageContext);
111: tag.setLabel("myLabel");
112: tag.setId("myId");
113: tag.setName("myName");
114: tag.setBasePath("/some/base/path/");
115: tag.setWidth("100%");
116: tag.setHeight("100%");
117: tag.setToolbarSet("MyToolBarSet");
118: tag.setCheckBrowser("true");
119: tag.setDisplayError("true");
120: tag.setValue("%{#mySomeText}");
121: tag.setDefaultLanguage("en");
122:
123: tag.doStartTag();
124: tag.doEndTag();
125:
126: verify(RichTextEditorTagTest.class
127: .getResource("richtexteditor-3.txt"));
128: }
129:
130: public void testChangeLocale() throws Exception {
131: ActionContext.getContext().setLocale(Locale.FRENCH);
132:
133: RichTextEditorTag tag = new RichTextEditorTag();
134: tag.setPageContext(pageContext);
135: tag.setLabel("myLabel");
136: tag.setId("myId");
137: tag.setName("myName");
138:
139: tag.doStartTag();
140: tag.doEndTag();
141:
142: verify(RichTextEditorTagTest.class
143: .getResource("richtexteditor-4.txt"));
144: }
145: }
|