diff options
author | Eike Rathke <erack@redhat.com> | 2014-11-25 03:07:00 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-11-25 03:14:06 +0100 |
commit | 46e6f78f2b7595e7009975a2365395a74ca2df83 (patch) | |
tree | b0118214b8f1e06dc1978331edbea07850c88124 /sc/qa | |
parent | fb2c3fec1b98b54f929d0cec64789b79306e03b1 (diff) |
check internal and external sheet references in both modes
Actually fdo#77018 is not "fixed", but is a case for
UpdateReferenceOnSort=true now.
Change-Id: Ibc92c0a95749089c79787e38898bfe77fe30fb0f
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 15922411416e..db2ea40a736a 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -80,7 +80,8 @@ public: void testEnhancedProtectionXLSX(); void testSortWithSharedFormulasODS(); void testSortWithSheetExternalReferencesODS(); - void testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef xDocShRef, SCROW nRow1, SCROW nRow2 ); + void testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef xDocShRef, SCROW nRow1, SCROW nRow2, + bool bCheckRelativeInSheet ); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCVEs); @@ -619,20 +620,44 @@ void ScFiltersTest::testSortWithSheetExternalReferencesODS() sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn auto calc on. rDoc.CalcAll(); - // The relative test only works with UpdateReferenceOnSort == true, set it - // now. We reset the value back to the original in tearDown() + // We reset the SortRefUpdate value back to the original in tearDown(). ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); + + // The complete relative test only works with UpdateReferenceOnSort==true, + // but the internal and external sheet references have to work in both + // modes. + aInputOption.SetSortRefUpdate(true); SC_MOD()->SetInputOptions(aInputOption); - // Sort A15:D20 with relative row references. - testSortWithSheetExternalReferencesODS_Impl( xDocSh, 14, 19); + // Sort A15:D20 with relative row references. UpdateReferenceOnSort==true + // With in-sheet relative references. + testSortWithSheetExternalReferencesODS_Impl( xDocSh, 14, 19, true); + + // Undo sort with relative references to perform same sort. + rDoc.GetUndoManager()->Undo(); + rDoc.CalcAll(); + + aInputOption.SetSortRefUpdate(false); + SC_MOD()->SetInputOptions(aInputOption); + + // Sort A15:D20 with relative row references. UpdateReferenceOnSort==false + // Without in-sheet relative references. + testSortWithSheetExternalReferencesODS_Impl( xDocSh, 14, 19, false); + + // Undo sort with relative references to perform new sort. + rDoc.GetUndoManager()->Undo(); + rDoc.CalcAll(); // Sort with absolute references has to work in both UpdateReferenceOnSort // modes. + aInputOption.SetSortRefUpdate(true); + SC_MOD()->SetInputOptions(aInputOption); + // Sort A23:D28 with absolute row references. UpdateReferenceOnSort==true - testSortWithSheetExternalReferencesODS_Impl( xDocSh, 22, 27); + // With in-sheet relative references. + testSortWithSheetExternalReferencesODS_Impl( xDocSh, 22, 27, true); // Undo sort with absolute references to perform same sort. rDoc.GetUndoManager()->Undo(); @@ -642,12 +667,14 @@ void ScFiltersTest::testSortWithSheetExternalReferencesODS() SC_MOD()->SetInputOptions(aInputOption); // Sort A23:D28 with absolute row references. UpdateReferenceOnSort==false - testSortWithSheetExternalReferencesODS_Impl( xDocSh, 22, 27); + // With in-sheet relative references. + testSortWithSheetExternalReferencesODS_Impl( xDocSh, 22, 27, true); xDocSh->DoClose(); } -void ScFiltersTest::testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef xDocSh, SCROW nRow1, SCROW nRow2 ) +void ScFiltersTest::testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef xDocSh, SCROW nRow1, SCROW nRow2, + bool bCheckRelativeInSheet ) { ScDocument& rDoc = xDocSh->GetDocument(); @@ -694,9 +721,11 @@ void ScFiltersTest::testSortWithSheetExternalReferencesODS_Impl( ScDocShellRef x double aCheck[] = { 5, 4, 3, 2, 1 }; CPPUNIT_ASSERT_EQUAL( aCheck[nRow-nRow1-1], rDoc.GetValue( ScAddress(0,nRow,0))); } + // The last column (D) are in-sheet relative references. + SCCOL nEndCol = (bCheckRelativeInSheet ? 3 : 2); for (SCROW nRow=nRow1+1; nRow <= nRow2; ++nRow) { - for (SCCOL nCol=1; nCol <= 3; ++nCol) + for (SCCOL nCol=1; nCol <= nEndCol; ++nCol) { double aCheck[] = { 12345, 1234, 123, 12, 1 }; CPPUNIT_ASSERT_EQUAL( aCheck[nRow-nRow1-1], rDoc.GetValue( ScAddress(nCol,nRow,0))); |