summaryrefslogtreecommitdiffstats
path: root/starmath/qa
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-11-29 16:48:58 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-11-29 16:48:58 +0000
commit3d9ff29a1636e29da56f401e9d86d5abe4ee5f80 (patch)
tree5dc07f86eaf2ea734e5ab486e71b76c38db681b3 /starmath/qa
parentequivalent tmEditMarker cppunit test (diff)
downloadcore-3d9ff29a1636e29da56f401e9d86d5abe4ee5f80.tar.gz
core-3d9ff29a1636e29da56f401e9d86d5abe4ee5f80.zip
implement tmEditAllClipboard equivalent cppunit test
Diffstat (limited to 'starmath/qa')
-rw-r--r--starmath/qa/cppunit/makefile.mk1
-rw-r--r--starmath/qa/cppunit/test_starmath.cxx105
2 files changed, 81 insertions, 25 deletions
diff --git a/starmath/qa/cppunit/makefile.mk b/starmath/qa/cppunit/makefile.mk
index 0433b200d3d7..ff6e81d6d337 100644
--- a/starmath/qa/cppunit/makefile.mk
+++ b/starmath/qa/cppunit/makefile.mk
@@ -114,6 +114,7 @@ $(MISC)/$(TARGET)/services.rdb .ERRREMOVE : $(MISC)/$(TARGET)/udkapi.rdb
-c $(DLLPRE)fwk$(DLLPOSTFIX)$(DLLPOST) \
-c $(DLLPRE)tk$(DLLPOSTFIX)$(DLLPOST) \
-c $(DLLPRE)sfx$(DLLPOSTFIX)$(DLLPOST) \
+ -c $(DLLPRE)vcl$(DLLPOSTFIX)$(DLLPOST) \
-c i18npool.uno$(DLLPOST)
#Tweak things so that we use the .res files in the solver
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 9dbba0d13b2f..950390a070ac 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -48,8 +48,9 @@ public:
// tests
void createDocument();
void tmEditUndoRedo(SmDocShellRef &rDocShRef);
+ void tmEditAllClipboard(SmEditWindow &rEditWindow);
+ void tmEditMarker(SmEditWindow &rEditWindow);
void tmEditFailure(SmDocShellRef &rDocShRef);
- void tmEditMarker(SfxViewFrame &rViewShell);
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(createDocument);
@@ -82,43 +83,88 @@ void Test::tearDown()
uno::Reference< lang::XComponent >(m_xContext, uno::UNO_QUERY_THROW)->dispose();
}
-void Test::tmEditMarker(SfxViewFrame &rViewFrame)
+void Test::tmEditMarker(SmEditWindow &rEditWindow)
{
- SfxBindings aBindings;
- SfxDispatcher aDispatcher(&rViewFrame);
- aBindings.SetDispatcher(&aDispatcher);
- SmCmdBoxWindow aSmCmdBoxWindow(&aBindings, NULL, NULL);
- SmEditWindow aEditWindow(aSmCmdBoxWindow);
- aEditWindow.Flush();
-
{
rtl::OUString sMarkedText(RTL_CONSTASCII_USTRINGPARAM("<?> under <?> under <?>"));
- aEditWindow.SetText(sMarkedText);
- aEditWindow.Flush();
- rtl::OUString sFinalText = aEditWindow.GetText();
+ rEditWindow.SetText(sMarkedText);
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
CPPUNIT_ASSERT_MESSAGE("Should be equal text", sFinalText == sMarkedText);
}
{
rtl::OUString sTargetText(RTL_CONSTASCII_USTRINGPARAM("a under b under c"));
- aEditWindow.SelNextMark();
- aEditWindow.Cut();
- aEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a")));
+ rEditWindow.SelNextMark();
+ rEditWindow.Cut();
+ rEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("a")));
- aEditWindow.SelNextMark();
- aEditWindow.SelNextMark();
- aEditWindow.Cut();
- aEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c")));
+ rEditWindow.SelNextMark();
+ rEditWindow.SelNextMark();
+ rEditWindow.Cut();
+ rEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("c")));
- aEditWindow.SelPrevMark();
- aEditWindow.Cut();
- aEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("b")));
+ rEditWindow.SelPrevMark();
+ rEditWindow.Cut();
+ rEditWindow.InsertText(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("b")));
- aEditWindow.Flush();
- rtl::OUString sFinalText = aEditWindow.GetText();
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
CPPUNIT_ASSERT_MESSAGE("Should be a under b under c", sFinalText == sTargetText);
}
+
+ {
+ rEditWindow.SetText(rtl::OUString());
+ rEditWindow.Flush();
+ }
+}
+
+void Test::tmEditAllClipboard(SmEditWindow &rEditWindow)
+{
+ rtl::OUString sOriginalText(RTL_CONSTASCII_USTRINGPARAM("a over b"));
+
+ {
+ rEditWindow.SetText(sOriginalText);
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Should be equal text", sFinalText == sOriginalText);
+ }
+
+ {
+ rEditWindow.SelectAll();
+ rEditWindow.Cut();
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Should be empty", !sFinalText.getLength());
+ }
+
+ {
+ rEditWindow.Paste();
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Should be equal text", sFinalText == sOriginalText);
+ }
+
+ {
+ rEditWindow.SelectAll();
+ rEditWindow.Copy();
+ }
+
+ {
+ rtl::OUString sExpectedText(RTL_CONSTASCII_USTRINGPARAM("a over ba over b"));
+
+ rEditWindow.Paste();
+ rEditWindow.Paste();
+ rEditWindow.Flush();
+ rtl::OUString sFinalText = rEditWindow.GetText();
+ CPPUNIT_ASSERT_MESSAGE("Should be equal text", sFinalText == sExpectedText);
+ }
+
+ {
+ rEditWindow.SetText(rtl::OUString());
+ rEditWindow.Flush();
+ }
}
void Test::tmEditFailure(SmDocShellRef &rDocShRef)
@@ -215,7 +261,16 @@ void Test::createDocument()
tmEditUndoRedo(xDocShRef);
tmEditFailure(xDocShRef);
- tmEditMarker(*pViewFrame);
+
+ SfxBindings aBindings;
+ SfxDispatcher aDispatcher(pViewFrame);
+ aBindings.SetDispatcher(&aDispatcher);
+ SmCmdBoxWindow aSmCmdBoxWindow(&aBindings, NULL, NULL);
+ SmEditWindow aEditWindow(aSmCmdBoxWindow);
+ aEditWindow.Flush();
+
+ tmEditMarker(aEditWindow);
+ tmEditAllClipboard(aEditWindow);
xDocShRef.Clear();
}