Kaydet (Commit) cc2d0811 authored tarafından Eike Rathke's avatar Eike Rathke

test with and without "Empty string as zero" option

Change-Id: I2e4ce4ca3e60b662702f2987c29a79ab1a5b2fdc
üst 01e1f4ec
...@@ -1052,14 +1052,34 @@ void Test::testFuncParam() ...@@ -1052,14 +1052,34 @@ void Test::testFuncParam()
m_pDoc->SetString(0, 1, 0, OUString("=\" \"+3")); // only blank m_pDoc->SetString(0, 1, 0, OUString("=\" \"+3")); // only blank
m_pDoc->SetString(0, 2, 0, OUString("=\" 4 \"+3")); // number in blanks m_pDoc->SetString(0, 2, 0, OUString("=\" 4 \"+3")); // number in blanks
m_pDoc->SetString(0, 3, 0, OUString("=\" x \"+3")); // non-numeric => #VALUE! error m_pDoc->SetString(0, 3, 0, OUString("=\" x \"+3")); // non-numeric => #VALUE! error
m_pDoc->CalcFormulaTree(false, true);
rtl::OUString aVal;
ScCalcConfig aConfig;
// With "Empty string as zero" option.
aConfig.mbEmptyStringAsZero = true;
ScInterpreter::SetGlobalConfig(aConfig);
m_pDoc->CalcAll();
m_pDoc->GetValue(0, 0, 0, val); m_pDoc->GetValue(0, 0, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3);
m_pDoc->GetValue(0, 1, 0, val); m_pDoc->GetValue(0, 1, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3); CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 3);
m_pDoc->GetValue(0, 2, 0, val); m_pDoc->GetValue(0, 2, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7); CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7);
rtl::OUString aVal = m_pDoc->GetString( 0, 3, 0); aVal = m_pDoc->GetString( 0, 3, 0);
CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
// Without "Empty string as zero" option.
aConfig.mbEmptyStringAsZero = false;
ScInterpreter::SetGlobalConfig(aConfig);
m_pDoc->CalcAll();
aVal = m_pDoc->GetString( 0, 0, 0);
CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
aVal = m_pDoc->GetString( 0, 1, 0);
CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
m_pDoc->GetValue(0, 2, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 7);
aVal = m_pDoc->GetString( 0, 3, 0);
CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!"); CPPUNIT_ASSERT_MESSAGE("incorrect result", aVal == "#VALUE!");
m_pDoc->DeleteTab(0); m_pDoc->DeleteTab(0);
......
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