FIX the test! styleshhet path with drive letter
[docutils.git] / test / test_writers / test_s5.py
blob8f66d7f90147efd7a098e22e90ae4a0aede41300
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 import platform
14 from __init__ import DocutilsTestSupport
17 def suite():
18 settings = {'stylesheet_path': '/test.css',
19 'embed_stylesheet': 0,}
20 s = DocutilsTestSupport.PublishTestSuite('s5', suite_settings=settings)
21 s.generateTests(totest_1)
22 settings['hidden_controls'] = 0
23 settings['view_mode'] = 'outline'
24 s.generateTests(totest_2)
25 return s
27 interpolations = {
28 'version': DocutilsTestSupport.docutils.__version__,
29 'drive': '', }
31 if platform.system() == "Windows":
32 interpolations['drive'] = "C:"
34 totest_1 = {}
35 totest_2 = {}
37 totest_1['basics'] = [
38 ["""\
39 ============
40 Show Title
41 ============
43 Title slide
45 First Slide
46 ===========
48 Slide text.
49 """,
50 """\
51 <?xml version="1.0" encoding="utf-8" ?>
52 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
53 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
54 <head>
55 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
56 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
57 <meta name="version" content="S5 1.1" />
58 <title>Show Title</title>
59 <link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />
60 <!-- configuration parameters -->
61 <meta name="defaultView" content="slideshow" />
62 <meta name="controlVis" content="hidden" />
63 <!-- style sheet links -->
64 <script src="ui/default/slides.js" type="text/javascript"></script>
65 <link rel="stylesheet" href="ui/default/slides.css"
66 type="text/css" media="projection" id="slideProj" />
67 <link rel="stylesheet" href="ui/default/outline.css"
68 type="text/css" media="screen" id="outlineStyle" />
69 <link rel="stylesheet" href="ui/default/print.css"
70 type="text/css" media="print" id="slidePrint" />
71 <link rel="stylesheet" href="ui/default/opera.css"
72 type="text/css" media="projection" id="operaFix" />
74 <style type="text/css">
75 #currentSlide {display: none;}
76 </style>
77 </head>
78 <body>
79 <div class="layout">
80 <div id="controls"></div>
81 <div id="currentSlide"></div>
82 <div id="header">
84 </div>
85 <div id="footer">
86 <h1>Show Title</h1>
88 </div>
89 </div>
90 <div class="presentation">
91 <div class="slide" id="slide0">
92 <h1 class="title">Show Title</h1>
94 <p>Title slide</p>
96 </div>
97 <div class="slide" id="first-slide">
98 <h1>First Slide</h1>
99 <p>Slide text.</p>
100 </div>
101 </div>
102 </body>
103 </html>
104 """ % interpolations]
107 totest_2['settings'] = [
108 ["""\
109 ==================
110 Bogus Slide Show
111 ==================
113 We're just checking the settings
114 """,
115 """\
116 <?xml version="1.0" encoding="utf-8" ?>
117 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
118 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
119 <head>
120 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
121 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
122 <meta name="version" content="S5 1.1" />
123 <title>Bogus Slide Show</title>
124 <link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />
125 <!-- configuration parameters -->
126 <meta name="defaultView" content="outline" />
127 <meta name="controlVis" content="visible" />
128 <!-- style sheet links -->
129 <script src="ui/default/slides.js" type="text/javascript"></script>
130 <link rel="stylesheet" href="ui/default/slides.css"
131 type="text/css" media="projection" id="slideProj" />
132 <link rel="stylesheet" href="ui/default/outline.css"
133 type="text/css" media="screen" id="outlineStyle" />
134 <link rel="stylesheet" href="ui/default/print.css"
135 type="text/css" media="print" id="slidePrint" />
136 <link rel="stylesheet" href="ui/default/opera.css"
137 type="text/css" media="projection" id="operaFix" />
139 <style type="text/css">
140 #currentSlide {display: none;}
141 </style>
142 </head>
143 <body>
144 <div class="layout">
145 <div id="controls"></div>
146 <div id="currentSlide"></div>
147 <div id="header">
149 </div>
150 <div id="footer">
151 <h1>Bogus Slide Show</h1>
153 </div>
154 </div>
155 <div class="presentation">
156 <div class="slide" id="slide0">
157 <h1 class="title">Bogus Slide Show</h1>
159 <p>We're just checking the settings</p>
160 </div>
161 </div>
162 </body>
163 </html>
164 """ % interpolations]
167 if __name__ == '__main__':
168 import unittest
169 unittest.main(defaultTest='suite')