← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~trb143/openlp/bug-1202677b into lp:openlp

 

Review: Needs Fixing

I think you're missing what I'm talking about. If you look in the diff below, line 123 is blank. Above it is a WHEN comment and below it is a line of code.

Diff comments:

> === modified file 'openlp/core/lib/renderer.py'
> --- openlp/core/lib/renderer.py	2014-07-02 18:13:23 +0000
> +++ openlp/core/lib/renderer.py	2014-11-22 20:34:01 +0000
> @@ -250,7 +250,13 @@
>                  # Remove two or more option slide breaks next to each other (causing infinite loop).
>                  while '\n[---]\n[---]\n' in text:
>                      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)
>                      # If there are (at least) two occurrences of [---] we use the first two slides (and neglect the last
>                      # for now).
> @@ -296,6 +302,7 @@
>                          lines = text.strip('\n').split('\n')
>                          pages.extend(self._paginate_slide(lines, line_end))
>                          break
> +                    count =+ 1
>              else:
>                  # Clean up line endings.
>                  pages = self._paginate_slide(text.split('\n'), line_end)
> 
> === modified file 'openlp/core/ui/firsttimeform.py'
> --- openlp/core/ui/firsttimeform.py	2014-11-01 10:38:33 +0000
> +++ openlp/core/ui/firsttimeform.py	2014-11-22 20:34:01 +0000
> @@ -95,6 +95,17 @@
>          """
>          self.application.process_events()
>          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:
>                  return FirstTimePage.NoInternet
>              else:
> 
> === modified file 'openlp/plugins/bibles/lib/__init__.py'
> --- openlp/plugins/bibles/lib/__init__.py	2014-05-02 06:42:17 +0000
> +++ openlp/plugins/bibles/lib/__init__.py	2014-11-22 20:34:01 +0000
> @@ -330,7 +330,10 @@
>          if not book_ref_id:
>              book_ref_id = bible.get_book_ref_id_by_localised_name(book, language_selection)
>          elif not bible.get_book_by_book_ref_id(book_ref_id):
> -            book_ref_id = False
> +            return False
> +        # We have not found the book so do not continue
> +        if not book_ref_id:
> +            return False
>          ranges = match.group('ranges')
>          range_list = get_reference_match('range_separator').split(ranges)
>          ref_list = []
> 
> === modified file 'openlp/plugins/songusage/forms/songusagedetailform.py'
> --- openlp/plugins/songusage/forms/songusagedetailform.py	2014-03-21 18:23:35 +0000
> +++ openlp/plugins/songusage/forms/songusagedetailform.py	2014-11-22 20:34:01 +0000
> @@ -99,7 +99,7 @@
>          report_file_name = os.path.join(path, file_name)
>          file_handle = None
>          try:
> -            file_handle = open(report_file_name, 'w')
> +            file_handle = open(report_file_name, 'wb')
>              for instance in usage:
>                  record = '\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
>                      '\"%s\",\"%s\"\n' % \
> 
> === modified file 'tests/functional/openlp_core_lib/test_renderer.py'
> --- tests/functional/openlp_core_lib/test_renderer.py	2014-07-02 18:58:52 +0000
> +++ tests/functional/openlp_core_lib/test_renderer.py	2014-11-22 20:34:01 +0000
> @@ -34,7 +34,7 @@
>  from PyQt4 import QtCore
>  
>  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
>  
> @@ -88,7 +88,7 @@
>          expected_tuple = ('{st}{r}Text text text{/r}{/st}', '{st}{r}',
>                            '<strong><span style="-webkit-text-fill-color:red">')
>  
> -        # WHEN:
> +        # WHEN: The renderer converts the start tags
>          result = renderer._get_start_tags(given_raw_text)
>  
>          # THEN: Check if the correct tuple is returned.
> @@ -104,8 +104,60 @@
>          given_line = 'beginning asdf \n end asdf'
>          expected_words = ['beginning', 'asdf', 'end', 'asdf']
>  
> -        # WHEN: Split the line
> +        # WHEN: Split the line based on word split rules
>          result_words = renderer._words_split(given_line)
>  
>          # THEN: The word lists should be the same.
>          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 word split rules
> +

This line...

> +        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 based on word split rules
> +        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 based on word split rules
> +        result_words = renderer.format_slide(given_line, service_item)
> +
> +        # THEN: The blanks have been removed.
> +        self.assertListEqual(result_words, expected_words)
> 
> === modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py'
> --- tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py	2014-05-07 23:52:51 +0000
> +++ tests/interfaces/openlp_plugins/bibles/test_lib_parse_reference.py	2014-11-22 20:34:01 +0000
> @@ -105,3 +105,13 @@
>          # THEN a verse array should be returned
>          self.assertEqual([(54, 1, 1, -1), (54, 2, 1, 1)], results,
>                           "The bible verses should match the expected results")
> +
> +    def parse_reference_four_test(self):
> +        """
> +        Test the parse_reference method with non existence book
> +        """
> +        # GIVEN given a bible in the bible manager
> +        # WHEN asking to parse the bible reference
> +        results = parse_reference('Raoul 1', self.manager.db_cache['tests'], MagicMock())
> +        # THEN a verse array should be returned
> +        self.assertEqual(False, results, "The bible Search should return False")
> 


-- 
https://code.launchpad.net/~trb143/openlp/bug-1202677b/+merge/242574
Your team OpenLP Core is subscribed to branch lp:openlp.


References