Kaydet (Commit) 5696272f authored tarafından Jens Carl's avatar Jens Carl

tdf#45904 Move XTextField Java tests to C++

Move XTextField Java tests to C++ for ScEditFieldObj_Header (formerly
ScHeaderFieldObj).

Change-Id: I36b723945d9306720846b4a4e2d3eaddb1a1c063
Reviewed-on: https://gerrit.libreoffice.org/70841
Tested-by: Jenkins
Reviewed-by: 's avatarJens Carl <j.carl43@gmx.de>
üst cc191e4f
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
...@@ -10,25 +10,28 @@ ...@@ -10,25 +10,28 @@
#ifndef INCLUDED_TEST_TEXT_XTEXTFIELD_HXX #ifndef INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
#define INCLUDED_TEST_TEXT_XTEXTFIELD_HXX #define INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx> #include <test/testdllapi.hxx>
namespace apitest namespace apitest
{ {
class OOO_DLLPUBLIC_TEST XTextField class OOO_DLLPUBLIC_TEST XTextField
{ {
public: public:
virtual ~XTextField() {} virtual css::uno::Reference<css::uno::XInterface> init() = 0;
virtual css::uno::Reference< css::uno::XInterface > init() = 0;
void testGetPresentation(); void testGetPresentation();
void testGetPresentationEmptyString();
protected:
~XTextField() {}
}; };
} } // namespace apitest
#endif // INCLUDED_TEST_TEXT_XTEXTFIELD_HXX #endif // INCLUDED_TEST_TEXT_XTEXTFIELD_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
"ScHeaderFieldObj";"com::sun::star::lang::XComponent";"dispose()" "ScHeaderFieldObj";"com::sun::star::lang::XComponent";"dispose()"
"ScHeaderFieldObj";"com::sun::star::lang::XComponent";"addEventListener()" "ScHeaderFieldObj";"com::sun::star::lang::XComponent";"addEventListener()"
"ScHeaderFieldObj";"com::sun::star::lang::XComponent";"removeEventListener()" "ScHeaderFieldObj";"com::sun::star::lang::XComponent";"removeEventListener()"
"ScHeaderFieldObj";"com::sun::star::text::XTextField";"getPresentation()"
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <test/beans/xpropertyset.hxx> #include <test/beans/xpropertyset.hxx>
#include <test/text/textcontent.hxx> #include <test/text/textcontent.hxx>
#include <test/text/xtextcontent.hxx> #include <test/text/xtextcontent.hxx>
#include <test/text/xtextfield.hxx>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
...@@ -38,7 +39,8 @@ namespace sc_apitest ...@@ -38,7 +39,8 @@ namespace sc_apitest
class ScEditFieldObj_Header : public CalcUnoApiTest, class ScEditFieldObj_Header : public CalcUnoApiTest,
public apitest::TextContent, public apitest::TextContent,
public apitest::XPropertySet, public apitest::XPropertySet,
public apitest::XTextContent public apitest::XTextContent,
public apitest::XTextField
{ {
public: public:
ScEditFieldObj_Header(); ScEditFieldObj_Header();
...@@ -66,6 +68,9 @@ public: ...@@ -66,6 +68,9 @@ public:
CPPUNIT_TEST(testGetAnchor); CPPUNIT_TEST(testGetAnchor);
CPPUNIT_TEST(testAttach); CPPUNIT_TEST(testAttach);
// XTextField
CPPUNIT_TEST(testGetPresentationEmptyString);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
private: private:
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/* /*
* This file is part of the LibreOffice project. * This file is part of the LibreOffice project.
* *
...@@ -8,24 +8,37 @@ ...@@ -8,24 +8,37 @@
*/ */
#include <test/text/xtextfield.hxx> #include <test/text/xtextfield.hxx>
#include <rtl/string.hxx>
#include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/HelperMacros.h>
using namespace css; using namespace css;
using namespace css::uno;
namespace apitest namespace apitest
{ {
void XTextField::testGetPresentation() void XTextField::testGetPresentation()
{ {
uno::Reference< text::XTextField > xTextField(init(), UNO_QUERY_THROW); uno::Reference<text::XTextField> xTextField(init(), uno::UNO_QUERY_THROW);
OUString aString = xTextField->getPresentation(true); OUString aString = xTextField->getPresentation(true);
CPPUNIT_ASSERT(!aString.isEmpty()); CPPUNIT_ASSERT(!aString.isEmpty());
aString = xTextField->getPresentation(false); aString = xTextField->getPresentation(false);
CPPUNIT_ASSERT(!aString.isEmpty()); CPPUNIT_ASSERT(!aString.isEmpty());
} }
void XTextField::testGetPresentationEmptyString()
{
uno::Reference<text::XTextField> xTextField(init(), uno::UNO_QUERY_THROW);
OUString aString = xTextField->getPresentation(true);
CPPUNIT_ASSERT(aString.isEmpty());
aString = xTextField->getPresentation(false);
CPPUNIT_ASSERT(aString.isEmpty());
} }
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment