Kaydet (Commit) bddfa273 authored tarafından kerem's avatar kerem Kaydeden (comit) Michael Stahl

tdf#90290 use custom asserter in subsequent_export-test.cxx

Change-Id: I8f8135728ab4f117cc99a0b78b8e3497417c5669
Reviewed-on: https://gerrit.libreoffice.org/32717Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst f240b1db
...@@ -1602,8 +1602,7 @@ void ScExportTest::testFormulaRefSheetNameODS() ...@@ -1602,8 +1602,7 @@ void ScExportTest::testFormulaRefSheetNameODS()
sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn on auto calc. sc::AutoCalcSwitch aACSwitch(rDoc, true); // turn on auto calc.
rDoc.SetString(ScAddress(1,1,0), "='90''s Data'.B2"); rDoc.SetString(ScAddress(1,1,0), "='90''s Data'.B2");
CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(1,1,0), "'90''s Data'.B2", "Wrong formula");
CPPUNIT_FAIL("Wrong formula");
} }
// Now, save and reload this document. // Now, save and reload this document.
ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS); ScDocShellRef xNewDocSh = saveAndReload(xDocSh.get(), FORMAT_ODS);
...@@ -1612,8 +1611,7 @@ void ScExportTest::testFormulaRefSheetNameODS() ...@@ -1612,8 +1611,7 @@ void ScExportTest::testFormulaRefSheetNameODS()
ScDocument& rDoc = xNewDocSh->GetDocument(); ScDocument& rDoc = xNewDocSh->GetDocument();
rDoc.CalcAll(); rDoc.CalcAll();
CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0))); CPPUNIT_ASSERT_EQUAL(1.1, rDoc.GetValue(ScAddress(1,1,0)));
if (!checkFormula(rDoc, ScAddress(1,1,0), "'90''s Data'.B2")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(1,1,0), "'90''s Data'.B2", "Wrong formula");
CPPUNIT_FAIL("Wrong formula");
xNewDocSh->DoClose(); xNewDocSh->DoClose();
} }
...@@ -1663,10 +1661,8 @@ void ScExportTest::testCellValuesExportODS() ...@@ -1663,10 +1661,8 @@ void ScExportTest::testCellValuesExportODS()
CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(5,0,0)); CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(5,0,0));
// check formula // check formula
if (!checkFormula(rDoc, ScAddress(4,0,0), "10*C1/4")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(4,0,0), "10*C1/4", "Wrong formula =10*C1/4");
CPPUNIT_FAIL("Wrong formula =10*C1/4"); ASSERT_FORMULA_EQUAL(rDoc, ScAddress(7,0,0), "SUM(C1:F1)", "Wrong formula =SUM(C1:F1)");
if (!checkFormula(rDoc, ScAddress(7,0,0), "SUM(C1:F1)"))
CPPUNIT_FAIL("Wrong formula =SUM(C1:F1)");
CPPUNIT_ASSERT_EQUAL(16.5, rDoc.GetValue(7,0,0)); CPPUNIT_ASSERT_EQUAL(16.5, rDoc.GetValue(7,0,0));
// check string // check string
...@@ -1685,8 +1681,7 @@ void ScExportTest::testCellValuesExportODS() ...@@ -1685,8 +1681,7 @@ void ScExportTest::testCellValuesExportODS()
//check contiguous values //check contiguous values
CPPUNIT_ASSERT_EQUAL( 12.0, rDoc.GetValue(0,5,0) ); CPPUNIT_ASSERT_EQUAL( 12.0, rDoc.GetValue(0,5,0) );
CPPUNIT_ASSERT_EQUAL( OUString("a string"), rDoc.GetString(0,6,0) ); CPPUNIT_ASSERT_EQUAL( OUString("a string"), rDoc.GetString(0,6,0) );
if (!checkFormula(rDoc, ScAddress(0,7,0), "$A$6")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,7,0), "$A$6", "Wrong formula =$A$6");
CPPUNIT_FAIL("Wrong formula =$A$6");
CPPUNIT_ASSERT_EQUAL( rDoc.GetValue(0,5,0), rDoc.GetValue(0,7,0) ); CPPUNIT_ASSERT_EQUAL( rDoc.GetValue(0,5,0), rDoc.GetValue(0,7,0) );
xNewDocSh->DoClose(); xNewDocSh->DoClose();
...@@ -1881,29 +1876,14 @@ void ScExportTest::testFormulaReferenceXLS() ...@@ -1881,29 +1876,14 @@ void ScExportTest::testFormulaReferenceXLS()
ScDocument& rDoc = xDocSh->GetDocument(); ScDocument& rDoc = xDocSh->GetDocument();
if (!checkFormula(rDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,1,0), "$A$2+$B$2+$C$2", "Wrong formula in D2");
CPPUNIT_FAIL("Wrong formula in D2"); ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,2,0), "A3+B3+C3", "Wrong formula in D3");
ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)", "Wrong formula in D6");
if (!checkFormula(rDoc, ScAddress(3,2,0), "A3+B3+C3")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,6,0), "SUM(A7:C7)", "Wrong formula in D7");
CPPUNIT_FAIL("Wrong formula in D3"); ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2", "Wrong formula in D10");
ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3", "Wrong formula in D11");
if (!checkFormula(rDoc, ScAddress(3,5,0), "SUM($A$6:$C$6)")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)", "Wrong formula in D14");
CPPUNIT_FAIL("Wrong formula in D6"); ASSERT_FORMULA_EQUAL(rDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)", "Wrong formula in D15");
if (!checkFormula(rDoc, ScAddress(3,6,0), "SUM(A7:C7)"))
CPPUNIT_FAIL("Wrong formula in D7");
if (!checkFormula(rDoc, ScAddress(3,9,0), "$Two.$A$2+$Two.$B$2+$Two.$C$2"))
CPPUNIT_FAIL("Wrong formula in D10");
if (!checkFormula(rDoc, ScAddress(3,10,0), "$Two.A3+$Two.B3+$Two.C3"))
CPPUNIT_FAIL("Wrong formula in D11");
if (!checkFormula(rDoc, ScAddress(3,13,0), "MIN($Two.$A$2:$C$2)"))
CPPUNIT_FAIL("Wrong formula in D14");
if (!checkFormula(rDoc, ScAddress(3,14,0), "MAX($Two.A3:C3)"))
CPPUNIT_FAIL("Wrong formula in D15");
xDocSh->DoClose(); xDocSh->DoClose();
} }
...@@ -3186,8 +3166,7 @@ void ScExportTest::testSupBookVirtualPathXLS() ...@@ -3186,8 +3166,7 @@ void ScExportTest::testSupBookVirtualPathXLS()
ScDocument& rDoc = xDocSh->GetDocument(); ScDocument& rDoc = xDocSh->GetDocument();
if (!checkFormula(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1")) ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,0,0), "'file:///home/timar/Documents/external.xls'#$Sheet1.A1", "Wrong SupBook VirtualPath URL");
CPPUNIT_FAIL("Wrong SupBook VirtualPath URL");
xDocSh->DoClose(); xDocSh->DoClose();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment