forked from openlp/openlp
New start old bugs
This commit is contained in:
parent
93706f8d99
commit
4fb0e43c04
@ -250,7 +250,13 @@ class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
|
|||||||
# Remove two or more option slide breaks next to each other (causing infinite loop).
|
# Remove two or more option slide breaks next to each other (causing infinite loop).
|
||||||
while '\n[---]\n[---]\n' in text:
|
while '\n[---]\n[---]\n' in text:
|
||||||
text = text.replace('\n[---]\n[---]\n', '\n[---]\n')
|
text = text.replace('\n[---]\n[---]\n', '\n[---]\n')
|
||||||
while True:
|
while ' [---]' in text:
|
||||||
|
text = text.replace(' [---]', '[---]')
|
||||||
|
while '[---] ' in text:
|
||||||
|
text = text.replace('[---] ', '[---]')
|
||||||
|
count = 0
|
||||||
|
# only loop 5 times as there will never be more than 5 incorrect logical splits on a single slide.
|
||||||
|
while True and count < 5:
|
||||||
slides = text.split('\n[---]\n', 2)
|
slides = text.split('\n[---]\n', 2)
|
||||||
# If there are (at least) two occurrences of [---] we use the first two slides (and neglect the last
|
# If there are (at least) two occurrences of [---] we use the first two slides (and neglect the last
|
||||||
# for now).
|
# for now).
|
||||||
@ -296,6 +302,7 @@ class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
|
|||||||
lines = text.strip('\n').split('\n')
|
lines = text.strip('\n').split('\n')
|
||||||
pages.extend(self._paginate_slide(lines, line_end))
|
pages.extend(self._paginate_slide(lines, line_end))
|
||||||
break
|
break
|
||||||
|
count =+ 1
|
||||||
else:
|
else:
|
||||||
# Clean up line endings.
|
# Clean up line endings.
|
||||||
pages = self._paginate_slide(text.split('\n'), line_end)
|
pages = self._paginate_slide(text.split('\n'), line_end)
|
||||||
|
@ -95,6 +95,17 @@ class FirstTimeForm(QtGui.QWizard, UiFirstTimeWizard, RegistryProperties):
|
|||||||
"""
|
"""
|
||||||
self.application.process_events()
|
self.application.process_events()
|
||||||
if self.currentId() == FirstTimePage.Plugins:
|
if self.currentId() == FirstTimePage.Plugins:
|
||||||
|
if self.has_run_wizard:
|
||||||
|
self.songs_check_box.setChecked(self.plugin_manager.get_plugin_by_name('songs').is_active())
|
||||||
|
self.bible_check_box.setChecked(self.plugin_manager.get_plugin_by_name('bibles').is_active())
|
||||||
|
self.presentation_check_box.setChecked(self.plugin_manager.get_plugin_by_name(
|
||||||
|
'presentations').is_active())
|
||||||
|
self.image_check_box.setChecked(self.plugin_manager.get_plugin_by_name('images').is_active())
|
||||||
|
self.media_check_box.setChecked(self.plugin_manager.get_plugin_by_name('media').is_active())
|
||||||
|
self.remote_check_box.setChecked(self.plugin_manager.get_plugin_by_name('remotes').is_active())
|
||||||
|
self.custom_check_box.setChecked(self.plugin_manager.get_plugin_by_name('custom').is_active())
|
||||||
|
self.song_usage_check_box.setChecked(self.plugin_manager.get_plugin_by_name('songusage').is_active())
|
||||||
|
self.alert_check_box.setChecked(self.plugin_manager.get_plugin_by_name('alerts').is_active())
|
||||||
if not self.web_access:
|
if not self.web_access:
|
||||||
return FirstTimePage.NoInternet
|
return FirstTimePage.NoInternet
|
||||||
else:
|
else:
|
||||||
|
@ -99,7 +99,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog, RegistryPrope
|
|||||||
report_file_name = os.path.join(path, file_name)
|
report_file_name = os.path.join(path, file_name)
|
||||||
file_handle = None
|
file_handle = None
|
||||||
try:
|
try:
|
||||||
file_handle = open(report_file_name, 'w')
|
file_handle = open(report_file_name, 'wb')
|
||||||
for instance in usage:
|
for instance in usage:
|
||||||
record = '\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
|
record = '\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
|
||||||
'\"%s\",\"%s\"\n' % \
|
'\"%s\",\"%s\"\n' % \
|
||||||
|
@ -34,7 +34,7 @@ from unittest import TestCase
|
|||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.common import Registry
|
from openlp.core.common import Registry
|
||||||
from openlp.core.lib import Renderer, ScreenList
|
from openlp.core.lib import Renderer, ScreenList, ServiceItem
|
||||||
|
|
||||||
from tests.interfaces import MagicMock
|
from tests.interfaces import MagicMock
|
||||||
|
|
||||||
@ -109,3 +109,55 @@ class TestRenderer(TestCase):
|
|||||||
|
|
||||||
# THEN: The word lists should be the same.
|
# THEN: The word lists should be the same.
|
||||||
self.assertListEqual(result_words, expected_words)
|
self.assertListEqual(result_words, expected_words)
|
||||||
|
|
||||||
|
def format_slide_logical_split_test(self):
|
||||||
|
"""
|
||||||
|
Test that a line with text and a logic break does not break the renderer just returns the input
|
||||||
|
"""
|
||||||
|
# GIVEN: A line of with a space text and the logical split
|
||||||
|
renderer = Renderer()
|
||||||
|
renderer.empty_height = 25
|
||||||
|
given_line = 'a\n[---]\nb'
|
||||||
|
expected_words = ['a<br>[---]<br>b']
|
||||||
|
service_item = ServiceItem(None)
|
||||||
|
|
||||||
|
# WHEN: Split the line based on rules
|
||||||
|
|
||||||
|
result_words = renderer.format_slide(given_line, service_item)
|
||||||
|
|
||||||
|
# THEN: The word lists should be the same.
|
||||||
|
self.assertListEqual(result_words, expected_words)
|
||||||
|
|
||||||
|
def format_slide_blank_before_split_test(self):
|
||||||
|
"""
|
||||||
|
Test that a line with blanks before the logical split at handled
|
||||||
|
"""
|
||||||
|
# GIVEN: A line of with a space before the logical split
|
||||||
|
renderer = Renderer()
|
||||||
|
renderer.empty_height = 25
|
||||||
|
given_line = '\n [---]\n'
|
||||||
|
expected_words = ['<br> [---]']
|
||||||
|
service_item = ServiceItem(None)
|
||||||
|
|
||||||
|
# WHEN: Split the line
|
||||||
|
result_words = renderer.format_slide(given_line, service_item)
|
||||||
|
|
||||||
|
# THEN: The blanks have been removed.
|
||||||
|
self.assertListEqual(result_words, expected_words)
|
||||||
|
|
||||||
|
def format_slide_blank_after_split_test(self):
|
||||||
|
"""
|
||||||
|
Test that a line with blanks before the logical split at handled
|
||||||
|
"""
|
||||||
|
# GIVEN: A line of with a space after the logical split
|
||||||
|
renderer = Renderer()
|
||||||
|
renderer.empty_height = 25
|
||||||
|
given_line = '\n[---] \n'
|
||||||
|
expected_words = ['<br>[---] ']
|
||||||
|
service_item = ServiceItem(None)
|
||||||
|
|
||||||
|
# WHEN: Split the line
|
||||||
|
result_words = renderer.format_slide(given_line, service_item)
|
||||||
|
|
||||||
|
# THEN: The blanks have been removed.
|
||||||
|
self.assertListEqual(result_words, expected_words)
|
Loading…
Reference in New Issue
Block a user