summaryrefslogtreecommitdiffstats
path: root/sw/qa/core/accessibilitycheck
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/qa/core/accessibilitycheck
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/core/accessibilitycheck')
-rw-r--r--sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx58
-rw-r--r--sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odtbin0 -> 20915 bytes
-rw-r--r--sw/qa/core/accessibilitycheck/data/DocumentTest.odtbin0 -> 9338 bytes
3 files changed, 58 insertions, 0 deletions
diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
new file mode 100644
index 000000000..61902aabc
--- /dev/null
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <swmodeltestbase.hxx>
+#include <wrtsh.hxx>
+#include <AccessibilityCheck.hxx>
+
+class AccessibilityCheckTest : public SwModelTestBase
+{
+public:
+ SwDoc* createDoc(const char* pName = nullptr)
+ {
+ load("/sw/qa/core/accessibilitycheck/data/", pName);
+ SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ CPPUNIT_ASSERT(pTextDoc);
+ return pTextDoc->GetDocShell()->GetDoc();
+ }
+};
+
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testCheckDocumentIssues)
+{
+ SwDoc* pDoc = createDoc("DocumentTest.odt");
+ CPPUNIT_ASSERT(pDoc);
+ sw::AccessibilityCheck aCheck(pDoc);
+ aCheck.check();
+ auto& aIssues = aCheck.getIssueCollecton().getIssues();
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aIssues.size());
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_LANGUAGE, aIssues[0]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::DOCUMENT_TITLE, aIssues[1]->m_eIssueID);
+}
+
+CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, testTableSplitMergeAndAltText)
+{
+ SwDoc* pDoc = createDoc("AccessibilityTests1.odt");
+ CPPUNIT_ASSERT(pDoc);
+ sw::AccessibilityCheck aCheck(pDoc);
+ aCheck.check();
+ auto& aIssues = aCheck.getIssueCollecton().getIssues();
+ CPPUNIT_ASSERT_EQUAL(size_t(7), aIssues.size());
+
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_GRAPHIC, aIssues[0]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_OLE, aIssues[1]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, aIssues[2]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, aIssues[3]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, aIssues[4]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::TABLE_MERGE_SPLIT, aIssues[5]->m_eIssueID);
+ CPPUNIT_ASSERT_EQUAL(sfx::AccessibilityIssueID::NO_ALT_SHAPE, aIssues[6]->m_eIssueID);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
new file mode 100644
index 000000000..2e319f58e
--- /dev/null
+++ b/sw/qa/core/accessibilitycheck/data/AccessibilityTests1.odt
Binary files differ
diff --git a/sw/qa/core/accessibilitycheck/data/DocumentTest.odt b/sw/qa/core/accessibilitycheck/data/DocumentTest.odt
new file mode 100644
index 000000000..65b9a7c2f
--- /dev/null
+++ b/sw/qa/core/accessibilitycheck/data/DocumentTest.odt
Binary files differ