summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-08-13 10:36:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-08-13 10:53:42 +0100
commit24e0e7ca6207a45fc45b67a1355a9d855955a2a8 (patch)
tree9e1908fcdffc38699b86a164bec7e73e8ff88cb7 /sw/qa
parentd5c9e77296056aa5e29a26bd3d8fb01e28dabde2 (diff)
add cppunit tests to guard against .txt import regressions
i.e. aac04652fda01b0299e17087b151f07d6115e894 cockup Change-Id: I858a6895678266cdc714962c04bb24bf5769d656
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/core/data/txt/fail/.gitignore0
-rw-r--r--sw/qa/core/data/txt/indeterminate/.gitignore0
-rw-r--r--sw/qa/core/data/txt/pass/.gitignore0
-rw-r--r--sw/qa/core/data/txt/pass/CVE-2009-2473-1.txt1
-rw-r--r--sw/qa/core/data/txt/pass/CVE-2009-2473-2.txt1
-rw-r--r--sw/qa/core/data/txt/pass/UTF-8-test.txtbin0 -> 20334 bytes
-rw-r--r--sw/qa/core/filters-test.cxx23
7 files changed, 21 insertions, 4 deletions
diff --git a/sw/qa/core/data/txt/fail/.gitignore b/sw/qa/core/data/txt/fail/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/qa/core/data/txt/fail/.gitignore
diff --git a/sw/qa/core/data/txt/indeterminate/.gitignore b/sw/qa/core/data/txt/indeterminate/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/qa/core/data/txt/indeterminate/.gitignore
diff --git a/sw/qa/core/data/txt/pass/.gitignore b/sw/qa/core/data/txt/pass/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/sw/qa/core/data/txt/pass/.gitignore
diff --git a/sw/qa/core/data/txt/pass/CVE-2009-2473-1.txt b/sw/qa/core/data/txt/pass/CVE-2009-2473-1.txt
new file mode 100644
index 000000000000..3bb3ebd2fbff
--- /dev/null
+++ b/sw/qa/core/data/txt/pass/CVE-2009-2473-1.txt
@@ -0,0 +1 @@
+IX \ No newline at end of file
diff --git a/sw/qa/core/data/txt/pass/CVE-2009-2473-2.txt b/sw/qa/core/data/txt/pass/CVE-2009-2473-2.txt
new file mode 100644
index 000000000000..85fc47855b15
--- /dev/null
+++ b/sw/qa/core/data/txt/pass/CVE-2009-2473-2.txt
@@ -0,0 +1 @@
+ujBgoX>Af \ No newline at end of file
diff --git a/sw/qa/core/data/txt/pass/UTF-8-test.txt b/sw/qa/core/data/txt/pass/UTF-8-test.txt
new file mode 100644
index 000000000000..abd16f7253bf
--- /dev/null
+++ b/sw/qa/core/data/txt/pass/UTF-8-test.txt
Binary files differ
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 2257d2f63549..4df9b0760c65 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -38,8 +38,12 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/sfxmodelfactory.hxx>
+#include <sfx2/sfxsids.hrc>
+
+#include <svl/stritem.hxx>
#include "init.hxx"
+#include "iodetect.hxx"
#include "swtypes.hxx"
#include "doc.hxx"
#include "docsh.hxx"
@@ -83,6 +87,13 @@ bool SwFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL
SwDocShellRef xDocShRef = new SwDocShell;
SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
pSrcMed->SetFilter(pFilter);
+
+ if (rUserData == FILTER_TEXT_DLG)
+ {
+ pSrcMed->GetItemSet()->Put(
+ SfxStringItem(SID_FILE_FILTEROPTIONS, rtl::OUString("UTF8,LF,Liberation Mono,en-US")));
+ }
+
bool bLoaded = xDocShRef->DoLoad(pSrcMed);
if (xDocShRef.Is())
xDocShRef->DoClose();
@@ -91,13 +102,17 @@ bool SwFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL
void SwFiltersTest::testCVEs()
{
- testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Staroffice XML (Writer)")),
+ testDir(rtl::OUString("Staroffice XML (Writer)"),
getURLFromSrc("/sw/qa/core/data/xml/"),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CXML")));
+ rtl::OUString(FILTER_XML));
- testDir(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MS Word 97")),
+ testDir(rtl::OUString("MS Word 97"),
getURLFromSrc("/sw/qa/core/data/ww8/"),
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CWW8")));
+ rtl::OUString(FILTER_WW8));
+
+ testDir(rtl::OUString("Text (encoded)"),
+ getURLFromSrc("/sw/qa/core/data/txt/"),
+ rtl::OUString(FILTER_TEXT_DLG));
}
void SwFiltersTest::setUp()