From 54e592926be7410bbd44b1482288305ea568073a Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Mon, 9 Jul 2012 10:59:18 -0400 Subject: UNO API test for ScEditFieldObj wrt its properties. To detect a bug such as fdo#50587. Change-Id: I3822af8d592b8aca31c1d4fecc925d0df20d27da --- sc/qa/extras/sceditfieldobj-cell.cxx | 40 +++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'sc/qa') 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 #include -#define NUMBER_OF_TESTS 6 +#define NUMBER_OF_TESTS 7 namespace sc_apitest { @@ -55,6 +55,8 @@ public: virtual uno::Reference 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 ScEditFieldObj_Cell::getTextRange() return xRange; } +void ScEditFieldObj_Cell::testEditFieldProperties() +{ + CPPUNIT_ASSERT_MESSAGE("component doesn't exist.", mxComponent.is()); + uno::Reference xSM(mxComponent, UNO_QUERY_THROW); + + { + // Test properties of date time field. + uno::Reference xField( + xSM->createInstance("com.sun.star.text.textfield.DateTime"), UNO_QUERY_THROW); + uno::Reference xPropSet(xField, UNO_QUERY_THROW); + + uno::Reference 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 xField( + xSM->createInstance("com.sun.star.text.textfield.docinfo.Title"), UNO_QUERY_THROW); + uno::Reference xPropSet(xField, UNO_QUERY_THROW); + + uno::Reference 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(); -- cgit v1.2.3