[Libreoffice-commits] .: starmath/qa
Caolán McNamara
caolan at kemper.freedesktop.org
Wed Nov 10 08:18:38 PST 2010
starmath/qa/cppunit/test_starmath.cxx | 52 +++++++++++++++++++---------------
1 file changed, 30 insertions(+), 22 deletions(-)
New commits:
commit 33dec5def54b02032bc5240e0b7d35327e502a1c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 10 16:17:58 2010 +0000
rename this bit to tmEditUndoRedo
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 5899fd1..9677b68 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -43,6 +43,7 @@ public:
// tests
void createDocument();
+ void tmEditUndoRedo(SmDocShellRef &rDocShRef);
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(createDocument);
@@ -74,57 +75,64 @@ void Test::tearDown()
uno::Reference< lang::XComponent >(m_context, uno::UNO_QUERY_THROW)->dispose();
}
-void Test::createDocument()
+void Test::tmEditUndoRedo(SmDocShellRef &rDocShRef)
{
- SmDocShellRef xDocShRef = new SmDocShell(SFXOBJECTSHELL_STD_NORMAL);
-
- EditEngine &rEditEngine = xDocShRef->GetEditEngine();
- Window aFoo(NULL, 0);
- EditView aEditView(&rEditEngine, &aFoo);
- rEditEngine.SetActiveView(&aEditView);
+ EditEngine &rEditEngine = rDocShRef->GetEditEngine();
rtl::OUString sStringOne(RTL_CONSTASCII_USTRINGPARAM("a under b"));
{
rEditEngine.SetText(0, sStringOne);
- xDocShRef->UpdateText();
- rtl::OUString sFinalText = xDocShRef->GetText();
+ rDocShRef->UpdateText();
+ rtl::OUString sFinalText = rDocShRef->GetText();
CPPUNIT_ASSERT_MESSAGE("Strings must match", sStringOne== sFinalText);
}
rtl::OUString sStringTwo(RTL_CONSTASCII_USTRINGPARAM("a over b"));
{
rEditEngine.SetText(0, sStringTwo);
- xDocShRef->UpdateText();
- rtl::OUString sFinalText = xDocShRef->GetText();
+ rDocShRef->UpdateText();
+ rtl::OUString sFinalText = rDocShRef->GetText();
CPPUNIT_ASSERT_MESSAGE("Strings must match", sStringTwo == sFinalText);
}
- SfxRequest aUndo(SID_UNDO, SFX_CALLMODE_SYNCHRON, xDocShRef->GetPool());
+ SfxRequest aUndo(SID_UNDO, SFX_CALLMODE_SYNCHRON, rDocShRef->GetPool());
{
- xDocShRef->Execute(aUndo);
+ rDocShRef->Execute(aUndo);
rtl::OUString sFoo = rEditEngine.GetText();
- xDocShRef->UpdateText();
- rtl::OUString sFinalText = xDocShRef->GetText();
+ rDocShRef->UpdateText();
+ rtl::OUString sFinalText = rDocShRef->GetText();
CPPUNIT_ASSERT_MESSAGE("Strings much match", sStringOne== sFinalText);
}
{
- xDocShRef->Execute(aUndo);
+ rDocShRef->Execute(aUndo);
rtl::OUString sFoo = rEditEngine.GetText();
- xDocShRef->UpdateText();
- rtl::OUString sFinalText = xDocShRef->GetText();
+ rDocShRef->UpdateText();
+ rtl::OUString sFinalText = rDocShRef->GetText();
CPPUNIT_ASSERT_MESSAGE("Must now be empty", !sFinalText.getLength());
}
- SfxRequest aRedo(SID_REDO, SFX_CALLMODE_SYNCHRON, xDocShRef->GetPool());
+ SfxRequest aRedo(SID_REDO, SFX_CALLMODE_SYNCHRON, rDocShRef->GetPool());
{
- xDocShRef->Execute(aRedo);
+ rDocShRef->Execute(aRedo);
rtl::OUString sFoo = rEditEngine.GetText();
- xDocShRef->UpdateText();
- rtl::OUString sFinalText = xDocShRef->GetText();
+ rDocShRef->UpdateText();
+ rtl::OUString sFinalText = rDocShRef->GetText();
CPPUNIT_ASSERT_MESSAGE("Strings much match", sStringOne== sFinalText);
}
+}
+
+void Test::createDocument()
+{
+ SmDocShellRef xDocShRef = new SmDocShell(SFXOBJECTSHELL_STD_NORMAL);
+
+ EditEngine &rEditEngine = xDocShRef->GetEditEngine();
+ Window aFoo(NULL, 0);
+ EditView aEditView(&rEditEngine, &aFoo);
+ rEditEngine.SetActiveView(&aEditView);
+
+ tmEditUndoRedo(xDocShRef);
xDocShRef.Clear();
}
More information about the Libreoffice-commits
mailing list