Fix [ 3527842 ].
[docutils.git] / test / test_writers / test_s5.py
blob9aa3013df47c1b7451fdecbb1a473cc560a9b9cf
1 #!/usr/bin/env python
3 # $Id$
4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
7 """
8 Tests for the S5/HTML writer.
9 """
11 import os
12 from __init__ import DocutilsTestSupport
15 def suite():
16 settings = {'stylesheet_path': '/test.css',
17 'embed_stylesheet': 0,}
18 s = DocutilsTestSupport.PublishTestSuite('s5', suite_settings=settings)
19 s.generateTests(totest_1)
20 settings['hidden_controls'] = 0
21 settings['view_mode'] = 'outline'
22 s.generateTests(totest_2)
23 return s
25 interpolations = {'version': DocutilsTestSupport.docutils.__version__}
27 totest_1 = {}
28 totest_2 = {}
30 totest_1['basics'] = [
31 ["""\
32 ============
33 Show Title
34 ============
36 Title slide
38 First Slide
39 ===========
41 Slide text.
42 """,
43 """\
44 <?xml version="1.0" encoding="utf-8" ?>
45 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
47 <head>
48 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
49 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
50 <meta name="version" content="S5 1.1" />
51 <title>Show Title</title>
52 <link rel="stylesheet" href="/test.css" type="text/css" />
53 <!-- configuration parameters -->
54 <meta name="defaultView" content="slideshow" />
55 <meta name="controlVis" content="hidden" />
56 <!-- style sheet links -->
57 <script src="ui/default/slides.js" type="text/javascript"></script>
58 <link rel="stylesheet" href="ui/default/slides.css"
59 type="text/css" media="projection" id="slideProj" />
60 <link rel="stylesheet" href="ui/default/outline.css"
61 type="text/css" media="screen" id="outlineStyle" />
62 <link rel="stylesheet" href="ui/default/print.css"
63 type="text/css" media="print" id="slidePrint" />
64 <link rel="stylesheet" href="ui/default/opera.css"
65 type="text/css" media="projection" id="operaFix" />
67 <style type="text/css">
68 #currentSlide {display: none;}
69 </style>
70 </head>
71 <body>
72 <div class="layout">
73 <div id="controls"></div>
74 <div id="currentSlide"></div>
75 <div id="header">
77 </div>
78 <div id="footer">
79 <h1>Show Title</h1>
81 </div>
82 </div>
83 <div class="presentation">
84 <div class="slide" id="slide0">
85 <h1 class="title">Show Title</h1>
87 <p>Title slide</p>
89 </div>
90 <div class="slide" id="first-slide">
91 <h1>First Slide</h1>
92 <p>Slide text.</p>
93 </div>
94 </div>
95 </body>
96 </html>
97 """ % interpolations]
100 totest_2['settings'] = [
101 ["""\
102 ==================
103 Bogus Slide Show
104 ==================
106 We're just checking the settings
107 """,
108 """\
109 <?xml version="1.0" encoding="utf-8" ?>
110 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
111 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
112 <head>
113 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
114 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
115 <meta name="version" content="S5 1.1" />
116 <title>Bogus Slide Show</title>
117 <link rel="stylesheet" href="/test.css" type="text/css" />
118 <!-- configuration parameters -->
119 <meta name="defaultView" content="outline" />
120 <meta name="controlVis" content="visible" />
121 <!-- style sheet links -->
122 <script src="ui/default/slides.js" type="text/javascript"></script>
123 <link rel="stylesheet" href="ui/default/slides.css"
124 type="text/css" media="projection" id="slideProj" />
125 <link rel="stylesheet" href="ui/default/outline.css"
126 type="text/css" media="screen" id="outlineStyle" />
127 <link rel="stylesheet" href="ui/default/print.css"
128 type="text/css" media="print" id="slidePrint" />
129 <link rel="stylesheet" href="ui/default/opera.css"
130 type="text/css" media="projection" id="operaFix" />
132 <style type="text/css">
133 #currentSlide {display: none;}
134 </style>
135 </head>
136 <body>
137 <div class="layout">
138 <div id="controls"></div>
139 <div id="currentSlide"></div>
140 <div id="header">
142 </div>
143 <div id="footer">
144 <h1>Bogus Slide Show</h1>
146 </div>
147 </div>
148 <div class="presentation">
149 <div class="slide" id="slide0">
150 <h1 class="title">Bogus Slide Show</h1>
152 <p>We're just checking the settings</p>
153 </div>
154 </div>
155 </body>
156 </html>
157 """ % interpolations]
160 if __name__ == '__main__':
161 import unittest
162 unittest.main(defaultTest='suite')