[Libreoffice-commits] core.git: sc/qa

slideon adamkasztenny at gmail.com
Mon Jul 11 13:36:08 UTC 2016


 sc/qa/unit/ucalc.cxx |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++
 sc/qa/unit/ucalc.hxx |    3 ++
 2 files changed, 75 insertions(+)

New commits:
commit 740771c506233732b2678562bb4d1c0d98cd6d0c
Author: slideon <adamkasztenny at gmail.com>
Date:   Sat Jul 9 18:07:49 2016 -0400

    Add test for empty Calc doc defaults
    
    Checking boolean values of many properties for an empty
    Calc doc.
    
    Change-Id: I54ab4975e65600db4362d94f421f40f794643938
    Reviewed-on: https://gerrit.libreoffice.org/27080
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 91c6b71..6e3c30b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5974,6 +5974,78 @@ void Test::testUndoDataAnchor()
     m_pDoc->DeleteTab(0);
 }
 
+
+void Test::testEmptyCalcDocDefaults()
+{
+    CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCellCount() );
+    CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetFormulaGroupCount() );
+    CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCodeCount() );
+    CPPUNIT_ASSERT_EQUAL( (sal_uInt8) 0, m_pDoc->GetAsianCompression() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasPrintRange() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInVBAMode() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasNotes() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCutMode() );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->CheckMacroWarn() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsUsingEmbededFonts() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedded() );
+
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsDocEditable() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDocProtected() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDocVisible() );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsUserInteractionEnabled() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasAnyCalcNotification() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsAutoCalcShellDisabled() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsForcedFormulaPending() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCalculatingFormulaTree() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsClipOrUndo() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsClipboard() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsUndo() );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsUndoEnabled() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCutMode() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsClipboardSource() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInsertingFromOtherDoc() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->PastingDrawFromOtherDoc() );
+
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsAdjustHeightEnabled() );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsExecuteLinkEnabled() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsChangeReadOnlyEnabled() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IdleCalcTextWidth() );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsIdleEnabled() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsDetectiveDirty() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetHasMacroFunc() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsChartListenerCollectionNeedsUpdate() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasRangeOverflow() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsImportingXML() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCalcingAfterLoad() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetNoListening() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsValidAsianCompression() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->GetAsianKerning() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsValidAsianKerning() );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInInterpreter() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInInterpreterTableOp() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInDtorClear() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsExpandRefs() );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInLinkUpdate() );
+
+    SCTAB tab = m_pDoc->GetVisibleTab();
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsVisible(tab) );
+    CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsDefaultTabBgColor(tab) );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasTable(tab) );
+
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsActiveScenario(tab) );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasCalcNotification(tab) );
+    CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasManualBreaks(tab) );
+}
+
 ScDocShell* Test::findLoadedDocShellByName(const OUString& rName)
 {
     ScDocShell* pShell = static_cast<ScDocShell*>(SfxObjectShell::GetFirst(checkSfxObjectShell<ScDocShell>, false));
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 3aad1ec..7cb7b3c 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -481,6 +481,8 @@ public:
     void testTdf97369();
     void testTdf97587();
 
+    void testEmptyCalcDocDefaults();
+
     CPPUNIT_TEST_SUITE(Test);
     CPPUNIT_TEST(testCollator);
     CPPUNIT_TEST(testSharedStringPool);
@@ -725,6 +727,7 @@ public:
     CPPUNIT_TEST(testSetFormula);
     CPPUNIT_TEST(testTdf97369);
     CPPUNIT_TEST(testTdf97587);
+    CPPUNIT_TEST(testEmptyCalcDocDefaults);
     CPPUNIT_TEST_SUITE_END();
 
 private:


More information about the Libreoffice-commits mailing list