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
f4dca0bf
Kaydet (Commit)
f4dca0bf
authored
Tem 04, 2014
tarafından
Markus Mohrhard
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
split sd's import and export tests
Change-Id: I06d5b02ec94c7bb74b64cd210267acf2be1a4931
üst
b5608fd4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
547 additions
and
361 deletions
+547
-361
CppunitTest_sd_export_tests.mk
sd/CppunitTest_sd_export_tests.mk
+119
-0
Module_sd.mk
sd/Module_sd.mk
+1
-0
export-tests.cxx
sd/qa/unit/export-tests.cxx
+427
-0
import-tests.cxx
sd/qa/unit/import-tests.cxx
+0
-361
No files found.
sd/CppunitTest_sd_export_tests.mk
0 → 100644
Dosyayı görüntüle @
f4dca0bf
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# 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/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,sd_export_test))
$(eval $(call gb_CppunitTest_use_external,sd_export_test,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sd_export_test, \
sd/qa/unit/export-tests \
))
$(eval $(call gb_CppunitTest_use_libraries,sd_export_test, \
$(call gb_Helper_optional,AVMEDIA,avmedia) \
basegfx \
comphelper \
cppu \
cppuhelper \
drawinglayer \
editeng \
for \
forui \
i18nlangtag \
msfilter \
oox \
sal \
salhelper \
sax \
sd \
sfx \
sot \
svl \
svt \
svx \
svxcore \
test \
tl \
tk \
ucbhelper \
unotest \
utl \
vcl \
xo \
$(gb_UWINAPI) \
))
$(eval $(call gb_CppunitTest_set_include,sd_export_test,\
-I$(SRCDIR)/sd/source/ui/inc \
-I$(SRCDIR)/sd/inc \
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_api,sd_export_test,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_ure,sd_export_test))
$(eval $(call gb_CppunitTest_use_vcl,sd_export_test))
$(eval $(call gb_CppunitTest_use_components,sd_export_test,\
animations/source/animcore/animcore \
basic/util/sb \
chart2/source/chartcore \
chart2/source/controller/chartcontroller \
comphelper/util/comphelp \
configmgr/source/configmgr \
dbaccess/util/dba \
desktop/source/deployment/deployment \
embeddedobj/util/embobj \
filter/source/config/cache/filterconfig1 \
filter/source/svg/svgfilter \
forms/util/frm \
framework/util/fwk \
i18npool/util/i18npool \
linguistic/source/lng \
oox/util/oox \
package/source/xstor/xstor \
package/util/package2 \
sax/source/expatwrap/expwrap \
sd/util/sd \
sd/util/sdfilt \
sd/util/sdd \
sfx2/util/sfx \
sot/util/sot \
svl/source/fsstor/fsstorage \
svtools/util/svt \
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/expand/ucpexpand1 \
ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/package/ucppkg1 \
ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
xmloff/util/xo \
xmlsecurity/util/xsec_fw \
xmlsecurity/util/xmlsecurity \
))
$(eval $(call gb_CppunitTest_use_configuration,sd_export_test))
$(eval $(call gb_CppunitTest_use_unittest_configuration,sd_export_test))
$(eval $(call gb_CppunitTest_add_arguments,sd_export_test,\
"-env:SVG_DISABLE_FONT_EMBEDDING=YEAH" \
))
$(call gb_CppunitTest_get_target,sd_export_test) : $(call gb_AllLangResTarget_get_target,sd)
# vim: set noet sw=4 ts=4:
sd/Module_sd.mk
Dosyayı görüntüle @
f4dca0bf
...
@@ -29,6 +29,7 @@ ifneq ($(OS),DRAGONFLY)
...
@@ -29,6 +29,7 @@ ifneq ($(OS),DRAGONFLY)
$(eval $(call gb_Module_add_check_targets,sd,\
$(eval $(call gb_Module_add_check_targets,sd,\
CppunitTest_sd_uimpress \
CppunitTest_sd_uimpress \
CppunitTest_sd_import_tests \
CppunitTest_sd_import_tests \
CppunitTest_sd_export_tests \
CppunitTest_sd_filters_test \
CppunitTest_sd_filters_test \
CppunitTest_sd_html_export_tests \
CppunitTest_sd_html_export_tests \
))
))
...
...
sd/qa/unit/export-tests.cxx
0 → 100644
Dosyayı görüntüle @
f4dca0bf
/* -*- 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 "sdmodeltestbase.hxx"
#include <svl/stritem.hxx>
#include <editeng/editobj.hxx>
#include <editeng/outlobj.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/escapementitem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/numitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/postitem.hxx>
#include <rsc/rscsfx.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdoashp.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdomedia.hxx>
#include <svx/svdoole2.hxx>
#include <svx/xflclit.hxx>
#include <animations/animationnodehelper.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/animations/XAnimationNode.hpp>
#include <com/sun/star/animations/XAnimate.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/chart/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
#include <config_features.h>
using
namespace
::
com
::
sun
::
star
;
class
SdFiltersTest
:
public
SdModelTestBase
{
public
:
void
testN821567
();
void
testBnc870233_1
();
void
testBnc870233_2
();
void
testN828390_4
();
void
testN828390_5
();
void
testMediaEmbedding
();
void
testFdo71961
();
void
testN828390
();
void
testBnc880763
();
void
testBnc862510_5
();
CPPUNIT_TEST_SUITE
(
SdFiltersTest
);
CPPUNIT_TEST
(
testN821567
);
CPPUNIT_TEST
(
testBnc870233_1
);
CPPUNIT_TEST
(
testBnc870233_2
);
CPPUNIT_TEST
(
testN828390_4
);
CPPUNIT_TEST
(
testN828390_5
);
CPPUNIT_TEST
(
testMediaEmbedding
);
CPPUNIT_TEST
(
testFdo71961
);
CPPUNIT_TEST
(
testN828390
);
CPPUNIT_TEST
(
testBnc880763
);
CPPUNIT_TEST
(
testBnc862510_5
);
CPPUNIT_TEST_SUITE_END
();
};
void
SdFiltersTest
::
testN821567
()
{
OUString
bgImage
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n821567.pptx"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
ODP
);
uno
::
Reference
<
drawing
::
XDrawPagesSupplier
>
xDoc
(
xDocShRef
->
GetDoc
()
->
getUnoModel
(),
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_MESSAGE
(
"not exactly one page"
,
xDoc
->
getDrawPages
()
->
getCount
()
==
1
);
uno
::
Reference
<
drawing
::
XDrawPage
>
xPage
(
xDoc
->
getDrawPages
()
->
getByIndex
(
0
),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
beans
::
XPropertySet
>
xPropSet
(
xPage
,
uno
::
UNO_QUERY
);
uno
::
Any
aAny
=
xPropSet
->
getPropertyValue
(
OUString
(
"Background"
)
);
if
(
aAny
.
hasValue
())
{
uno
::
Reference
<
beans
::
XPropertySet
>
aXBackgroundPropSet
;
aAny
>>=
aXBackgroundPropSet
;
aAny
=
aXBackgroundPropSet
->
getPropertyValue
(
OUString
(
"FillBitmapName"
));
aAny
>>=
bgImage
;
}
CPPUNIT_ASSERT_MESSAGE
(
"Slide Background is not exported properly"
,
!
bgImage
.
isEmpty
());
xDocShRef
->
DoClose
();
}
namespace
{
void
checkFontAttributes
(
const
SdrTextObj
*
pObj
,
sal_uInt32
nColor
,
bool
bCheckWeight
,
FontWeight
eWeight
,
bool
bCheckItalic
,
FontItalic
eItalic
)
{
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
const
EditTextObject
&
aEdit
=
pObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
std
::
vector
<
EECharAttrib
>
rLst
;
aEdit
.
GetCharAttribs
(
0
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxColorItem
*
pCharColor
=
dynamic_cast
<
const
SvxColorItem
*>
((
*
it
).
pAttr
);
if
(
pCharColor
)
{
CPPUNIT_ASSERT_EQUAL
(
nColor
,
pCharColor
->
GetValue
().
GetColor
());
}
if
(
bCheckWeight
)
{
const
SvxWeightItem
*
pWeight
=
dynamic_cast
<
const
SvxWeightItem
*>
((
*
it
).
pAttr
);
if
(
pWeight
)
{
CPPUNIT_ASSERT_EQUAL
(
eWeight
,
pWeight
->
GetWeight
());
}
}
if
(
bCheckItalic
)
{
const
SvxPostureItem
*
pPosture
=
dynamic_cast
<
const
SvxPostureItem
*>
((
*
it
).
pAttr
);
if
(
pPosture
)
{
CPPUNIT_ASSERT_EQUAL
(
eItalic
,
pPosture
->
GetPosture
());
}
}
}
}
}
void
SdFiltersTest
::
testBnc870233_1
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870233_1.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
// First shape has red, bold font
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
0
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0xff0000
),
true
,
WEIGHT_BOLD
,
true
,
ITALIC_NONE
);
}
// Second shape has blue, italic font
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
1
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x0000ff
),
true
,
WEIGHT_NORMAL
,
true
,
ITALIC_NORMAL
);
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc870233_2
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870233_2.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// The problem was in some SmartArts font color was wrong
// First smart art has blue font color (direct formatting)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
0
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x0000ff
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
// Second smart art has "dk2" font color (style)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
1
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x1F497D
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
// Third smart art has white font color (style)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
2
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0xffffff
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN828390_4
()
{
bool
bPassed
=
false
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/n828390_4.odp"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
std
::
vector
<
EECharAttrib
>
rLst
;
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
aEdit
.
GetCharAttribs
(
1
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxFontHeightItem
*
pFontHeight
=
dynamic_cast
<
const
SvxFontHeightItem
*>
((
*
it
).
pAttr
);
if
(
pFontHeight
)
CPPUNIT_ASSERT_MESSAGE
(
"Font height is wrong"
,
pFontHeight
->
GetHeight
()
==
1129
);
const
SvxFontItem
*
pFont
=
dynamic_cast
<
const
SvxFontItem
*>
((
*
it
).
pAttr
);
if
(
pFont
)
{
CPPUNIT_ASSERT_MESSAGE
(
"Font is wrong"
,
pFont
->
GetFamilyName
().
equalsAscii
(
"Arial"
));
bPassed
=
true
;
}
const
SvxWeightItem
*
pWeight
=
dynamic_cast
<
const
SvxWeightItem
*>
((
*
it
).
pAttr
);
if
(
pWeight
)
CPPUNIT_ASSERT_MESSAGE
(
"Font Weight is wrong"
,
pWeight
->
GetWeight
()
==
WEIGHT_BOLD
);
}
}
CPPUNIT_ASSERT
(
bPassed
);
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN828390_5
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/n828390_5.odp"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
const
SvxNumBulletItem
*
pNumFmt
=
dynamic_cast
<
const
SvxNumBulletItem
*>
(
aEdit
.
GetPool
()
->
GetItem2
(
EE_PARA_NUMBULLET
,
5
));
CPPUNIT_ASSERT
(
pNumFmt
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"Bullet's relative size is wrong!"
,
pNumFmt
->
GetNumRule
()
->
GetLevel
(
1
).
GetBulletRelSize
(),
sal_uInt16
(
75
)
);
// != 25
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testMediaEmbedding
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/media_embedding.odp"
));
#if HAVE_FEATURE_GLTF
xDocShRef
=
saveAndReload
(
xDocShRef
,
ODP
);
#endif
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
#if HAVE_FEATURE_GLTF
// First object is a glTF model
SdrMediaObj
*
pModelObj
=
dynamic_cast
<
SdrMediaObj
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"missing model"
,
pModelObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Models/duck/duck.json"
),
pModelObj
->
getMediaProperties
().
getURL
());
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"model/vnd.gltf+json"
),
pModelObj
->
getMediaProperties
().
getMimeType
());
#else
// If glTF is not supported, then the fallback image is imported
SdrGrafObj
*
pGrafic
=
dynamic_cast
<
SdrGrafObj
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"Could not load glTF fallback image"
,
pGrafic
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Models/Fallbacks/duck.png"
),
pGrafic
->
GetGrafStreamURL
());
#endif
// Second object is a sound
SdrMediaObj
*
pMediaObj
=
dynamic_cast
<
SdrMediaObj
*>
(
pPage
->
GetObj
(
3
));
CPPUNIT_ASSERT_MESSAGE
(
"missing media object"
,
pMediaObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Media/button-1.wav"
),
pMediaObj
->
getMediaProperties
().
getURL
());
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"application/vnd.sun.star.media"
),
pMediaObj
->
getMediaProperties
().
getMimeType
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testFdo71961
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/fdo71961.odp"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
// (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
SdrObjCustomShape
*
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
1
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Text to be always wrapped"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
true
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Custom shape non-wrapped text"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
false
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
3
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Custom shape wrapped text"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
true
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN828390
()
{
bool
bPassed
=
false
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n828390.pptx"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
std
::
vector
<
EECharAttrib
>
rLst
;
// Get the object
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
aEdit
.
GetCharAttribs
(
0
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxEscapementItem
*
pFontEscapement
=
dynamic_cast
<
const
SvxEscapementItem
*>
((
*
it
).
pAttr
);
if
(
pFontEscapement
)
{
if
(
pFontEscapement
->
GetEsc
()
==
-
25
)
{
bPassed
=
true
;
break
;
}
}
}
}
CPPUNIT_ASSERT_MESSAGE
(
"Subscript not exported properly"
,
bPassed
);
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc880763
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc880763.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Check z-order of the two shapes, use background color to identify them
// First object in the background has blue background color
const
SdrObject
*
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
0
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_uInt32
(
0x0000ff
),(
static_cast
<
const
XColorItem
&
>
(
pObj
->
GetMergedItem
(
XATTR_FILLCOLOR
))).
GetColorValue
().
GetColor
());
// Second object at the front has green background color
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
1
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_uInt32
(
0x00ff00
),(
static_cast
<
const
XColorItem
&
>
(
pObj
->
GetMergedItem
(
XATTR_FILLCOLOR
))).
GetColorValue
().
GetColor
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc862510_5
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc862510_5.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Same as testBnc870237, but here we check the horizontal spacing
const
SdrObject
*
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
1
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextUpperDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_UPPERDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextLowerDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_LOWERDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
7510
),
(
static_cast
<
const
SdrTextRightDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_RIGHTDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextLeftDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_LEFTDIST
))).
GetValue
());
xDocShRef
->
DoClose
();
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
SdFiltersTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sd/qa/unit/import-tests.cxx
Dosyayı görüntüle @
f4dca0bf
...
@@ -61,12 +61,8 @@ public:
...
@@ -61,12 +61,8 @@ public:
void
testN778859
();
void
testN778859
();
void
testFdo64512
();
void
testFdo64512
();
void
testFdo71075
();
void
testFdo71075
();
void
testN828390
();
void
testN828390_2
();
void
testN828390_2
();
void
testN828390_3
();
void
testN828390_3
();
void
testN828390_4
();
void
testN828390_5
();
void
testN821567
();
void
testFdo68594
();
void
testFdo68594
();
void
testFdo72998
();
void
testFdo72998
();
void
testFdo77027
();
void
testFdo77027
();
...
@@ -74,13 +70,7 @@ public:
...
@@ -74,13 +70,7 @@ public:
void
testN862510_1
();
void
testN862510_1
();
void
testN862510_2
();
void
testN862510_2
();
void
testN862510_4
();
void
testN862510_4
();
void
testFdo71961
();
void
testMediaEmbedding
();
void
testBnc870237
();
void
testBnc870237
();
void
testBnc870233_1
();
void
testBnc870233_2
();
void
testBnc880763
();
void
testBnc862510_5
();
CPPUNIT_TEST_SUITE
(
SdFiltersTest
);
CPPUNIT_TEST_SUITE
(
SdFiltersTest
);
CPPUNIT_TEST
(
testDocumentLayout
);
CPPUNIT_TEST
(
testDocumentLayout
);
...
@@ -89,12 +79,8 @@ public:
...
@@ -89,12 +79,8 @@ public:
CPPUNIT_TEST
(
testN778859
);
CPPUNIT_TEST
(
testN778859
);
CPPUNIT_TEST
(
testFdo64512
);
CPPUNIT_TEST
(
testFdo64512
);
CPPUNIT_TEST
(
testFdo71075
);
CPPUNIT_TEST
(
testFdo71075
);
CPPUNIT_TEST
(
testN828390
);
CPPUNIT_TEST
(
testN828390_2
);
CPPUNIT_TEST
(
testN828390_2
);
CPPUNIT_TEST
(
testN828390_3
);
CPPUNIT_TEST
(
testN828390_3
);
CPPUNIT_TEST
(
testN828390_4
);
CPPUNIT_TEST
(
testN828390_5
);
CPPUNIT_TEST
(
testN821567
);
CPPUNIT_TEST
(
testFdo68594
);
CPPUNIT_TEST
(
testFdo68594
);
CPPUNIT_TEST
(
testFdo72998
);
CPPUNIT_TEST
(
testFdo72998
);
CPPUNIT_TEST
(
testFdo77027
);
CPPUNIT_TEST
(
testFdo77027
);
...
@@ -102,13 +88,7 @@ public:
...
@@ -102,13 +88,7 @@ public:
CPPUNIT_TEST
(
testN862510_1
);
CPPUNIT_TEST
(
testN862510_1
);
CPPUNIT_TEST
(
testN862510_2
);
CPPUNIT_TEST
(
testN862510_2
);
CPPUNIT_TEST
(
testN862510_4
);
CPPUNIT_TEST
(
testN862510_4
);
CPPUNIT_TEST
(
testFdo71961
);
CPPUNIT_TEST
(
testMediaEmbedding
);
CPPUNIT_TEST
(
testBnc870237
);
CPPUNIT_TEST
(
testBnc870237
);
CPPUNIT_TEST
(
testBnc870233_1
);
CPPUNIT_TEST
(
testBnc870233_2
);
CPPUNIT_TEST
(
testBnc880763
);
CPPUNIT_TEST
(
testBnc862510_5
);
CPPUNIT_TEST_SUITE_END
();
CPPUNIT_TEST_SUITE_END
();
};
};
...
@@ -238,32 +218,6 @@ void SdFiltersTest::testN759180()
...
@@ -238,32 +218,6 @@ void SdFiltersTest::testN759180()
xDocShRef
->
DoClose
();
xDocShRef
->
DoClose
();
}
}
void
SdFiltersTest
::
testN821567
()
{
OUString
bgImage
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n821567.pptx"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
ODP
);
uno
::
Reference
<
drawing
::
XDrawPagesSupplier
>
xDoc
(
xDocShRef
->
GetDoc
()
->
getUnoModel
(),
uno
::
UNO_QUERY_THROW
);
CPPUNIT_ASSERT_MESSAGE
(
"not exactly one page"
,
xDoc
->
getDrawPages
()
->
getCount
()
==
1
);
uno
::
Reference
<
drawing
::
XDrawPage
>
xPage
(
xDoc
->
getDrawPages
()
->
getByIndex
(
0
),
uno
::
UNO_QUERY_THROW
);
uno
::
Reference
<
beans
::
XPropertySet
>
xPropSet
(
xPage
,
uno
::
UNO_QUERY
);
uno
::
Any
aAny
=
xPropSet
->
getPropertyValue
(
OUString
(
"Background"
)
);
if
(
aAny
.
hasValue
())
{
uno
::
Reference
<
beans
::
XPropertySet
>
aXBackgroundPropSet
;
aAny
>>=
aXBackgroundPropSet
;
aAny
=
aXBackgroundPropSet
->
getPropertyValue
(
OUString
(
"FillBitmapName"
));
aAny
>>=
bgImage
;
}
CPPUNIT_ASSERT_MESSAGE
(
"Slide Background is not exported properly"
,
!
bgImage
.
isEmpty
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN862510_1
()
void
SdFiltersTest
::
testN862510_1
()
{
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n862510_1.pptx"
)
);
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n862510_1.pptx"
)
);
...
@@ -333,43 +287,6 @@ void SdFiltersTest::testN862510_4()
...
@@ -333,43 +287,6 @@ void SdFiltersTest::testN862510_4()
xDocShRef
->
DoClose
();
xDocShRef
->
DoClose
();
}
}
void
SdFiltersTest
::
testN828390
()
{
bool
bPassed
=
false
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n828390.pptx"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
std
::
vector
<
EECharAttrib
>
rLst
;
// Get the object
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
aEdit
.
GetCharAttribs
(
0
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxEscapementItem
*
pFontEscapement
=
dynamic_cast
<
const
SvxEscapementItem
*>
((
*
it
).
pAttr
);
if
(
pFontEscapement
)
{
if
(
pFontEscapement
->
GetEsc
()
==
-
25
)
{
bPassed
=
true
;
break
;
}
}
}
}
CPPUNIT_ASSERT_MESSAGE
(
"Subscript not exported properly"
,
bPassed
);
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN828390_2
()
void
SdFiltersTest
::
testN828390_2
()
{
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n828390_2.pptx"
)
);
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n828390_2.pptx"
)
);
...
@@ -422,68 +339,6 @@ void SdFiltersTest::testN828390_3()
...
@@ -422,68 +339,6 @@ void SdFiltersTest::testN828390_3()
xDocShRef
->
DoClose
();
xDocShRef
->
DoClose
();
}
}
void
SdFiltersTest
::
testN828390_4
()
{
bool
bPassed
=
false
;
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/n828390_4.odp"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
std
::
vector
<
EECharAttrib
>
rLst
;
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
aEdit
.
GetCharAttribs
(
1
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxFontHeightItem
*
pFontHeight
=
dynamic_cast
<
const
SvxFontHeightItem
*>
((
*
it
).
pAttr
);
if
(
pFontHeight
)
CPPUNIT_ASSERT_MESSAGE
(
"Font height is wrong"
,
pFontHeight
->
GetHeight
()
==
1129
);
const
SvxFontItem
*
pFont
=
dynamic_cast
<
const
SvxFontItem
*>
((
*
it
).
pAttr
);
if
(
pFont
)
{
CPPUNIT_ASSERT_MESSAGE
(
"Font is wrong"
,
pFont
->
GetFamilyName
().
equalsAscii
(
"Arial"
));
bPassed
=
true
;
}
const
SvxWeightItem
*
pWeight
=
dynamic_cast
<
const
SvxWeightItem
*>
((
*
it
).
pAttr
);
if
(
pWeight
)
CPPUNIT_ASSERT_MESSAGE
(
"Font Weight is wrong"
,
pWeight
->
GetWeight
()
==
WEIGHT_BOLD
);
}
}
CPPUNIT_ASSERT
(
bPassed
);
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN828390_5
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/n828390_5.odp"
)
);
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
{
SdrObject
*
pObj
=
pPage
->
GetObj
(
0
);
SdrTextObj
*
pTxtObj
=
dynamic_cast
<
SdrTextObj
*>
(
pObj
);
CPPUNIT_ASSERT
(
pTxtObj
);
const
EditTextObject
&
aEdit
=
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
const
SvxNumBulletItem
*
pNumFmt
=
dynamic_cast
<
const
SvxNumBulletItem
*>
(
aEdit
.
GetPool
()
->
GetItem2
(
EE_PARA_NUMBULLET
,
5
));
CPPUNIT_ASSERT
(
pNumFmt
);
CPPUNIT_ASSERT_EQUAL_MESSAGE
(
"Bullet's relative size is wrong!"
,
pNumFmt
->
GetNumRule
()
->
GetLevel
(
1
).
GetBulletRelSize
(),
sal_uInt16
(
75
)
);
// != 25
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testN778859
()
void
SdFiltersTest
::
testN778859
()
{
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n778859.pptx"
));
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/n778859.pptx"
));
...
@@ -677,72 +532,6 @@ void SdFiltersTest::testStrictOOXML()
...
@@ -677,72 +532,6 @@ void SdFiltersTest::testStrictOOXML()
xDocShRef
->
DoClose
();
xDocShRef
->
DoClose
();
}
}
void
SdFiltersTest
::
testFdo71961
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/fdo71961.odp"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Export to .pptx changes all text frames to custom shape objects, which obey TextWordWrap property
// (which is false for text frames otherwise and is ignored). Check that frames that should wrap still do.
SdrObjCustomShape
*
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
1
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Text to be always wrapped"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
true
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Custom shape non-wrapped text"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
false
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
pTxtObj
=
dynamic_cast
<
SdrObjCustomShape
*>
(
pPage
->
GetObj
(
3
));
CPPUNIT_ASSERT_MESSAGE
(
"no text object"
,
pTxtObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"Custom shape wrapped text"
),
pTxtObj
->
GetOutlinerParaObject
()
->
GetTextObject
().
GetText
(
0
));
CPPUNIT_ASSERT_EQUAL
(
true
,
(
static_cast
<
const
SdrTextWordWrapItem
&>
(
pTxtObj
->
GetMergedItem
(
SDRATTR_TEXT_WORDWRAP
))).
GetValue
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testMediaEmbedding
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/media_embedding.odp"
));
#if HAVE_FEATURE_GLTF
xDocShRef
=
saveAndReload
(
xDocShRef
,
ODP
);
#endif
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
#if HAVE_FEATURE_GLTF
// First object is a glTF model
SdrMediaObj
*
pModelObj
=
dynamic_cast
<
SdrMediaObj
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"missing model"
,
pModelObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Models/duck/duck.json"
),
pModelObj
->
getMediaProperties
().
getURL
());
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"model/vnd.gltf+json"
),
pModelObj
->
getMediaProperties
().
getMimeType
());
#else
// If glTF is not supported, then the fallback image is imported
SdrGrafObj
*
pGrafic
=
dynamic_cast
<
SdrGrafObj
*>
(
pPage
->
GetObj
(
2
));
CPPUNIT_ASSERT_MESSAGE
(
"Could not load glTF fallback image"
,
pGrafic
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Models/Fallbacks/duck.png"
),
pGrafic
->
GetGrafStreamURL
());
#endif
// Second object is a sound
SdrMediaObj
*
pMediaObj
=
dynamic_cast
<
SdrMediaObj
*>
(
pPage
->
GetObj
(
3
));
CPPUNIT_ASSERT_MESSAGE
(
"missing media object"
,
pMediaObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"vnd.sun.star.Package:Media/button-1.wav"
),
pMediaObj
->
getMediaProperties
().
getURL
());
CPPUNIT_ASSERT_EQUAL
(
OUString
(
"application/vnd.sun.star.media"
),
pMediaObj
->
getMediaProperties
().
getMimeType
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc870237
()
void
SdFiltersTest
::
testBnc870237
()
{
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870237.pptx"
));
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870237.pptx"
));
...
@@ -763,156 +552,6 @@ void SdFiltersTest::testBnc870237()
...
@@ -763,156 +552,6 @@ void SdFiltersTest::testBnc870237()
xDocShRef
->
DoClose
();
xDocShRef
->
DoClose
();
}
}
namespace
{
void
checkFontAttributes
(
const
SdrTextObj
*
pObj
,
sal_uInt32
nColor
,
bool
bCheckWeight
,
FontWeight
eWeight
,
bool
bCheckItalic
,
FontItalic
eItalic
)
{
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
const
EditTextObject
&
aEdit
=
pObj
->
GetOutlinerParaObject
()
->
GetTextObject
();
std
::
vector
<
EECharAttrib
>
rLst
;
aEdit
.
GetCharAttribs
(
0
,
rLst
);
for
(
std
::
vector
<
EECharAttrib
>::
reverse_iterator
it
=
rLst
.
rbegin
();
it
!=
rLst
.
rend
();
++
it
)
{
const
SvxColorItem
*
pCharColor
=
dynamic_cast
<
const
SvxColorItem
*>
((
*
it
).
pAttr
);
if
(
pCharColor
)
{
CPPUNIT_ASSERT_EQUAL
(
nColor
,
pCharColor
->
GetValue
().
GetColor
());
}
if
(
bCheckWeight
)
{
const
SvxWeightItem
*
pWeight
=
dynamic_cast
<
const
SvxWeightItem
*>
((
*
it
).
pAttr
);
if
(
pWeight
)
{
CPPUNIT_ASSERT_EQUAL
(
eWeight
,
pWeight
->
GetWeight
());
}
}
if
(
bCheckItalic
)
{
const
SvxPostureItem
*
pPosture
=
dynamic_cast
<
const
SvxPostureItem
*>
((
*
it
).
pAttr
);
if
(
pPosture
)
{
CPPUNIT_ASSERT_EQUAL
(
eItalic
,
pPosture
->
GetPosture
());
}
}
}
}
}
void
SdFiltersTest
::
testBnc870233_1
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870233_1.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// The problem was all shapes had the same font (the last parsed font attribues overwrote all previous ones)
// First shape has red, bold font
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
0
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0xff0000
),
true
,
WEIGHT_BOLD
,
true
,
ITALIC_NONE
);
}
// Second shape has blue, italic font
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
1
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x0000ff
),
true
,
WEIGHT_NORMAL
,
true
,
ITALIC_NORMAL
);
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc870233_2
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc870233_2.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// The problem was in some SmartArts font color was wrong
// First smart art has blue font color (direct formatting)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
0
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x0000ff
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
// Second smart art has "dk2" font color (style)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
1
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0x1F497D
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
// Third smart art has white font color (style)
{
const
SdrTextObj
*
pObj
=
dynamic_cast
<
SdrTextObj
*>
(
pPage
->
GetObj
(
2
)
);
checkFontAttributes
(
pObj
,
sal_uInt32
(
0xffffff
),
false
,
WEIGHT_DONTKNOW
,
false
,
ITALIC_NONE
);
}
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc880763
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc880763.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Check z-order of the two shapes, use background color to identify them
// First object in the background has blue background color
const
SdrObject
*
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
0
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_uInt32
(
0x0000ff
),(
static_cast
<
const
XColorItem
&
>
(
pObj
->
GetMergedItem
(
XATTR_FILLCOLOR
))).
GetColorValue
().
GetColor
());
// Second object at the front has green background color
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
1
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_uInt32
(
0x00ff00
),(
static_cast
<
const
XColorItem
&
>
(
pObj
->
GetMergedItem
(
XATTR_FILLCOLOR
))).
GetColorValue
().
GetColor
());
xDocShRef
->
DoClose
();
}
void
SdFiltersTest
::
testBnc862510_5
()
{
::
sd
::
DrawDocShellRef
xDocShRef
=
loadURL
(
getURLFromSrc
(
"/sd/qa/unit/data/pptx/bnc862510_5.pptx"
));
xDocShRef
=
saveAndReload
(
xDocShRef
,
PPTX
);
SdDrawDocument
*
pDoc
=
xDocShRef
->
GetDoc
();
CPPUNIT_ASSERT_MESSAGE
(
"no document"
,
pDoc
!=
NULL
);
const
SdrPage
*
pPage
=
pDoc
->
GetPage
(
1
);
CPPUNIT_ASSERT_MESSAGE
(
"no page"
,
pPage
!=
NULL
);
// Same as testBnc870237, but here we check the horizontal spacing
const
SdrObject
*
pObj
=
dynamic_cast
<
SdrObject
*>
(
pPage
->
GetObj
(
1
)
);
CPPUNIT_ASSERT_MESSAGE
(
"no object"
,
pObj
!=
NULL
);
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextUpperDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_UPPERDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextLowerDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_LOWERDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
7510
),
(
static_cast
<
const
SdrTextRightDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_RIGHTDIST
))).
GetValue
());
CPPUNIT_ASSERT_EQUAL
(
sal_Int32
(
0
),
(
static_cast
<
const
SdrTextLeftDistItem
&
>
(
pObj
->
GetMergedItem
(
SDRATTR_TEXT_LEFTDIST
))).
GetValue
());
xDocShRef
->
DoClose
();
}
CPPUNIT_TEST_SUITE_REGISTRATION
(
SdFiltersTest
);
CPPUNIT_TEST_SUITE_REGISTRATION
(
SdFiltersTest
);
CPPUNIT_PLUGIN_IMPLEMENT
();
CPPUNIT_PLUGIN_IMPLEMENT
();
...
...
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