diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-03-07 12:59:14 +0000 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-03-08 06:04:09 +0000 |
commit | 65f672b27f84682764f924a3da3cecbafc88b278 (patch) | |
tree | a049e17edb926ae0b3dfb9d01bc68497854af775 | |
parent | 224286b32587fe9a5db4a7f18b93956a0865d42d (diff) |
tdf#153918 svx a11y: Drop old items when switching FontCharMap
Calling `rRenderContext.GetFontCharMap(mxFontCharMap)`
in `SvxShowCharSet::RecalculateFont` means that a new
`FontCharMapRef` gets assigned to `mxFontCharMap`.
Therefore, clear the old items based on the previous
one from the map, so that new ones will be created
based on the new font char map in `SvxShowCharSet::ImplGetItem`
as needed instead of still returning the old ones.
Adapt the a11y UI test to check again that the "!" character
now has the proper accessible name. The incorrect
accessible name in the special characters dialog had
actually been uncovered by the initial version of the
test that failed on Windows due to this, and the test was adapted
to workaround that, s. tdf#153918 and the discussion in the
Gerrit change adding the test [1] for more details.
[1] https://gerrit.libreoffice.org/c/core/+/142260/24..26/sw/qa/extras/accessibility/dialogs.cxx#b85
Change-Id: I0ac578750b1fa0a7e63e62a6937a125c7ceab510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148423
Reviewed-by: Colomban Wendling <cwendling@hypra.fr>
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r-- | svx/source/dialog/charmap.cxx | 1 | ||||
-rw-r--r-- | svx/source/dialog/searchcharmap.cxx | 1 | ||||
-rw-r--r-- | sw/qa/extras/accessibility/dialogs.cxx | 11 |
3 files changed, 8 insertions, 5 deletions
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index 4c17ce11c98a..5f08ba3e96c8 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -695,6 +695,7 @@ void SvxShowCharSet::RecalculateFont(vcl::RenderContext& rRenderContext) aFont.SetTransparent(true); rRenderContext.SetFont(aFont); rRenderContext.GetFontCharMap(mxFontCharMap); + m_aItems.clear(); getFavCharacterList(); nX = aSize.Width() / COLUMN_COUNT; diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx index 02fb19be20b0..e15ec15da2c7 100644 --- a/svx/source/dialog/searchcharmap.cxx +++ b/svx/source/dialog/searchcharmap.cxx @@ -323,6 +323,7 @@ void SvxSearchCharSet::RecalculateFont(vcl::RenderContext& rRenderContext) aFont.SetTransparent(true); rRenderContext.SetFont(aFont); rRenderContext.GetFontCharMap(mxFontCharMap); + m_aItems.clear(); getFavCharacterList(); nX = aSize.Width() / COLUMN_COUNT; diff --git a/sw/qa/extras/accessibility/dialogs.cxx b/sw/qa/extras/accessibility/dialogs.cxx index 7997f7743b1e..6faab49128cd 100644 --- a/sw/qa/extras/accessibility/dialogs.cxx +++ b/sw/qa/extras/accessibility/dialogs.cxx @@ -74,13 +74,14 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestSpecialCharactersDialogFocu /* as there is a bug that focusing the character table doesn't enable the Insert button * (https://bugs.documentfoundation.org/show_bug.cgi?id=153806), we move to another cell - * so it works -- and we actually don't care which one it is */ - dialog.postKeyEventAsync(0, awt::Key::DOWN); - Scheduler::ProcessEventsToIdle(); + * so it works. */ + // tdf#153918: Check that '!' char has correct accessible name and insert it + dialog.postKeyEventAsync(0, awt::Key::RIGHT); + Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL( AccessibilityTools::getAccessibleObjectForName( - dialog.getAccessible(), accessibility::AccessibleRole::TABLE_CELL, u"0"), + dialog.getAccessible(), accessibility::AccessibleRole::TABLE_CELL, u"!"), getFocusedObject(dialog.getAccessible())); CPPUNIT_ASSERT(dialog.tabTo(accessibility::AccessibleRole::PUSH_BUTTON, u"Insert")); @@ -92,7 +93,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, TestSpecialCharactersDialogFocu CPPUNIT_ASSERT(activateMenuItem(u"Insert", u"Special Character...")); CPPUNIT_ASSERT(dialogWaiter->waitEndDialog()); - CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"<PARAGRAPH>0</PARAGRAPH>"), collectText()); + CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"<PARAGRAPH>!</PARAGRAPH>"), collectText()); } CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestHyperlinkDialog) |