From 44d0967d81176e61d05a23a6ad074aaa67579419 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 4 Aug 2022 00:27:52 +0000 Subject: [PATCH] part 0: Add automated tests of preserving selection while handling some commands The following patches touch the logic to restore selection after handling commands. However, it seems that they are not tested because I found some regressions by manual testing, but didn't cause orange on tryserver. `outdent-preserving-selection.tentative.html` causes a crash due to the `MOZ_ASSERTION` in `HTMLEditor::HandleOutdentAtSelectionInternal`. It means that I misunderstand the logic and had put the assertion. I should fix it later with reading the complicated code again. For now, I just change it to `NS_WARNING_ASSERTION` instead. And also `test_cmd_absPos.html` is the first test to check toggling `position` between `static` and `absolute`. Therefore, it detects wrong `MOZ_ASSERT`s which test whether `EditActionData` or `TopLevelEditSubActionData` is created or not **before** they create them by themselves. So, this patch removes the wrong assertions. Differential Revision: https://phabricator.services.mozilla.com/D152962 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1774704 gecko-commit: d554ca7850eb362a0482c9f4c19caf288e65efb1 gecko-reviewers: m_kato --- ...tblock-preserving-selection.tentative.html | 136 +++++++++++++ ...indent-preserving-selection.tentative.html | 103 ++++++++++ ...t-list-preserving-selection.tentative.html | 155 ++++++++++++++ ...ustify-preserving-selection.tentative.html | 148 ++++++++++++++ ...utdent-preserving-selection.tentative.html | 192 ++++++++++++++++++ 5 files changed, 734 insertions(+) create mode 100644 editing/other/formatblock-preserving-selection.tentative.html create mode 100644 editing/other/indent-preserving-selection.tentative.html create mode 100644 editing/other/insert-list-preserving-selection.tentative.html create mode 100644 editing/other/justify-preserving-selection.tentative.html create mode 100644 editing/other/outdent-preserving-selection.tentative.html diff --git a/editing/other/formatblock-preserving-selection.tentative.html b/editing/other/formatblock-preserving-selection.tentative.html new file mode 100644 index 00000000000000..d10e80b4ea67ae --- /dev/null +++ b/editing/other/formatblock-preserving-selection.tentative.html @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + +Test preserving selection after formatBlock + + + + + + + + +
+ + + diff --git a/editing/other/indent-preserving-selection.tentative.html b/editing/other/indent-preserving-selection.tentative.html new file mode 100644 index 00000000000000..b3fae41faf06b4 --- /dev/null +++ b/editing/other/indent-preserving-selection.tentative.html @@ -0,0 +1,103 @@ + + + + + + + +Test preserving selection after indent + + + + + + + + +
+ + + diff --git a/editing/other/insert-list-preserving-selection.tentative.html b/editing/other/insert-list-preserving-selection.tentative.html new file mode 100644 index 00000000000000..b7faf4f27ae012 --- /dev/null +++ b/editing/other/insert-list-preserving-selection.tentative.html @@ -0,0 +1,155 @@ + + + + + + + + + +Test preserving selection after insert*List + + + + + + + + +
+ + + diff --git a/editing/other/justify-preserving-selection.tentative.html b/editing/other/justify-preserving-selection.tentative.html new file mode 100644 index 00000000000000..94a63e8505bad2 --- /dev/null +++ b/editing/other/justify-preserving-selection.tentative.html @@ -0,0 +1,148 @@ + + + + + + + + + + + + + +Test preserving selection after justifying selected content + + + + + + + + +
+ + + diff --git a/editing/other/outdent-preserving-selection.tentative.html b/editing/other/outdent-preserving-selection.tentative.html new file mode 100644 index 00000000000000..9f299bda493499 --- /dev/null +++ b/editing/other/outdent-preserving-selection.tentative.html @@ -0,0 +1,192 @@ + + + + + + + +Test preserving selection after outdent + + + + + + + + +
+ + +