Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #include <sal/config.h>
11 : #include <unotest/filters-test.hxx>
12 : #include <test/bootstrapfixture.hxx>
13 : #include <rtl/strbuf.hxx>
14 : #include <osl/file.hxx>
15 :
16 : #include <sfx2/app.hxx>
17 : #include <sfx2/docfilt.hxx>
18 : #include <sfx2/docfile.hxx>
19 : #include <sfx2/sfxmodelfactory.hxx>
20 : #include <svl/stritem.hxx>
21 : #include <svx/svdograf.hxx>
22 :
23 : #include "drwlayer.hxx"
24 : #include <svx/svdpage.hxx>
25 : #include <svx/svdoole2.hxx>
26 : #include <editeng/wghtitem.hxx>
27 : #include <editeng/postitem.hxx>
28 : #include <editeng/udlnitem.hxx>
29 : #include <editeng/editobj.hxx>
30 : #include <editeng/borderline.hxx>
31 : #include <editeng/flditem.hxx>
32 : #include <dbdata.hxx>
33 : #include "validat.hxx"
34 : #include "formulacell.hxx"
35 : #include "userdat.hxx"
36 : #include "dpobject.hxx"
37 : #include "dpsave.hxx"
38 : #include "stlsheet.hxx"
39 : #include "docfunc.hxx"
40 : #include "markdata.hxx"
41 : #include "colorscale.hxx"
42 : #include "olinetab.hxx"
43 : #include "patattr.hxx"
44 : #include "scitems.hxx"
45 : #include "docsh.hxx"
46 : #include "editutil.hxx"
47 : #include "cellvalue.hxx"
48 : #include "attrib.hxx"
49 : #include "dpshttab.hxx"
50 : #include <scopetools.hxx>
51 : #include <columnspanset.hxx>
52 : #include <tokenstringcontext.hxx>
53 :
54 : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
55 : #include <com/sun/star/drawing/XControlShape.hpp>
56 : #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
57 : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
58 : #include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
59 : #include <com/sun/star/sheet/GeneralFunction.hpp>
60 : #include <com/sun/star/container/XIndexAccess.hpp>
61 : #include <com/sun/star/frame/XModel.hpp>
62 : #include <com/sun/star/text/textfield/Type.hpp>
63 : #include <com/sun/star/chart2/XChartDocument.hpp>
64 : #include <com/sun/star/chart2/data/XDataReceiver.hpp>
65 :
66 : #include "helper/qahelper.hxx"
67 : #include "helper/shared_test_impl.hxx"
68 :
69 : using namespace ::com::sun::star;
70 : using namespace ::com::sun::star::uno;
71 :
72 8 : class ScFiltersTest : public ScBootstrapFixture
73 : {
74 : public:
75 :
76 : ScFiltersTest();
77 :
78 : virtual void setUp() SAL_OVERRIDE;
79 : virtual void tearDown() SAL_OVERRIDE;
80 :
81 : void testTdf64229();
82 : void testTdf36933();
83 : void testTdf43700();
84 : void testTdf43534();
85 : // void testTdf40110();
86 :
87 2 : CPPUNIT_TEST_SUITE(ScFiltersTest);
88 1 : CPPUNIT_TEST(testTdf64229);
89 1 : CPPUNIT_TEST(testTdf36933);
90 1 : CPPUNIT_TEST(testTdf43700);
91 1 : CPPUNIT_TEST(testTdf43534);
92 : // CPPUNIT_TEST(testTdf40110);
93 5 : CPPUNIT_TEST_SUITE_END();
94 : private:
95 : uno::Reference<uno::XInterface> m_xCalcComponent;
96 : };
97 :
98 1 : void ScFiltersTest::testTdf64229()
99 : {
100 1 : ScDocShellRef xDocSh = loadDoc("fdo64229b.", ODS);
101 :
102 1 : xDocSh->DoHardRecalc(true);
103 :
104 1 : CPPUNIT_ASSERT_MESSAGE("Failed to load fdo64229b.*", xDocSh.Is());
105 1 : ScDocument& rDoc = xDocSh->GetDocument();
106 2 : OUString aCSVFileName;
107 :
108 : //test hard recalc: document has an incorrect cached formula result
109 : //hard recalc should have updated to the correct result
110 1 : createCSVPath(OUString("fdo64229b."), aCSVFileName);
111 1 : testFile(aCSVFileName, rDoc, 0);
112 :
113 2 : xDocSh->DoClose();
114 1 : }
115 :
116 1 : void ScFiltersTest::testTdf36933()
117 : {
118 1 : ScDocShellRef xDocSh = loadDoc("fdo36933test.", ODS);
119 :
120 1 : xDocSh->DoHardRecalc(true);
121 :
122 1 : CPPUNIT_ASSERT_MESSAGE("Failed to load fdo36933test.*", xDocSh.Is());
123 1 : ScDocument& rDoc = xDocSh->GetDocument();
124 2 : OUString aCSVFileName;
125 :
126 : //test hard recalc: document has an incorrect cached formula result
127 : //hard recalc should have updated to the correct result
128 1 : createCSVPath(OUString("fdo36933test."), aCSVFileName);
129 1 : testFile(aCSVFileName, rDoc, 0);
130 :
131 2 : xDocSh->DoClose();
132 1 : }
133 :
134 1 : void ScFiltersTest::testTdf43700()
135 : {
136 1 : ScDocShellRef xDocSh = loadDoc("fdo43700test.", ODS);
137 :
138 1 : xDocSh->DoHardRecalc(true);
139 :
140 1 : CPPUNIT_ASSERT_MESSAGE("Failed to load fdo43700test.*", xDocSh.Is());
141 1 : ScDocument& rDoc = xDocSh->GetDocument();
142 2 : OUString aCSVFileName;
143 :
144 : //test hard recalc: document has an incorrect cached formula result
145 : //hard recalc should have updated to the correct result
146 1 : createCSVPath(OUString("fdo43700test."), aCSVFileName);
147 1 : testFile(aCSVFileName, rDoc, 0);
148 :
149 2 : xDocSh->DoClose();
150 1 : }
151 :
152 1 : void ScFiltersTest::testTdf43534()
153 : {
154 1 : ScDocShellRef xDocSh = loadDoc("fdo43534test.", ODS);
155 :
156 1 : xDocSh->DoHardRecalc(true);
157 :
158 1 : CPPUNIT_ASSERT_MESSAGE("Failed to load fdo43534test.*", xDocSh.Is());
159 : // ScDocument& rDoc = xDocSh->GetDocument();
160 2 : OUString aCSVFileName;
161 :
162 : //test hard recalc: document has an incorrect cached formula result
163 : //hard recalc should have updated to the correct result
164 1 : createCSVPath(OUString("fdo43534test."), aCSVFileName);
165 : // testFile(aCSVFileName, rDoc, 0);
166 :
167 2 : xDocSh->DoClose();
168 1 : }
169 :
170 : /*
171 : void ScFiltersTest::testTdf40110()
172 : {
173 : ScDocShellRef xDocSh = loadDoc("fdo40110test.", ODS);
174 :
175 : CPPUNIT_ASSERT_MESSAGE("Failed to load fdo40110test.*", xDocSh.Is());
176 : xDocSh->DoHardRecalc(true);
177 :
178 : ScDocument& rDoc = xDocSh->GetDocument();
179 : OUString aCSVFileName;
180 :
181 : //test hard recalc: document has an incorrect cached formula result
182 : //hard recalc should have updated to the correct result
183 : createCSVPath(OUString("fdo40110test."), aCSVFileName);
184 : testFile(aCSVFileName, rDoc, 0);
185 :
186 : xDocSh->DoClose();
187 : }
188 : */
189 :
190 :
191 4 : ScFiltersTest::ScFiltersTest()
192 4 : : ScBootstrapFixture( "/sc/qa/unit/data" )
193 : {
194 4 : }
195 :
196 4 : void ScFiltersTest::setUp()
197 : {
198 4 : test::BootstrapFixture::setUp();
199 :
200 : // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
201 : // which is a private symbol to us, gets called
202 8 : m_xCalcComponent =
203 12 : getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
204 4 : CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
205 4 : }
206 :
207 4 : void ScFiltersTest::tearDown()
208 : {
209 4 : uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
210 4 : test::BootstrapFixture::tearDown();
211 4 : }
212 :
213 1 : CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest);
214 :
215 4 : CPPUNIT_PLUGIN_IMPLEMENT();
216 :
217 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|