Bugzilla – Attachment 112923 Details for
Bug 39749
calc unit test writing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
proposal for function testing
proposal.diff (text/plain), 3.24 KB, created by
Winfried Donkers
on 2015-01-29 17:01:30 UTC
(
hide
)
Description:
proposal for function testing
Filename:
MIME Type:
Creator:
Winfried Donkers
Created:
2015-01-29 17:01:30 UTC
Size:
3.24 KB
patch
obsolete
>diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx >index 13c616d..e4eda27 100644 >--- a/sc/qa/unit/subsequent_filters-test.cxx >+++ b/sc/qa/unit/subsequent_filters-test.cxx >@@ -102,6 +102,7 @@ public: > void testDatabaseRangesXLS(); > void testDatabaseRangesXLSX(); > void testFormatsODS(); >+ void testFunctions(); > // void testFormatsXLS(); > // void testFormatsXLSX(); > void testMatrixODS(); >@@ -204,6 +205,7 @@ public: > CPPUNIT_TEST(testFormatsODS); > // CPPUNIT_TEST(testFormatsXLS); TODO: Fix this > // CPPUNIT_TEST(testFormatsXLSX); TODO: Fix this >+ CPPUNIT_TEST(testFunctions); > CPPUNIT_TEST(testMatrixODS); > CPPUNIT_TEST(testMatrixXLS); > CPPUNIT_TEST(testBorderODS); >@@ -277,6 +279,7 @@ private: > #if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT) > void testPassword_Impl(const OUString& rFileNameBase); > #endif >+ void testFunctions_Impl( const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite = false ); > > uno::Reference<uno::XInterface> m_xCalcComponent; > }; >@@ -2812,6 +2815,52 @@ void ScFiltersTest::tearDown() > test::BootstrapFixture::tearDown(); > } > >+void ScFiltersTest::testFunctions() >+{ >+ testFunctions_Impl( "yearfrac.", ODS ); >+} >+ >+void ScFiltersTest::testFunctions_Impl( const OUString& rFileName, sal_Int32 nFormat, bool bReadWrite ) >+{ >+ ScDocShellRef xDocSh = loadDoc( rFileName, nFormat, bReadWrite ); >+ CPPUNIT_ASSERT_MESSAGE("Failed to load the document.", xDocSh.Is()); >+ ScDocument& rDoc = xDocSh->GetDocument(); >+ rDoc.CalcAll(); // perform hard re-calculation. >+ >+ SCROW nFirstRow = rDoc.GetValue( ScAddress( 1, 0, 0 ) ); >+ SCROW nLastRow = rDoc.GetValue( ScAddress( 1, 1, 0 ) ); >+ SCROW nRow = nFirstRow - 1; // 0-based >+ >+ // first, test total result >+ ScFormulaCell* pFC = rDoc.GetFormulaCell( ScAddress( 1, nRow, 0) ); >+ if ( !pFC || pFC->GetErrCode() != 0 || >+ 0 == rDoc.GetValue( ScAddress( 4, nRow, 0)) ) >+ { >+ // Errors present, check individual rows >+ for ( nRow = nFirstRow; nRow < nLastRow; ++nRow ) >+ { >+ // Column 2 is description, 3 is formula, 4 is result, 5 is comparison. >+ OString aStr = OString::number( nRow + 1 ) + >+ ", function name=[ " + >+ OUStringToOString( rDoc.GetString( ScAddress( 2, nRow, 0)), RTL_TEXTENCODING_UTF8 ) + >+ " ], result=" + >+ OString::number( rDoc.GetValue( ScAddress( 3, nRow, 0)) ) + >+ ", expected=" + >+ OString::number( rDoc.GetValue( ScAddress( 4, nRow, 0)) ); >+ >+ pFC = rDoc.GetFormulaCell( ScAddress( 3, nRow, 0) ); >+ if ( pFC && pFC->GetErrCode() != 0 ) >+ aStr += ", error code =" + OString::number( pFC->GetErrCode() ); >+ >+ CPPUNIT_ASSERT_MESSAGE( OString( "Expected a formula cell without error at row " + >+ aStr ).getStr(), isFormulaWithoutError( rDoc, ScAddress( 3, nRow, 0))); >+ CPPUNIT_ASSERT_MESSAGE( OString( "Expected a TRUE value at row " + >+ aStr ).getStr(), 0 != rDoc.GetValue( ScAddress( 5, nRow, 0))); >+ } >+ } >+ xDocSh->DoClose(); >+} >+ > CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest); > > CPPUNIT_PLUGIN_IMPLEMENT();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 39749
:
112922
| 112923