Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
a172ed98
Kaydet (Commit)
a172ed98
authored
Nis 23, 2013
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
extract common chart test parts into own header
Change-Id: Id41b9c3cd241de9bc5fa1da885bc9a206bca093d
üst
4b520d2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
129 deletions
+141
-129
chart2import.cxx
chart2/qa/extras/chart2import.cxx
+2
-129
charttest.hxx
chart2/qa/extras/charttest.hxx
+139
-0
No files found.
chart2/qa/extras/chart2import.cxx
Dosyayı görüntüle @
a172ed98
...
@@ -7,45 +7,18 @@
...
@@ -7,45 +7,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
#include <test/bootstrapfixture.hxx>
#include "charttest.hxx"
#include <unotest/macros_test.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/table/XTableChartsSupplier.hpp>
#include <com/sun/star/table/XTableCharts.hpp>
#include <com/sun/star/table/XTableChart.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <comphelper/processfactory.hxx>
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
uno
;
class
Chart2ImportTest
:
public
test
::
BootstrapFixture
,
public
unotest
::
Macros
Test
class
Chart2ImportTest
:
public
Chart
Test
{
{
public
:
public
:
void
Fdo60083
();
void
Fdo60083
();
void
testSteppedLines
();
void
testSteppedLines
();
void
testErrorBarRange
();
void
testErrorBarRange
();
virtual
void
setUp
();
virtual
void
tearDown
();
CPPUNIT_TEST_SUITE
(
Chart2ImportTest
);
CPPUNIT_TEST_SUITE
(
Chart2ImportTest
);
CPPUNIT_TEST
(
Fdo60083
);
CPPUNIT_TEST
(
Fdo60083
);
CPPUNIT_TEST
(
testSteppedLines
);
CPPUNIT_TEST
(
testSteppedLines
);
...
@@ -53,15 +26,7 @@ public:
...
@@ -53,15 +26,7 @@ public:
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
private
:
private
:
void
load
(
const
char
*
pDir
,
const
char
*
pName
);
Reference
<
chart2
::
XChartDocument
>
getChartDocFromSheet
(
sal_Int32
nSheet
,
uno
::
Reference
<
lang
::
XComponent
>
xComponent
);
Reference
<
chart2
::
XDataSeries
>
getDataSeriesFromDoc
(
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nDataSeries
,
sal_Int32
nChartType
=
0
,
sal_Int32
nCooSys
=
0
);
Reference
<
chart2
::
XChartType
>
getChartTypeFromDoc
(
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nChartType
,
sal_Int32
nCooSys
=
0
);
Reference
<
lang
::
XComponent
>
mxComponent
;
};
};
// error bar import
// error bar import
...
@@ -186,98 +151,6 @@ void Chart2ImportTest::testSteppedLines()
...
@@ -186,98 +151,6 @@ void Chart2ImportTest::testSteppedLines()
}
}
}
}
Reference
<
chart2
::
XChartDocument
>
Chart2ImportTest
::
getChartDocFromSheet
(
sal_Int32
nSheet
,
uno
::
Reference
<
lang
::
XComponent
>
xComponent
)
{
// let us assume that we only have one chart per sheet
uno
::
Reference
<
sheet
::
XSpreadsheetDocument
>
xDoc
(
xComponent
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xDoc
.
is
());
uno
::
Reference
<
container
::
XIndexAccess
>
xIA
(
xDoc
->
getSheets
(),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xIA
.
is
());
uno
::
Reference
<
table
::
XTableChartsSupplier
>
xChartSupplier
(
xIA
->
getByIndex
(
nSheet
),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartSupplier
.
is
());
uno
::
Reference
<
table
::
XTableCharts
>
xCharts
=
xChartSupplier
->
getCharts
();
CPPUNIT_ASSERT
(
xCharts
.
is
());
uno
::
Reference
<
container
::
XIndexAccess
>
xIACharts
(
xCharts
,
UNO_QUERY_THROW
);
uno
::
Reference
<
table
::
XTableChart
>
xChart
(
xIACharts
->
getByIndex
(
0
),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChart
.
is
());
uno
::
Reference
<
document
::
XEmbeddedObjectSupplier
>
xEmbObjectSupplier
(
xChart
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xEmbObjectSupplier
.
is
());
uno
::
Reference
<
lang
::
XComponent
>
xChartComp
(
xEmbObjectSupplier
->
getEmbeddedObject
(),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartComp
.
is
());
uno
::
Reference
<
chart2
::
XChartDocument
>
xChartDoc
(
xChartComp
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartDoc
.
is
());
return
xChartDoc
;
}
Reference
<
chart2
::
XChartType
>
Chart2ImportTest
::
getChartTypeFromDoc
(
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nChartType
,
sal_Int32
nCooSys
)
{
CPPUNIT_ASSERT
(
xChartDoc
.
is
()
);
Reference
<
chart2
::
XDiagram
>
xDiagram
=
xChartDoc
->
getFirstDiagram
();
CPPUNIT_ASSERT
(
xDiagram
.
is
()
);
Reference
<
chart2
::
XCoordinateSystemContainer
>
xCooSysContainer
(
xDiagram
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xCooSysContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XCoordinateSystem
>
>
xCooSysSequence
(
xCooSysContainer
->
getCoordinateSystems
());
CPPUNIT_ASSERT
(
xCooSysSequence
.
getLength
()
>
nCooSys
);
Reference
<
chart2
::
XChartTypeContainer
>
xChartTypeContainer
(
xCooSysSequence
[
nCooSys
],
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartTypeContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XChartType
>
>
xChartTypeSequence
(
xChartTypeContainer
->
getChartTypes
()
);
CPPUNIT_ASSERT
(
xChartTypeSequence
.
getLength
()
>
nChartType
);
return
xChartTypeSequence
[
nChartType
];
}
Reference
<
chart2
::
XDataSeries
>
Chart2ImportTest
::
getDataSeriesFromDoc
(
uno
::
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nDataSeries
,
sal_Int32
nChartType
,
sal_Int32
nCooSys
)
{
Reference
<
chart2
::
XChartType
>
xChartType
=
getChartTypeFromDoc
(
xChartDoc
,
nChartType
,
nCooSys
);
Reference
<
chart2
::
XDataSeriesContainer
>
xDataSequenceContainer
(
xChartType
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xDataSequenceContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XDataSeries
>
>
xSeriesSequence
(
xDataSequenceContainer
->
getDataSeries
()
);
CPPUNIT_ASSERT
(
xSeriesSequence
.
getLength
()
>
nDataSeries
);
Reference
<
chart2
::
XDataSeries
>
xSeries
=
xSeriesSequence
[
nDataSeries
];
return
xSeries
;
}
void
Chart2ImportTest
::
load
(
const
char
*
pDir
,
const
char
*
pName
)
{
mxComponent
=
loadFromDesktop
(
getURLFromSrc
(
pDir
)
+
OUString
::
createFromAscii
(
pName
),
"com.sun.star.sheet.SpreadsheetDocument"
);
CPPUNIT_ASSERT
(
mxComponent
.
is
());
}
void
Chart2ImportTest
::
setUp
()
{
test
::
BootstrapFixture
::
setUp
();
mxDesktop
.
set
(
com
::
sun
::
star
::
frame
::
Desktop
::
create
(
comphelper
::
getComponentContext
(
getMultiServiceFactory
())
)
);
}
void
Chart2ImportTest
::
tearDown
()
{
if
(
mxComponent
.
is
())
mxComponent
->
dispose
();
test
::
BootstrapFixture
::
tearDown
();
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
Chart2ImportTest
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
Chart2ImportTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
chart2/qa/extras/charttest.hxx
0 → 100644
Dosyayı görüntüle @
a172ed98
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <test/bootstrapfixture.hxx>
#include <unotest/macros_test.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/table/XTableChartsSupplier.hpp>
#include <com/sun/star/table/XTableCharts.hpp>
#include <com/sun/star/table/XTableChart.hpp>
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/chart2/XDataSeries.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
::
uno
;
class
ChartTest
:
public
test
::
BootstrapFixture
,
public
unotest
::
MacrosTest
{
public
:
void
load
(
const
char
*
pDir
,
const
char
*
pName
);
virtual
void
setUp
();
virtual
void
tearDown
();
protected
:
Reference
<
lang
::
XComponent
>
mxComponent
;
};
void
ChartTest
::
load
(
const
char
*
pDir
,
const
char
*
pName
)
{
mxComponent
=
loadFromDesktop
(
getURLFromSrc
(
pDir
)
+
OUString
::
createFromAscii
(
pName
),
"com.sun.star.sheet.SpreadsheetDocument"
);
CPPUNIT_ASSERT
(
mxComponent
.
is
());
}
void
ChartTest
::
setUp
()
{
test
::
BootstrapFixture
::
setUp
();
mxDesktop
.
set
(
com
::
sun
::
star
::
frame
::
Desktop
::
create
(
comphelper
::
getComponentContext
(
getMultiServiceFactory
())
)
);
}
void
ChartTest
::
tearDown
()
{
if
(
mxComponent
.
is
())
mxComponent
->
dispose
();
test
::
BootstrapFixture
::
tearDown
();
}
Reference
<
chart2
::
XChartDocument
>
getChartDocFromSheet
(
sal_Int32
nSheet
,
uno
::
Reference
<
lang
::
XComponent
>
xComponent
)
{
// let us assume that we only have one chart per sheet
uno
::
Reference
<
sheet
::
XSpreadsheetDocument
>
xDoc
(
xComponent
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xDoc
.
is
());
uno
::
Reference
<
container
::
XIndexAccess
>
xIA
(
xDoc
->
getSheets
(),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xIA
.
is
());
uno
::
Reference
<
table
::
XTableChartsSupplier
>
xChartSupplier
(
xIA
->
getByIndex
(
nSheet
),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartSupplier
.
is
());
uno
::
Reference
<
table
::
XTableCharts
>
xCharts
=
xChartSupplier
->
getCharts
();
CPPUNIT_ASSERT
(
xCharts
.
is
());
uno
::
Reference
<
container
::
XIndexAccess
>
xIACharts
(
xCharts
,
UNO_QUERY_THROW
);
uno
::
Reference
<
table
::
XTableChart
>
xChart
(
xIACharts
->
getByIndex
(
0
),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChart
.
is
());
uno
::
Reference
<
document
::
XEmbeddedObjectSupplier
>
xEmbObjectSupplier
(
xChart
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xEmbObjectSupplier
.
is
());
uno
::
Reference
<
lang
::
XComponent
>
xChartComp
(
xEmbObjectSupplier
->
getEmbeddedObject
(),
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartComp
.
is
());
uno
::
Reference
<
chart2
::
XChartDocument
>
xChartDoc
(
xChartComp
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartDoc
.
is
());
return
xChartDoc
;
}
Reference
<
chart2
::
XChartType
>
getChartTypeFromDoc
(
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nChartType
,
sal_Int32
nCooSys
=
0
)
{
CPPUNIT_ASSERT
(
xChartDoc
.
is
()
);
Reference
<
chart2
::
XDiagram
>
xDiagram
=
xChartDoc
->
getFirstDiagram
();
CPPUNIT_ASSERT
(
xDiagram
.
is
()
);
Reference
<
chart2
::
XCoordinateSystemContainer
>
xCooSysContainer
(
xDiagram
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xCooSysContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XCoordinateSystem
>
>
xCooSysSequence
(
xCooSysContainer
->
getCoordinateSystems
());
CPPUNIT_ASSERT
(
xCooSysSequence
.
getLength
()
>
nCooSys
);
Reference
<
chart2
::
XChartTypeContainer
>
xChartTypeContainer
(
xCooSysSequence
[
nCooSys
],
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xChartTypeContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XChartType
>
>
xChartTypeSequence
(
xChartTypeContainer
->
getChartTypes
()
);
CPPUNIT_ASSERT
(
xChartTypeSequence
.
getLength
()
>
nChartType
);
return
xChartTypeSequence
[
nChartType
];
}
Reference
<
chart2
::
XDataSeries
>
getDataSeriesFromDoc
(
uno
::
Reference
<
chart2
::
XChartDocument
>
xChartDoc
,
sal_Int32
nDataSeries
,
sal_Int32
nChartType
=
0
,
sal_Int32
nCooSys
=
0
)
{
Reference
<
chart2
::
XChartType
>
xChartType
=
getChartTypeFromDoc
(
xChartDoc
,
nChartType
,
nCooSys
);
Reference
<
chart2
::
XDataSeriesContainer
>
xDataSequenceContainer
(
xChartType
,
UNO_QUERY_THROW
);
CPPUNIT_ASSERT
(
xDataSequenceContainer
.
is
()
);
Sequence
<
Reference
<
chart2
::
XDataSeries
>
>
xSeriesSequence
(
xDataSequenceContainer
->
getDataSeries
()
);
CPPUNIT_ASSERT
(
xSeriesSequence
.
getLength
()
>
nDataSeries
);
Reference
<
chart2
::
XDataSeries
>
xSeries
=
xSeriesSequence
[
nDataSeries
];
return
xSeries
;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment