sc/qa/extras/sceditfieldobj-cell.cxx | 40 ++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
New commits: commit 54e592926be7410bbd44b1482288305ea568073a Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Mon Jul 9 10:59:18 2012 -0400 UNO API test for ScEditFieldObj wrt its properties. To detect a bug such as fdo#50587. Change-Id: I3822af8d592b8aca31c1d4fecc925d0df20d27da diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx index 0f582cf..da5fb4f 100644 --- a/sc/qa/extras/sceditfieldobj-cell.cxx +++ b/sc/qa/extras/sceditfieldobj-cell.cxx @@ -39,7 +39,7 @@ #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheet.hpp> -#define NUMBER_OF_TESTS 6 +#define NUMBER_OF_TESTS 7 namespace sc_apitest { @@ -55,6 +55,8 @@ public: virtual uno::Reference<text::XTextRange> getTextRange(); virtual bool isAttachSupported() { return true; } + void testEditFieldProperties(); + CPPUNIT_TEST_SUITE(ScEditFieldObj_Cell); // XPropertySet @@ -68,6 +70,10 @@ public: // XTextContent CPPUNIT_TEST(testGetAnchor); CPPUNIT_TEST(testAttach); + + // Tests specific to this service implementation. + CPPUNIT_TEST(testEditFieldProperties); + CPPUNIT_TEST_SUITE_END(); private: @@ -164,6 +170,38 @@ uno::Reference<text::XTextRange> ScEditFieldObj_Cell::getTextRange() return xRange; } +void ScEditFieldObj_Cell::testEditFieldProperties() +{ + CPPUNIT_ASSERT_MESSAGE("component doesn't exist.", mxComponent.is()); + uno::Reference<lang::XMultiServiceFactory> xSM(mxComponent, UNO_QUERY_THROW); + + { + // Test properties of date time field. + uno::Reference<text::XTextField> xField( + xSM->createInstance("com.sun.star.text.textfield.DateTime"), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xField, UNO_QUERY_THROW); + + uno::Reference<beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + CPPUNIT_ASSERT_MESSAGE("failed to retrieve property set info.", xInfo.is()); + + CPPUNIT_ASSERT_MESSAGE("Calc's date time field should have 'IsFixed' property.", + xInfo->hasPropertyByName("IsFixed")); + } + + { + // Test properties of document title field. + uno::Reference<text::XTextField> xField( + xSM->createInstance("com.sun.star.text.textfield.docinfo.Title"), UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xPropSet(xField, UNO_QUERY_THROW); + + uno::Reference<beans::XPropertySetInfo> xInfo = xPropSet->getPropertySetInfo(); + CPPUNIT_ASSERT_MESSAGE("failed to retrieve property set info.", xInfo.is()); + + CPPUNIT_ASSERT_MESSAGE("Calc's title field shouldn't have 'IsFixed' property.", + !xInfo->hasPropertyByName("IsFixed")); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScEditFieldObj_Cell); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits