diff --git a/src/robotide/controller/filecontrollers.py b/src/robotide/controller/filecontrollers.py index 82be65a09..e6eb6a7d2 100644 --- a/src/robotide/controller/filecontrollers.py +++ b/src/robotide/controller/filecontrollers.py @@ -411,7 +411,8 @@ def is_directory_suite(self): def resource_import_modified(self, path): return self._project.resource_import_modified(path, self.directory) - def notify_settings_changed(self): + def notify_settings_changed(self, old_name=None): + _ = old_name RideItemSettingsChanged(item=self).publish() def notify_steps_changed(self): diff --git a/src/robotide/controller/macrocontrollers.py b/src/robotide/controller/macrocontrollers.py index 1c3c6b054..ab6dfcff3 100644 --- a/src/robotide/controller/macrocontrollers.py +++ b/src/robotide/controller/macrocontrollers.py @@ -297,7 +297,8 @@ def notify_keyword_removed(self): RideUserKeywordRemoved(datafile=self.datafile, name=self.name, item=self).publish() self.notify_steps_changed() - def notify_settings_changed(self): + def notify_settings_changed(self, old_name=None): + _ = old_name self.update_namespace() self._notify(RideItemSettingsChanged) diff --git a/src/robotide/controller/settingcontrollers.py b/src/robotide/controller/settingcontrollers.py index fedd623dc..dab0092b1 100644 --- a/src/robotide/controller/settingcontrollers.py +++ b/src/robotide/controller/settingcontrollers.py @@ -103,8 +103,8 @@ def set_comment(self, comment): self._data.comment = comment self.mark_dirty() - def notify_value_changed(self): - self._parent.notify_settings_changed() + def notify_value_changed(self, old_name=None): + self._parent.notify_settings_changed(old_name) def clear(self): self._data.reset() diff --git a/utest/controller/test_occurrences.py b/utest/controller/test_occurrences.py index a30f979d8..ac2b0abab 100644 --- a/utest/controller/test_occurrences.py +++ b/utest/controller/test_occurrences.py @@ -432,8 +432,7 @@ def _expected_messages(self, steps_have_changed=False, testcase_settings_have_changed=False, name_has_changed=False): assert self._steps_have_changed == steps_have_changed - assert (self._testcase_settings_have_changed == - testcase_settings_have_changed) + assert self._testcase_settings_have_changed == testcase_settings_have_changed assert self._name_has_changed == name_has_changed def _rename(self, original_name, new_name, source, usage): @@ -482,12 +481,12 @@ def steps_changed_check_that_name_has_also(message): def test_rename_in_steps(self): self._rename(STEP1_KEYWORD, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) def test_rename_with_dollar_sign(self): self._rename(STEP1_KEYWORD, UNUSED_KEYWORD_NAME+'$', TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) def test_undo_rename_in_step(self): self._rename(STEP1_KEYWORD, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') @@ -501,7 +500,7 @@ def test_undo_after_renaming_to_something_that_is_already_there(self): def test_rename_steps_argument(self): self._rename(STEP2_ARGUMENT, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) assert self.test_ctrl.steps[1].as_list() == ['Run Keyword', UNUSED_KEYWORD_NAME] @@ -544,13 +543,13 @@ def test_rename_in_suite_test_template(self): def test_rename_in_user_keywords(self): self._rename(KEYWORD_IN_USERKEYWORD1, UNUSED_KEYWORD_NAME, USERKEYWORD1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) def test_rename_given_prefixed_keywords(self): kw = 'BLOdkajasdj' self._add_step('Given '+kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], 'Given '+UNUSED_KEYWORD_NAME) @@ -558,7 +557,7 @@ def test_rename_when_prefixed_keywords(self): kw = 'fjsdklhf37849' self._add_step('wHEn '+kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], 'wHEn '+UNUSED_KEYWORD_NAME) @@ -566,7 +565,7 @@ def test_rename_then_prefixed_keywords(self): kw = 'djkfsekrhnbdxcvzo dsjah' self._add_step('THen '+kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], 'THen '+UNUSED_KEYWORD_NAME) @@ -574,7 +573,7 @@ def test_rename_and_prefixed_keywords(self): kw = 'mmxznbfje uiriweyi yr iu fjkdhzxck' self._add_step('AND '+kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], 'AND '+UNUSED_KEYWORD_NAME) @@ -582,7 +581,7 @@ def test_rename_but_prefixed_keywords(self): kw = 'sdlmclkds dslcm ldsm sdclmklm' self._add_step('bUt '+kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], 'bUt '+UNUSED_KEYWORD_NAME) @@ -590,7 +589,7 @@ def test_rename_when_keyword_begins_with_prefix(self): kw = 'When I say so' self._add_step(kw) self._rename(kw, UNUSED_KEYWORD_NAME, TEST1_NAME, 'Steps') - self._expected_messages(steps_have_changed=True) + self._expected_messages(steps_have_changed=True, name_has_changed=True) self.assertEqual(self.test_ctrl.step(100).as_list()[100], UNUSED_KEYWORD_NAME)