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
dc4355e5
Kaydet (Commit)
dc4355e5
authored
Tem 07, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bnc#881025: Write test for this.
Change-Id: Ifb1f83bbe5f9bb9ecb7fca26f883d1331052f10d
üst
b8c444a4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
27 deletions
+98
-27
chart2export.cxx
chart2/qa/extras/chart2export.cxx
+6
-22
chart2import.cxx
chart2/qa/extras/chart2import.cxx
+61
-0
charttest.hxx
chart2/qa/extras/charttest.hxx
+31
-5
stacked-non-stacked-mix-y-axis.pptx
...2/qa/extras/data/pptx/stacked-non-stacked-mix-y-axis.pptx
+0
-0
No files found.
chart2/qa/extras/chart2export.cxx
Dosyayı görüntüle @
dc4355e5
...
...
@@ -719,27 +719,17 @@ void Chart2ExportTest::testAxisNumberFormatODS()
{
void
check
(
const
Reference
<
chart2
::
XChartDocument
>&
xChartDoc
)
{
Reference
<
util
::
XNumberFormatsSupplier
>
xNFS
(
xChartDoc
,
UNO_QUERY_THROW
);
Reference
<
util
::
XNumberFormats
>
xNumberFormats
=
xNFS
->
getNumberFormats
();
CPPUNIT_ASSERT
(
xNumberFormats
.
is
());
Reference
<
chart2
::
XAxis
>
xAxisX
=
getAxisFromDoc
(
xChartDoc
,
0
,
0
,
0
);
Reference
<
chart2
::
XTitled
>
xTitle
(
xAxisX
,
UNO_QUERY_THROW
);
OUString
aTitleText
=
getTitleString
(
xTitle
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Linked To Source"
),
aTitleText
);
Reference
<
beans
::
XPropertySet
>
xPS
(
xAxisX
,
UNO_QUERY_THROW
);
sal_Int32
nNumFmt
=
-
1
;
xPS
->
getPropertyValue
(
"NumberFormat"
)
>>=
nNumFmt
;
CPPUNIT_ASSERT_MESSAGE
(
"Failed to get a number format value from X axis."
,
nNumFmt
!=
-
1
);
Reference
<
beans
::
XPropertySet
>
xNumPS
=
xNumberFormats
->
getByKey
(
nNumFmt
);
CPPUNIT_ASSERT
(
xNumPS
.
is
());
sal_Int16
nType
=
util
::
NumberFormat
::
UNDEFINED
;
xNumPS
->
getPropertyValue
(
"Type"
)
>>=
nType
;
sal_Int32
nNumFmt
=
getNumberFormatFromAxis
(
xAxisX
);
sal_Int16
nType
=
getNumberFormatType
(
xChartDoc
,
nNumFmt
);
CPPUNIT_ASSERT_MESSAGE
(
"X axis should be percentage format."
,
(
nType
&
util
::
NumberFormat
::
PERCENT
));
bool
bNumFmtLinked
=
false
;
Reference
<
beans
::
XPropertySet
>
xPS
(
xAxisX
,
uno
::
UNO_QUERY_THROW
);
xPS
->
getPropertyValue
(
"LinkNumberFormatToSource"
)
>>=
bNumFmtLinked
;
CPPUNIT_ASSERT_MESSAGE
(
"X axis should have its number format linked to source."
,
bNumFmtLinked
);
...
...
@@ -748,18 +738,12 @@ void Chart2ExportTest::testAxisNumberFormatODS()
aTitleText
=
getTitleString
(
xTitle
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Not Linked"
),
aTitleText
);
xPS
.
set
(
xAxisY
,
UNO_QUERY_THROW
);
nNumFmt
=
-
1
;
xPS
->
getPropertyValue
(
"NumberFormat"
)
>>=
nNumFmt
;
CPPUNIT_ASSERT_MESSAGE
(
"Failed to get a number format value from Y axis."
,
nNumFmt
!=
-
1
);
xNumPS
=
xNumberFormats
->
getByKey
(
nNumFmt
);
CPPUNIT_ASSERT
(
xNumPS
.
is
());
nType
=
util
::
NumberFormat
::
UNDEFINED
;
xNumPS
->
getPropertyValue
(
"Type"
)
>>=
nType
;
nNumFmt
=
getNumberFormatFromAxis
(
xAxisY
);
nType
=
getNumberFormatType
(
xChartDoc
,
nNumFmt
);
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should be a normal number format."
,
(
nType
&
util
::
NumberFormat
::
NUMBER
));
bNumFmtLinked
=
true
;
xPS
.
set
(
xAxisY
,
uno
::
UNO_QUERY_THROW
);
xPS
->
getPropertyValue
(
"LinkNumberFormatToSource"
)
>>=
bNumFmtLinked
;
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should not have its number format linked to source."
,
!
bNumFmtLinked
);
}
...
...
chart2/qa/extras/chart2import.cxx
Dosyayı görüntüle @
dc4355e5
...
...
@@ -40,6 +40,7 @@ public:
* hidden columns for internal data table yet).
*/
void
testPPTXHiddenDataSeries
();
void
testPPTXStackedNonStackedYAxis
();
void
testPPTChartSeries
();
void
testODPChartSeries
();
void
testBnc864396
();
...
...
@@ -70,6 +71,7 @@ public:
CPPUNIT_TEST
(
testPPTChartSeries
);
CPPUNIT_TEST
(
testPPTXChartSeries
);
CPPUNIT_TEST
(
testPPTXHiddenDataSeries
);
CPPUNIT_TEST
(
testPPTXStackedNonStackedYAxis
);
CPPUNIT_TEST
(
testODPChartSeries
);
CPPUNIT_TEST
(
testBnc864396
);
CPPUNIT_TEST
(
testBnc882383
);
...
...
@@ -365,6 +367,65 @@ void Chart2ImportTest::testPPTXHiddenDataSeries()
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Category 4"
),
aCategories
[
3
][
0
]);
}
void
Chart2ImportTest
::
testPPTXStackedNonStackedYAxis
()
{
load
(
"/chart2/qa/extras/data/pptx/"
,
"stacked-non-stacked-mix-y-axis.pptx"
);
// 1st chart is a normal stacked column.
Reference
<
chart2
::
XChartDocument
>
xChartDoc
(
getChartDocFromDrawImpress
(
0
,
0
),
uno
::
UNO_QUERY
);
CPPUNIT_ASSERT
(
xChartDoc
.
is
());
Reference
<
chart2
::
XTitled
>
xTitled
(
xChartDoc
,
uno
::
UNO_QUERY_THROW
);
OUString
aTitle
=
getTitleString
(
xTitled
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Stacked"
),
aTitle
);
// Get the Y-axis.
Reference
<
chart2
::
XAxis
>
xYAxis
=
getAxisFromDoc
(
xChartDoc
,
0
,
1
,
0
);
CPPUNIT_ASSERT
(
xYAxis
.
is
());
sal_Int32
nNumberFormat
=
getNumberFormatFromAxis
(
xYAxis
);
sal_Int16
nType
=
getNumberFormatType
(
xChartDoc
,
nNumberFormat
);
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should be a normal number format."
,
(
nType
&
util
::
NumberFormat
::
NUMBER
));
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should NOT be a percent format."
,
!
(
nType
&
util
::
NumberFormat
::
PERCENT
));
// 2nd chart is a percent-stacked column.
xChartDoc
.
set
(
getChartDocFromDrawImpress
(
1
,
0
),
uno
::
UNO_QUERY
);
CPPUNIT_ASSERT
(
xChartDoc
.
is
());
xTitled
.
set
(
xChartDoc
,
uno
::
UNO_QUERY_THROW
);
aTitle
=
getTitleString
(
xTitled
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"100% Stacked"
),
aTitle
);
// Get the Y-axis.
xYAxis
=
getAxisFromDoc
(
xChartDoc
,
0
,
1
,
0
);
CPPUNIT_ASSERT
(
xYAxis
.
is
());
// Get the number format of the Y-axis.
nNumberFormat
=
getNumberFormatFromAxis
(
xYAxis
);
nType
=
getNumberFormatType
(
xChartDoc
,
nNumberFormat
);
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should be a percent format."
,
(
nType
&
util
::
NumberFormat
::
PERCENT
));
// 3rd chart is a mixture of normal-stacked column with a percent-stacked
// area chart series. Excel in this case sets the Y-axis to be
// non-percent axis and we should do the same for interoperability.
xChartDoc
.
set
(
getChartDocFromDrawImpress
(
2
,
0
),
uno
::
UNO_QUERY
);
CPPUNIT_ASSERT
(
xChartDoc
.
is
());
xTitled
.
set
(
xChartDoc
,
uno
::
UNO_QUERY_THROW
);
aTitle
=
getTitleString
(
xTitled
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Stacked column mixed with 100% stacked area"
),
aTitle
);
// Get the Y-axis.
xYAxis
=
getAxisFromDoc
(
xChartDoc
,
0
,
1
,
0
);
CPPUNIT_ASSERT
(
xYAxis
.
is
());
// Get the number format of the Y-axis.
nNumberFormat
=
getNumberFormatFromAxis
(
xYAxis
);
nType
=
getNumberFormatType
(
xChartDoc
,
nNumberFormat
);
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should be a normal number format."
,
(
nType
&
util
::
NumberFormat
::
NUMBER
));
CPPUNIT_ASSERT_MESSAGE
(
"Y axis should NOT be a percent format."
,
!
(
nType
&
util
::
NumberFormat
::
PERCENT
));
}
void
Chart2ImportTest
::
testODPChartSeries
()
{
//test chart series names for odp
...
...
chart2/qa/extras/charttest.hxx
Dosyayı görüntüle @
dc4355e5
...
...
@@ -482,16 +482,42 @@ uno::Sequence < OUString > ChartTest::getImpressChartColumnDescriptions( const c
return
seriesList
;
}
OUString
getTitleString
(
const
Reference
<
chart2
::
XTitled
>&
xTitled
,
sal_Int32
nIndex
=
0
)
OUString
getTitleString
(
const
Reference
<
chart2
::
XTitled
>&
xTitled
)
{
uno
::
Reference
<
chart2
::
XTitle
>
xTitle
=
xTitled
->
getTitleObject
();
CPPUNIT_ASSERT
(
xTitle
.
is
());
uno
::
Sequence
<
uno
::
Reference
<
chart2
::
XFormattedString
>
>
aFSSeq
=
xTitle
->
getText
();
CPPUNIT_ASSERT
(
aFSSeq
.
getLength
()
>
nIndex
)
;
uno
::
Reference
<
chart2
::
XFormattedString
>
xFS
=
aFSSeq
[
nIndex
];
CPPUNIT_ASSERT
(
xFS
.
is
()
);
OUString
aText
;
for
(
sal_Int32
i
=
0
;
i
<
aFSSeq
.
getLength
();
++
i
)
aText
+=
aFSSeq
[
i
]
->
getString
(
);
return
xFS
->
getString
();
return
aText
;
}
sal_Int32
getNumberFormatFromAxis
(
const
Reference
<
chart2
::
XAxis
>&
xAxis
)
{
Reference
<
beans
::
XPropertySet
>
xPS
(
xAxis
,
uno
::
UNO_QUERY
);
CPPUNIT_ASSERT
(
xPS
.
is
());
sal_Int32
nNumberFormat
=
-
1
;
bool
bSuccess
=
xPS
->
getPropertyValue
(
CHART_UNONAME_NUMFMT
)
>>=
nNumberFormat
;
CPPUNIT_ASSERT
(
bSuccess
);
return
nNumberFormat
;
}
sal_Int16
getNumberFormatType
(
const
Reference
<
chart2
::
XChartDocument
>&
xChartDoc
,
sal_Int32
nNumberFormat
)
{
Reference
<
util
::
XNumberFormatsSupplier
>
xNFS
(
xChartDoc
,
uno
::
UNO_QUERY_THROW
);
Reference
<
util
::
XNumberFormats
>
xNumberFormats
=
xNFS
->
getNumberFormats
();
CPPUNIT_ASSERT
(
xNumberFormats
.
is
());
Reference
<
beans
::
XPropertySet
>
xNumPS
=
xNumberFormats
->
getByKey
(
nNumberFormat
);
CPPUNIT_ASSERT
(
xNumPS
.
is
());
sal_Int16
nType
=
util
::
NumberFormat
::
UNDEFINED
;
xNumPS
->
getPropertyValue
(
"Type"
)
>>=
nType
;
return
nType
;
}
#endif // INCLUDED_CHART2_QA_EXTRAS_CHARTTEST_HXX
...
...
chart2/qa/extras/data/pptx/stacked-non-stacked-mix-y-axis.pptx
0 → 100755
Dosyayı görüntüle @
dc4355e5
File added
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