Source Code Cross Referenced for NullSetSVGDocumentTest.java in  » Graphic-Library » batik » org » apache » batik » swing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Graphic Library » batik » org.apache.batik.swing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Licensed to the Apache Software Foundation (ASF) under one or more
004:           contributor license agreements.  See the NOTICE file distributed with
005:           this work for additional information regarding copyright ownership.
006:           The ASF licenses this file to You under the Apache License, Version 2.0
007:           (the "License"); you may not use this file except in compliance with
008:           the License.  You may obtain a copy of the License at
009:
010:               http://www.apache.org/licenses/LICENSE-2.0
011:
012:           Unless required by applicable law or agreed to in writing, software
013:           distributed under the License is distributed on an "AS IS" BASIS,
014:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:           See the License for the specific language governing permissions and
016:           limitations under the License.
017:
018:         */
019:        package org.apache.batik.swing;
020:
021:        import java.awt.EventQueue;
022:        import java.io.PrintWriter;
023:        import java.io.StringWriter;
024:
025:        import org.w3c.dom.svg.SVGDocument;
026:
027:        import org.apache.batik.test.DefaultTestReport;
028:        import org.apache.batik.test.TestReport;
029:
030:        /**
031:         * Test setDocument on JSVGComponent with non-Batik SVGOMDocument.
032:         *
033:         * This test constructs a generic Document with SVG content then it
034:         * ensures that when this is passed to JSVGComponet.setDocument it is
035:         * properly imported to an SVGOMDocument and rendered from there.
036:         *
037:         * @author <a href="mailto:deweese@apache.org">l449433</a>
038:         * @version $Id: NullSetSVGDocumentTest.java 503369 2007-02-04 07:25:21Z cam $
039:         */
040:        public class NullSetSVGDocumentTest extends JSVGMemoryLeakTest {
041:            public NullSetSVGDocumentTest() {
042:            }
043:
044:            public static final String TEST_NON_NULL_URI = "file:samples/anne.svg";
045:
046:            /**
047:             * Entry describing the error
048:             */
049:            public static final String ENTRY_KEY_ERROR_DESCRIPTION = "JSVGCanvasHandler.entry.key.error.description";
050:
051:            /**
052:             * Entry describing the error
053:             */
054:            public static final String ERROR_IMAGE_NOT_CLEARED = "NullSetSVGDocumentTest.message.error.image.not.cleared";
055:
056:            public static final String ERROR_ON_SET = "NullSetSVGDocumentTest.message.error.on.set";
057:
058:            public String getName() {
059:                return getId();
060:            }
061:
062:            public JSVGCanvasHandler createHandler() {
063:                return new JSVGCanvasHandler(this , this ) {
064:                    public JSVGCanvas createCanvas() {
065:                        return new JSVGCanvas() {
066:                            protected void installSVGDocument(SVGDocument doc) {
067:                                super .installSVGDocument(doc);
068:                                if (doc != null)
069:                                    return;
070:                                handler.scriptDone();
071:                            }
072:                        };
073:                    }
074:                };
075:            }
076:
077:            public Runnable getRunnable(final JSVGCanvas canvas) {
078:                return new Runnable() {
079:                    public void run() {
080:                        canvas.setSVGDocument(null);
081:                    }
082:                };
083:            }
084:
085:            /* JSVGCanvasHandler.Delegate Interface */
086:            public boolean canvasInit(JSVGCanvas canvas) {
087:                setTheCanvas(canvas);
088:                theFrame = handler.getFrame();
089:
090:                canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
091:                canvas.setURI(TEST_NON_NULL_URI);
092:
093:                registerObjectDesc(canvas, "JSVGCanvas");
094:                registerObjectDesc(handler.getFrame(), "JFrame");
095:                return true; // We did trigger a load event.
096:            }
097:
098:            public void canvasRendered(JSVGCanvas canvas) {
099:                super .canvasRendered(canvas);
100:                try {
101:                    EventQueue.invokeAndWait(getRunnable(canvas));
102:                } catch (Throwable t) {
103:                    t.printStackTrace();
104:                    StringWriter trace = new StringWriter();
105:                    t.printStackTrace(new PrintWriter(trace));
106:                    DefaultTestReport report = new DefaultTestReport(this );
107:                    report.setErrorCode(ERROR_ON_SET);
108:                    report
109:                            .setDescription(new TestReport.Entry[] { new TestReport.Entry(
110:                                    fmt(ENTRY_KEY_ERROR_DESCRIPTION, null),
111:                                    fmt(ERROR_ON_SET, new Object[] { trace
112:                                            .toString() })) });
113:                    report.setPassed(false);
114:                    failReport = report;
115:                }
116:            }
117:
118:            public boolean canvasUpdated(JSVGCanvas canvas) {
119:                return true;
120:            }
121:
122:            public void canvasDone(JSVGCanvas canvas) {
123:                synchronized (this ) {
124:                    // Check that the original SVG
125:                    // Document and GVT tree are cleared.
126:                    checkObjects(new String[] { "SVGDoc", "GVT",
127:                            "updateManager" });
128:
129:                    if (canvas.getOffScreen() == null)
130:                        return;
131:                    System.err.println(">>>>>>> Canvas not cleared");
132:                    DefaultTestReport report = new DefaultTestReport(this );
133:                    report.setErrorCode(ERROR_IMAGE_NOT_CLEARED);
134:                    // It would be great to provide the image here
135:                    // but it's a lot of work and this isn't _really_
136:                    // what we are testing.  More testing that
137:                    // everything works (no exceptions thrown).
138:                    report
139:                            .setDescription(new TestReport.Entry[] { new TestReport.Entry(
140:                                    fmt(ENTRY_KEY_ERROR_DESCRIPTION, null),
141:                                    fmt(ERROR_IMAGE_NOT_CLEARED, null)) });
142:                    report.setPassed(false);
143:                    failReport = report;
144:                    return;
145:                }
146:            }
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.