diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-07-27 10:31:17 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-07-27 11:54:56 +0200 |
commit | 6486899be3a63d07830c3eb2f4b8a3a6e5c81c9c (patch) | |
tree | df76b178cbdf4fe81971ac6f63143592897c2bc6 | |
parent | test rtf import/export of math placeholders (diff) | |
download | core-6486899be3a63d07830c3eb2f4b8a3a6e5c81c9c.tar.gz core-6486899be3a63d07830c3eb2f4b8a3a6e5c81c9c.zip |
test RTF_M{RAD,SEPCHR,SSUB,F}
Change-Id: I73f472fb09f97d94fbc9ef5cf38d9cf3c4beb999
-rw-r--r-- | sw/qa/extras/rtfexport/data/math-rad.rtf | 48 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/math-sepchr.rtf | 39 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/math-subscripts.rtf | 224 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/data/math-vertical-stacks.rtf | 131 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 39 |
5 files changed, 481 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/math-rad.rtf b/sw/qa/extras/rtfexport/data/math-rad.rtf new file mode 100644 index 000000000000..bcd25632508f --- /dev/null +++ b/sw/qa/extras/rtfexport/data/math-rad.rtf @@ -0,0 +1,48 @@ +{\rtf1
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid816065 }
+{\mrad
+{\mradPr
+{\mdegHide on}
+{\mctrlPr\f34 }
+}
+{\mdeg
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\f34\insrsid816065 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid816065 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 4}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid816065 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid816065 }
+{\mrad
+{\mradPr
+{\mctrlPr
+\f34 }
+}
+{\mdeg
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid816065 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 3}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid816065 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid816065 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid816065 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 +1}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid816065 }
+}
+}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/data/math-sepchr.rtf b/sw/qa/extras/rtfexport/data/math-sepchr.rtf new file mode 100644 index 000000000000..bf495565b873 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/math-sepchr.rtf @@ -0,0 +1,39 @@ +{\rtf1 +{\mmath +{\*\moMathPara +{\*\moMath +{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid13126585 } +{\md +{\mdPr +{\mbegChr A} +{\msepChr B} +{\mendChr C} +{\mctrlPr\f34 } +} +{\me +{\rtlch\fcs1 \af1 \ltrch\fcs0 +\i\f34\insrsid13126585 \hich\af34\dbch\af42\loch\f34 +{\mr\mscr0\msty2 x} +} +{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid13126585 } +} +{\me +{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid13126585 \hich\af34\dbch\af42\loch\f34 +{\mr\mscr0\msty2 y} +} +{\rtlch\fcs1 \af1 +\ltrch\fcs0 \f34\insrsid13126585 } +} +{\me +{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid13126585 \hich\af34\dbch\af42\loch\f34 +{\mr\mscr0\msty2 z} +} +{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid13126585 } +} +} +{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid13126585 } +} +} +} +\par +} diff --git a/sw/qa/extras/rtfexport/data/math-subscripts.rtf b/sw/qa/extras/rtfexport/data/math-subscripts.rtf new file mode 100644 index 000000000000..dfb8187401c4 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/math-subscripts.rtf @@ -0,0 +1,224 @@ +{\rtf1
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msSup
+{\msSupPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 y}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 +}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msSup
+{\msSupPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 e}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{
+\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msSup
+{\msSupPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{
+\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\f34\insrsid15485000 }
+{\msSub
+{\msSubPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msub
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msSubSup
+{\msSubSupPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 a}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msub
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 c}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msPre
+{\msPrePr
+{\mctrlPr\f34 }
+}
+{\msub
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 2}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000
+\hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 1}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msSubSup
+{\msSubSupPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\msPre
+{\msPrePr
+{\mctrlPr\f34 }
+}
+{\msub
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 4}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 5}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\mlimLow
+{\mlimLowPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+{\mlimUpp
+{\mlimUppPr
+{\mctrlPr\f34 }
+}
+{\me
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 x}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\mlim
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 6}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\mlim
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 3}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{
+\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+{\msub
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 2}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\f34\insrsid15485000 }
+}
+{\msup
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid15485000 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 1}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid15485000 }
+}
+}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/data/math-vertical-stacks.rtf b/sw/qa/extras/rtfexport/data/math-vertical-stacks.rtf new file mode 100644 index 000000000000..d74db9b403cf --- /dev/null +++ b/sw/qa/extras/rtfexport/data/math-vertical-stacks.rtf @@ -0,0 +1,131 @@ +{\rtf1
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+{\mf
+{\mfPr
+{\mctrlPr\f34 }
+}
+{\mnum
+{\rtlch\fcs1 \af1 \ltrch\fcs0
+\i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 a}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+}
+{\mden
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid936301 }
+}
+}
+}
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6706768
+\par }
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+{\mf
+{\mfPr
+{\mtype lin}
+{\mctrlPr\f34 }
+}
+{\mnum
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 a}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid936301 }
+}
+{\mden
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+}
+}
+}
+}
+}
+{
+\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6706768
+\par }
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+{\mf
+{\mfPr
+{\mtype noBar}
+{\mctrlPr\f34 }
+}
+{\mnum
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 a}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid936301 }
+}
+{\mden
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+}
+}
+}
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \insrsid6706768
+\par }
+{\mmath
+{\*\moMathPara
+{\*\moMath
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+{\mf
+{\mfPr
+{\mtype noBar}
+{\mctrlPr\f34 }
+}
+{\mnum
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 a}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid936301 }
+}
+{\mden
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+{\mf
+{\mfPr
+{\mtype noBar}
+{\mctrlPr\f34 }
+}
+{\mnum
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 b}
+}
+{\rtlch\fcs1 \af1
+\ltrch\fcs0 \f34\insrsid936301 }
+}
+{\mden
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \i\f34\insrsid936301 \hich\af34\dbch\af42\loch\f34
+{\mr\mscr0\msty2 c}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+}
+}
+{\rtlch\fcs1 \af1 \ltrch\fcs0 \f34\insrsid936301 }
+}
+}
+}
+}
+}
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 6d1bceb1fa4f..7cf93df6bee3 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -63,6 +63,10 @@ public: void testMathLimupp(); void testMathStrikeh(); void testMathPlaceholders(); + void testMathRad(); + void testMathSepchr(); + void testMathSubscripts(); + void testMathVerticalstacks(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -88,6 +92,10 @@ public: CPPUNIT_TEST(testMathLimupp); CPPUNIT_TEST(testMathStrikeh); CPPUNIT_TEST(testMathPlaceholders); + CPPUNIT_TEST(testMathRad); + CPPUNIT_TEST(testMathSepchr); + CPPUNIT_TEST(testMathSubscripts); + CPPUNIT_TEST(testMathVerticalstacks); #endif #endif CPPUNIT_TEST_SUITE_END(); @@ -358,6 +366,37 @@ void Test::testMathPlaceholders() CPPUNIT_ASSERT_EQUAL(OUString("sum from <?> to <?> <?>"), aActual); } +void Test::testMathRad() +{ + roundtrip("math-rad.rtf"); + OUString aActual = getFormula(getRun(getParagraph(1), 1)); + CPPUNIT_ASSERT_EQUAL(OUString("sqrt {4} nroot {3} {x + 1}"), aActual); +} + +void Test::testMathSepchr() +{ + roundtrip("math-sepchr.rtf"); + OUString aActual = getFormula(getRun(getParagraph(1), 1)); + CPPUNIT_ASSERT_EQUAL(OUString("AxByBzC"), aActual); +} + +void Test::testMathSubscripts() +{ + roundtrip("math-subscripts.rtf"); + OUString aActual = getFormula(getRun(getParagraph(1), 1)); + OUString aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} {x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub {2} rsup {1}"); + CPPUNIT_ASSERT_EQUAL(aExpected, aActual); +} + +void Test::testMathVerticalstacks() +{ + roundtrip("math-vertical-stacks.rtf"); + CPPUNIT_ASSERT_EQUAL(OUString("{a} over {b}"), getFormula(getRun(getParagraph(1), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("{a} / {b}"), getFormula(getRun(getParagraph(2), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("stack { a # b }"), getFormula(getRun(getParagraph(3), 1))); + CPPUNIT_ASSERT_EQUAL(OUString("stack { a # stack { b # c } }"), getFormula(getRun(getParagraph(4), 1))); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |