Merge lp:~oliwee/openlp/transparentBackground into lp:openlp
- transparentBackground
- Merge into trunk
Proposed by
Oliver Wieland
Status: | Needs review |
---|---|
Proposed branch: | lp:~oliwee/openlp/transparentBackground |
Merge into: | lp:openlp |
Diff against target: |
309 lines (+114/-17) 8 files modified
openlp/core/lib/htmlbuilder.py (+18/-7) openlp/core/lib/json/theme.json (+3/-1) openlp/core/lib/renderer.py (+1/-1) openlp/core/lib/theme.py (+14/-2) openlp/core/ui/themeform.py (+6/-0) openlp/core/ui/themewizard.py (+20/-0) tests/functional/openlp_core_lib/test_htmlbuilder.py (+51/-5) tests/functional/openlp_core_lib/test_theme.py (+1/-1) |
To merge this branch: | bzr merge lp:~oliwee/openlp/transparentBackground |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenLP Core | Pending | ||
Review via email: mp+250562@code.launchpad.net |
Commit message
Description of the change
Added transparency behind main text to theme
new theme option 'Transparency' for setting the transparency of the background of the main text
new theme option 'Smooth transition' to choose if there should be a smoother transition to the transparent area
To post a comment you must log in.
Unmerged revisions
- 2514. By Oliver Wieland
-
Added transparency behind main text to theme
new theme option 'Transparency' for setting the transparency of the background of the main text
new theme option 'Smooth transition' to choose if there should be a smoother transition to the transparent area
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'openlp/core/lib/htmlbuilder.py' | |||
2 | --- openlp/core/lib/htmlbuilder.py 2015-01-18 13:39:21 +0000 | |||
3 | +++ openlp/core/lib/htmlbuilder.py 2015-02-22 20:49:19 +0000 | |||
4 | @@ -585,7 +585,7 @@ | |||
5 | 585 | build_background_css(item, width), | 585 | build_background_css(item, width), |
6 | 586 | css_additions, | 586 | css_additions, |
7 | 587 | build_footer_css(item, height), | 587 | build_footer_css(item, height), |
9 | 588 | build_lyrics_css(item), | 588 | build_lyrics_css(item, width), |
10 | 589 | 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', | 589 | 'true' if theme_data and theme_data.display_slide_transition and is_live else 'false', |
11 | 590 | js_additions, | 590 | js_additions, |
12 | 591 | bgimage_src, | 591 | bgimage_src, |
13 | @@ -641,7 +641,7 @@ | |||
14 | 641 | return background | 641 | return background |
15 | 642 | 642 | ||
16 | 643 | 643 | ||
18 | 644 | def build_lyrics_css(item): | 644 | def build_lyrics_css(item, display_width): |
19 | 645 | """ | 645 | """ |
20 | 646 | Build the lyrics display css | 646 | Build the lyrics display css |
21 | 647 | 647 | ||
22 | @@ -669,8 +669,16 @@ | |||
23 | 669 | lyrics = '' | 669 | lyrics = '' |
24 | 670 | lyricsmain = '' | 670 | lyricsmain = '' |
25 | 671 | if theme_data and item.main: | 671 | if theme_data and item.main: |
28 | 672 | lyricstable = 'left: %spx; top: %spx;' % (item.main.x(), item.main.y()) | 672 | lyricstable = 'left: 0px; padding-left: %spx; top: %spx; width: 100%%; ' % (item.main.x(), item.main.y()) |
29 | 673 | lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height()) | 673 | transparency = 1 - (float(theme_data.display_background_transparency) / 100) |
30 | 674 | if theme_data.display_smooth_transparency: | ||
31 | 675 | lyricstable += 'background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%%, rgba(0,0,0,%s) 2%%, rgba(0,0,0,%s) 98%%,rgba(0,0,0,0) 100%%);'\ | ||
32 | 676 | % (transparency, transparency) | ||
33 | 677 | else: | ||
34 | 678 | lyricstable += 'background: rgba(0,0,0,%s);' % (transparency) | ||
35 | 679 | |||
36 | 680 | |||
37 | 681 | lyrics = build_lyrics_format_css(theme_data, item.main.width(), item.main.height(), display_width) | ||
38 | 674 | lyricsmain += build_lyrics_outline_css(theme_data) | 682 | lyricsmain += build_lyrics_outline_css(theme_data) |
39 | 675 | if theme_data.font_main_shadow: | 683 | if theme_data.font_main_shadow: |
40 | 676 | lyricsmain += ' text-shadow: %s %spx %spx;' % \ | 684 | lyricsmain += ' text-shadow: %s %spx %spx;' % \ |
41 | @@ -693,7 +701,7 @@ | |||
42 | 693 | return '' | 701 | return '' |
43 | 694 | 702 | ||
44 | 695 | 703 | ||
46 | 696 | def build_lyrics_format_css(theme_data, width, height): | 704 | def build_lyrics_format_css(theme_data, width, height, display_width): |
47 | 697 | """ | 705 | """ |
48 | 698 | Build the css which controls the theme format. Also used by renderer for splitting verses | 706 | Build the css which controls the theme format. Also used by renderer for splitting verses |
49 | 699 | 707 | ||
50 | @@ -715,13 +723,16 @@ | |||
51 | 715 | padding_bottom = '0.5em' | 723 | padding_bottom = '0.5em' |
52 | 716 | else: | 724 | else: |
53 | 717 | padding_bottom = '0' | 725 | padding_bottom = '0' |
54 | 726 | |||
55 | 727 | padding_right = display_width - width; | ||
56 | 728 | |||
57 | 718 | lyrics = '%s word-wrap: break-word; ' \ | 729 | lyrics = '%s word-wrap: break-word; ' \ |
58 | 719 | 'text-align: %s; vertical-align: %s; font-family: %s; ' \ | 730 | 'text-align: %s; vertical-align: %s; font-family: %s; ' \ |
59 | 720 | 'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \ | 731 | 'font-size: %spt; color: %s; line-height: %d%%; margin: 0;' \ |
61 | 721 | 'padding: 0; padding-bottom: %s; padding-left: %spx; width: %spx; height: %spx; ' % \ | 732 | 'padding: 0; padding-bottom: %s; padding-left: %spx; padding-right: %spx; width: %spx; height: %spx; ' % \ |
62 | 722 | (justify, align, valign, theme_data.font_main_name, theme_data.font_main_size, | 733 | (justify, align, valign, theme_data.font_main_name, theme_data.font_main_size, |
63 | 723 | theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom, | 734 | theme_data.font_main_color, 100 + int(theme_data.font_main_line_adjustment), padding_bottom, |
65 | 724 | left_margin, width, height) | 735 | left_margin, padding_right, width, height) |
66 | 725 | if theme_data.font_main_italics: | 736 | if theme_data.font_main_italics: |
67 | 726 | lyrics += 'font-style:italic; ' | 737 | lyrics += 'font-style:italic; ' |
68 | 727 | if theme_data.font_main_bold: | 738 | if theme_data.font_main_bold: |
69 | 728 | 739 | ||
70 | === modified file 'openlp/core/lib/json/theme.json' | |||
71 | --- openlp/core/lib/json/theme.json 2013-10-18 18:10:47 +0000 | |||
72 | +++ openlp/core/lib/json/theme.json 2015-02-22 20:49:19 +0000 | |||
73 | @@ -11,7 +11,9 @@ | |||
74 | 11 | "display" :{ | 11 | "display" :{ |
75 | 12 | "horizontal_align": 0, | 12 | "horizontal_align": 0, |
76 | 13 | "slide_transition": false, | 13 | "slide_transition": false, |
78 | 14 | "vertical_align": 0 | 14 | "vertical_align": 0, |
79 | 15 | "background_transparency": 100, | ||
80 | 16 | "smooth_transparency": 0 | ||
81 | 15 | }, | 17 | }, |
82 | 16 | "font": { | 18 | "font": { |
83 | 17 | "footer": { | 19 | "footer": { |
84 | 18 | 20 | ||
85 | === modified file 'openlp/core/lib/renderer.py' | |||
86 | --- openlp/core/lib/renderer.py 2015-01-18 13:39:21 +0000 | |||
87 | +++ openlp/core/lib/renderer.py 2015-02-22 20:49:19 +0000 | |||
88 | @@ -381,7 +381,7 @@ | |||
89 | 381 | </script><style>*{margin: 0; padding: 0; border: 0;} | 381 | </script><style>*{margin: 0; padding: 0; border: 0;} |
90 | 382 | #main {position: absolute; top: 0px; %s %s}</style></head><body> | 382 | #main {position: absolute; top: 0px; %s %s}</style></head><body> |
91 | 383 | <div id="main"></div></body></html>""" % \ | 383 | <div id="main"></div></body></html>""" % \ |
93 | 384 | (build_lyrics_format_css(theme_data, self.page_width, self.page_height), | 384 | (build_lyrics_format_css(theme_data, self.page_width, self.page_height, self.display.width()), |
94 | 385 | build_lyrics_outline_css(theme_data)) | 385 | build_lyrics_outline_css(theme_data)) |
95 | 386 | self.web.setHtml(html) | 386 | self.web.setHtml(html) |
96 | 387 | self.empty_height = self.web_frame.contentsSize().height() | 387 | self.empty_height = self.web_frame.contentsSize().height() |
97 | 388 | 388 | ||
98 | === modified file 'openlp/core/lib/theme.py' | |||
99 | --- openlp/core/lib/theme.py 2015-01-18 13:39:21 +0000 | |||
100 | +++ openlp/core/lib/theme.py 2015-02-22 20:49:19 +0000 | |||
101 | @@ -318,7 +318,7 @@ | |||
102 | 318 | element.appendChild(value) | 318 | element.appendChild(value) |
103 | 319 | background.appendChild(element) | 319 | background.appendChild(element) |
104 | 320 | 320 | ||
106 | 321 | def add_display(self, horizontal, vertical, transition): | 321 | def add_display(self, horizontal, vertical, transition, background_transparency, smooth_transparency): |
107 | 322 | """ | 322 | """ |
108 | 323 | Add a Display options. | 323 | Add a Display options. |
109 | 324 | 324 | ||
110 | @@ -343,6 +343,16 @@ | |||
111 | 343 | value = self.theme_xml.createTextNode(str(transition)) | 343 | value = self.theme_xml.createTextNode(str(transition)) |
112 | 344 | element.appendChild(value) | 344 | element.appendChild(value) |
113 | 345 | background.appendChild(element) | 345 | background.appendChild(element) |
114 | 346 | # Background Transparency | ||
115 | 347 | element = self.theme_xml.createElement('backgroundTransparency') | ||
116 | 348 | value = self.theme_xml.createTextNode(str(background_transparency)) | ||
117 | 349 | element.appendChild(value) | ||
118 | 350 | background.appendChild(element) | ||
119 | 351 | # Smooth Transparency | ||
120 | 352 | element = self.theme_xml.createElement('smoothTransparency') | ||
121 | 353 | value = self.theme_xml.createTextNode(str(smooth_transparency)) | ||
122 | 354 | element.appendChild(value) | ||
123 | 355 | background.appendChild(element) | ||
124 | 346 | 356 | ||
125 | 347 | def child_element(self, element, tag, value): | 357 | def child_element(self, element, tag, value): |
126 | 348 | """ | 358 | """ |
127 | @@ -555,5 +565,7 @@ | |||
128 | 555 | self.add_display( | 565 | self.add_display( |
129 | 556 | self.display_horizontal_align, | 566 | self.display_horizontal_align, |
130 | 557 | self.display_vertical_align, | 567 | self.display_vertical_align, |
132 | 558 | self.display_slide_transition | 568 | self.display_slide_transition, |
133 | 569 | self.display_background_transparency, | ||
134 | 570 | self.display_smooth_transparency | ||
135 | 559 | ) | 571 | ) |
136 | 560 | 572 | ||
137 | === modified file 'openlp/core/ui/themeform.py' | |||
138 | --- openlp/core/ui/themeform.py 2015-01-18 13:39:21 +0000 | |||
139 | +++ openlp/core/ui/themeform.py 2015-02-22 20:49:19 +0000 | |||
140 | @@ -134,6 +134,8 @@ | |||
141 | 134 | self.background_page.registerField('horizontal', self.horizontal_combo_box) | 134 | self.background_page.registerField('horizontal', self.horizontal_combo_box) |
142 | 135 | self.background_page.registerField('vertical', self.vertical_combo_box) | 135 | self.background_page.registerField('vertical', self.vertical_combo_box) |
143 | 136 | self.background_page.registerField('slide_transition', self.transitions_check_box) | 136 | self.background_page.registerField('slide_transition', self.transitions_check_box) |
144 | 137 | self.background_page.registerField('background_transparency', self.background_transparency_spin_box) | ||
145 | 138 | self.background_page.registerField('smooth_transparency', self.smooth_transparency_check_box) | ||
146 | 137 | self.background_page.registerField('name', self.theme_name_edit) | 139 | self.background_page.registerField('name', self.theme_name_edit) |
147 | 138 | 140 | ||
148 | 139 | def calculate_lines(self): | 141 | def calculate_lines(self): |
149 | @@ -366,6 +368,8 @@ | |||
150 | 366 | self.setField('horizontal', self.theme.display_horizontal_align) | 368 | self.setField('horizontal', self.theme.display_horizontal_align) |
151 | 367 | self.setField('vertical', self.theme.display_vertical_align) | 369 | self.setField('vertical', self.theme.display_vertical_align) |
152 | 368 | self.setField('slide_transition', self.theme.display_slide_transition) | 370 | self.setField('slide_transition', self.theme.display_slide_transition) |
153 | 371 | self.setField('background_transparency', self.theme.display_background_transparency) | ||
154 | 372 | self.setField('smooth_transparency', self.theme.display_smooth_transparency) | ||
155 | 369 | 373 | ||
156 | 370 | def set_preview_page_values(self): | 374 | def set_preview_page_values(self): |
157 | 371 | """ | 375 | """ |
158 | @@ -496,6 +500,8 @@ | |||
159 | 496 | self.theme.display_horizontal_align = self.horizontal_combo_box.currentIndex() | 500 | self.theme.display_horizontal_align = self.horizontal_combo_box.currentIndex() |
160 | 497 | self.theme.display_vertical_align = self.vertical_combo_box.currentIndex() | 501 | self.theme.display_vertical_align = self.vertical_combo_box.currentIndex() |
161 | 498 | self.theme.display_slide_transition = self.field('slide_transition') | 502 | self.theme.display_slide_transition = self.field('slide_transition') |
162 | 503 | self.theme.display_background_transparency = self.field('background_transparency') | ||
163 | 504 | self.theme.display_smooth_transparency = self.field('smooth_transparency') | ||
164 | 499 | 505 | ||
165 | 500 | def accept(self): | 506 | def accept(self): |
166 | 501 | """ | 507 | """ |
167 | 502 | 508 | ||
168 | === modified file 'openlp/core/ui/themewizard.py' | |||
169 | --- openlp/core/ui/themewizard.py 2015-01-18 13:39:21 +0000 | |||
170 | +++ openlp/core/ui/themewizard.py 2015-02-22 20:49:19 +0000 | |||
171 | @@ -261,6 +261,23 @@ | |||
172 | 261 | self.transitions_check_box.setObjectName('transitions_check_box') | 261 | self.transitions_check_box.setObjectName('transitions_check_box') |
173 | 262 | self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box) | 262 | self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box) |
174 | 263 | self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer) | 263 | self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer) |
175 | 264 | self.transparency_layout = QtGui.QHBoxLayout() | ||
176 | 265 | self.transparency_layout.setObjectName('transparency_layout') | ||
177 | 266 | self.background_transparency_label = QtGui.QLabel(self.alignment_page) | ||
178 | 267 | self.background_transparency_label.setObjectName('background_transparency_label') | ||
179 | 268 | self.background_transparency_spin_box = QtGui.QSpinBox(self.alignment_page) | ||
180 | 269 | self.background_transparency_spin_box.setMaximum(100) | ||
181 | 270 | self.background_transparency_spin_box.setObjectName('background_transparency_spin_box') | ||
182 | 271 | self.transparency_layout.addWidget(self.background_transparency_spin_box) | ||
183 | 272 | self.transparency_layout.addSpacing(20) | ||
184 | 273 | self.smooth_transparency_label = QtGui.QLabel(self.alignment_page) | ||
185 | 274 | self.smooth_transparency_label.setObjectName('smooth_transparency_label') | ||
186 | 275 | self.transparency_layout.addWidget(self.smooth_transparency_label) | ||
187 | 276 | self.transparency_layout.addSpacing(20) | ||
188 | 277 | self.smooth_transparency_check_box = QtGui.QCheckBox(self.alignment_page) | ||
189 | 278 | self.smooth_transparency_check_box.setObjectName('smooth_transparency_check_box') | ||
190 | 279 | self.transparency_layout.addWidget(self.smooth_transparency_check_box) | ||
191 | 280 | self.alignment_layout.addRow(self.smooth_transparency_label, self.transparency_layout) | ||
192 | 264 | theme_wizard.addPage(self.alignment_page) | 281 | theme_wizard.addPage(self.alignment_page) |
193 | 265 | # Area Position Page | 282 | # Area Position Page |
194 | 266 | self.area_position_page = QtGui.QWizardPage() | 283 | self.area_position_page = QtGui.QWizardPage() |
195 | @@ -458,6 +475,9 @@ | |||
196 | 458 | self.horizontal_combo_box.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center')) | 475 | self.horizontal_combo_box.setItemText(HorizontalType.Center, translate('OpenLP.ThemeWizard', 'Center')) |
197 | 459 | self.horizontal_combo_box.setItemText(HorizontalType.Justify, translate('OpenLP.ThemeWizard', 'Justify')) | 476 | self.horizontal_combo_box.setItemText(HorizontalType.Justify, translate('OpenLP.ThemeWizard', 'Justify')) |
198 | 460 | self.transitions_label.setText(translate('OpenLP.ThemeWizard', 'Transitions:')) | 477 | self.transitions_label.setText(translate('OpenLP.ThemeWizard', 'Transitions:')) |
199 | 478 | self.background_transparency_label.setText(translate('OpenLP.ThemeWizard', 'Transparency:')) | ||
200 | 479 | self.background_transparency_spin_box.setSuffix(translate('OpenLP.ThemeWizard', '%')) | ||
201 | 480 | self.smooth_transparency_label.setText(translate('OpenLP.ThemeWizard', 'Smooth Transition:')) | ||
202 | 461 | self.area_position_page.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations')) | 481 | self.area_position_page.setTitle(translate('OpenLP.ThemeWizard', 'Output Area Locations')) |
203 | 462 | self.area_position_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the' | 482 | self.area_position_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Allows you to change and move the' |
204 | 463 | ' Main and Footer areas.')) | 483 | ' Main and Footer areas.')) |
205 | 464 | 484 | ||
206 | === modified file 'tests/functional/openlp_core_lib/test_htmlbuilder.py' | |||
207 | --- tests/functional/openlp_core_lib/test_htmlbuilder.py 2014-07-24 21:57:16 +0000 | |||
208 | +++ tests/functional/openlp_core_lib/test_htmlbuilder.py 2015-02-22 20:49:19 +0000 | |||
209 | @@ -169,7 +169,24 @@ | |||
210 | 169 | z-index: 5; | 169 | z-index: 5; |
211 | 170 | position: absolute; | 170 | position: absolute; |
212 | 171 | display: table; | 171 | display: table; |
214 | 172 | left: 10px; top: 20px; | 172 | left: 0px; padding-left: 10px; top: 20px; width: 100%; background: rgba(0,0,0,0.5); |
215 | 173 | } | ||
216 | 174 | .lyricscell { | ||
217 | 175 | display: table-cell; | ||
218 | 176 | word-wrap: break-word; | ||
219 | 177 | -webkit-transition: opacity 0.4s ease; | ||
220 | 178 | lyrics_format_css | ||
221 | 179 | } | ||
222 | 180 | .lyricsmain { | ||
223 | 181 | text-shadow: #000000 5px 5px; | ||
224 | 182 | } | ||
225 | 183 | """ | ||
226 | 184 | LYRICS_CSS_SMOOTH = """ | ||
227 | 185 | .lyricstable { | ||
228 | 186 | z-index: 5; | ||
229 | 187 | position: absolute; | ||
230 | 188 | display: table; | ||
231 | 189 | left: 0px; padding-left: 10px; top: 20px; width: 100%; background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 2%, rgba(0,0,0,0.5) 98%,rgba(0,0,0,0) 100%); | ||
232 | 173 | } | 190 | } |
233 | 174 | .lyricscell { | 191 | .lyricscell { |
234 | 175 | display: table-cell; | 192 | display: table-cell; |
235 | @@ -184,7 +201,7 @@ | |||
236 | 184 | LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' | 201 | LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-color: #FFFFFF; ' |
237 | 185 | LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \ | 202 | LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \ |
238 | 186 | 'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \ | 203 | 'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \ |
240 | 187 | 'padding-bottom: 0.5em; padding-left: 2px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; ' | 204 | 'padding-bottom: 0.5em; padding-left: 2px; padding-right: 340px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; ' |
241 | 188 | FOOTER_CSS_BASE = """ | 205 | FOOTER_CSS_BASE = """ |
242 | 189 | left: 10px; | 206 | left: 10px; |
243 | 190 | bottom: 0px; | 207 | bottom: 0px; |
244 | @@ -275,13 +292,40 @@ | |||
245 | 275 | item.theme_data.font_main_shadow = True | 292 | item.theme_data.font_main_shadow = True |
246 | 276 | item.theme_data.font_main_shadow_color = '#000000' | 293 | item.theme_data.font_main_shadow_color = '#000000' |
247 | 277 | item.theme_data.font_main_shadow_size = 5 | 294 | item.theme_data.font_main_shadow_size = 5 |
249 | 278 | 295 | item.theme_data.display_background_transparency = 50 | |
250 | 296 | item.theme_data.display_smooth_transparency = 0 | ||
251 | 297 | display_width = 1024 | ||
252 | 298 | |||
253 | 279 | # WHEN: Create the css. | 299 | # WHEN: Create the css. |
255 | 280 | css = build_lyrics_css(item) | 300 | css = build_lyrics_css(item, display_width) |
256 | 281 | 301 | ||
257 | 282 | # THEN: The css should be equal. | 302 | # THEN: The css should be equal. |
258 | 283 | self.assertEqual(LYRICS_CSS, css, 'The lyrics css should be equal.') | 303 | self.assertEqual(LYRICS_CSS, css, 'The lyrics css should be equal.') |
259 | 284 | 304 | ||
260 | 305 | def build_lyrics_css_smooth_transparency_test(self): | ||
261 | 306 | """ | ||
262 | 307 | Test the build_lyrics_css() function with smooth transparency enabled | ||
263 | 308 | """ | ||
264 | 309 | # GIVEN: Mocked method and arguments. | ||
265 | 310 | with patch('openlp.core.lib.htmlbuilder.build_lyrics_format_css') as mocked_build_lyrics_format_css, \ | ||
266 | 311 | patch('openlp.core.lib.htmlbuilder.build_lyrics_outline_css') as mocked_build_lyrics_outline_css: | ||
267 | 312 | mocked_build_lyrics_format_css.return_value = 'lyrics_format_css' | ||
268 | 313 | mocked_build_lyrics_outline_css.return_value = '' | ||
269 | 314 | item = MagicMock() | ||
270 | 315 | item.main = QtCore.QRect(10, 20, 10, 20) | ||
271 | 316 | item.theme_data.font_main_shadow = True | ||
272 | 317 | item.theme_data.font_main_shadow_color = '#000000' | ||
273 | 318 | item.theme_data.font_main_shadow_size = 5 | ||
274 | 319 | item.theme_data.display_background_transparency = 50 | ||
275 | 320 | item.theme_data.display_smooth_transparency = 1 | ||
276 | 321 | display_width = 1024 | ||
277 | 322 | |||
278 | 323 | # WHEN: Create the css. | ||
279 | 324 | css = build_lyrics_css(item, display_width) | ||
280 | 325 | |||
281 | 326 | # THEN: The css should be equal. | ||
282 | 327 | self.assertEqual(LYRICS_CSS_SMOOTH, css, 'The lyrics css should be equal.') | ||
283 | 328 | |||
284 | 285 | def build_lyrics_outline_css_test(self): | 329 | def build_lyrics_outline_css_test(self): |
285 | 286 | """ | 330 | """ |
286 | 287 | Test the build_lyrics_outline_css() function | 331 | Test the build_lyrics_outline_css() function |
287 | @@ -315,9 +359,11 @@ | |||
288 | 315 | theme_data.font_main_line_adjustment = 8 | 359 | theme_data.font_main_line_adjustment = 8 |
289 | 316 | width = 1580 | 360 | width = 1580 |
290 | 317 | height = 810 | 361 | height = 810 |
291 | 362 | display_width = 1920 | ||
292 | 363 | |||
293 | 318 | 364 | ||
294 | 319 | # WHEN: Get the css. | 365 | # WHEN: Get the css. |
296 | 320 | css = build_lyrics_format_css(theme_data, width, height) | 366 | css = build_lyrics_format_css(theme_data, width, height, display_width) |
297 | 321 | 367 | ||
298 | 322 | # THEN: They should be equal. | 368 | # THEN: They should be equal. |
299 | 323 | self.assertEqual(LYRICS_FORMAT_CSS, css, 'The lyrics format css should be equal.') | 369 | self.assertEqual(LYRICS_FORMAT_CSS, css, 'The lyrics format css should be equal.') |
300 | 324 | 370 | ||
301 | === modified file 'tests/functional/openlp_core_lib/test_theme.py' | |||
302 | --- tests/functional/openlp_core_lib/test_theme.py 2015-01-18 13:39:21 +0000 | |||
303 | +++ tests/functional/openlp_core_lib/test_theme.py 2015-02-22 20:49:19 +0000 | |||
304 | @@ -61,4 +61,4 @@ | |||
305 | 61 | self.assertTrue(default_theme.font_footer_name == "Arial", | 61 | self.assertTrue(default_theme.font_footer_name == "Arial", |
306 | 62 | 'The theme should have a font_footer_name of Arial') | 62 | 'The theme should have a font_footer_name of Arial') |
307 | 63 | self.assertTrue(default_theme.font_main_bold is False, 'The theme should have a font_main_bold of false') | 63 | self.assertTrue(default_theme.font_main_bold is False, 'The theme should have a font_main_bold of false') |
309 | 64 | self.assertTrue(len(default_theme.__dict__) == 47, 'The theme should have 47 variables') | 64 | self.assertTrue(len(default_theme.__dict__) == 49, 'The theme should have 49 variables') |
New features are only for 2.4. Let's park this until 2.2 is out the door.