diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-09 10:59:18 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-09 11:02:13 -0400 |
commit | 54e592926be7410bbd44b1482288305ea568073a (patch) | |
tree | 487e4a9e9b0ff9865e5409e7daa8bc4c12b1417e /sc/qa/extras | |
parent | 228a3f8b9f279e80917968d9780e822a1d684ada (diff) |
UNO API test for ScEditFieldObj wrt its properties.
To detect a bug such as fdo#50587.
Change-Id: I3822af8d592b8aca31c1d4fecc925d0df20d27da
Diffstat (limited to 'sc/qa/extras')
-rw-r--r-- | sc/qa/extras/sceditfieldobj-cell.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/sc/qa/extras/sceditfieldobj-cell.cxx b/sc/qa/extras/sceditfieldobj-cell.cxx index 0f582cfcec0f..da5fb4fd9918 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(); |