10#include <cppunit/TestAssert.h>
12#include <com/sun/star/beans/XPropertySet.hpp>
13#include <com/sun/star/graphic/XGraphic.hpp>
14#include <com/sun/star/text/XTextColumns.hpp>
15#include <com/sun/star/text/XTextSection.hpp>
30 aRawBitmap.SetPixel(0, 0, COL_LIGHTBLUE);
31 aRawBitmap.SetPixel(0, 1, COL_LIGHTGREEN);
32 aRawBitmap.SetPixel(1, 0, COL_LIGHTRED);
33 aRawBitmap.SetPixel(1, 1, COL_LIGHTMAGENTA);
37void writerFileWithBitmap(OUString
const& rURL)
39 BitmapEx aBitmapEx = createExampleBitmap();
40 SvFileStream aFileStream(rURL, StreamMode::READ | StreamMode::WRITE);
42 aWriter.write(aBitmapEx);
43 aFileStream.Seek(STREAM_SEEK_TO_BEGIN);
54 css::uno::Reference<css::beans::XPropertySet> xBaseIndex(
init(), css::uno::UNO_QUERY_THROW);
73 OUString
name =
"TextColumns";
75 css::uno::Reference<css::text::XTextColumns> xGetTextColumns;
76 CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(
name) >>= xGetTextColumns);
78 xGetTextColumns->setColumnCount(xGetTextColumns->getColumnCount() + 1);
79 xBaseIndex->setPropertyValue(
name, css::uno::Any(xGetTextColumns));
81 css::uno::Reference<css::text::XTextColumns> xSetTextColumns;
82 CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(
name) >>= xSetTextColumns);
90 OUString
name =
"BackGraphicURL";
94 xBaseIndex->getPropertyValue(
name);
96 catch (css::uno::RuntimeException
const& )
101 CPPUNIT_ASSERT_MESSAGE(
"Expected RuntimeException wasn't thrown", bOK);
105 writerFileWithBitmap(aTempFile.
GetURL());
107 css::uno::Reference<css::graphic::XGraphic> xGraphic;
108 CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(
"BackGraphic") >>= xGraphic);
109 CPPUNIT_ASSERT(!xGraphic.is());
111 xBaseIndex->setPropertyValue(
name, css::uno::Any(aTempFile.
GetURL()));
113 CPPUNIT_ASSERT(xBaseIndex->getPropertyValue(
"BackGraphic") >>= xGraphic);
114 CPPUNIT_ASSERT(xGraphic.is());
130 OUString
name =
"ContentSection";
132 css::uno::Reference<css::text::XTextSection> xGetTextSection;
133 CPPUNIT_ASSERT_MESSAGE(
name.toUtf8().getStr(),
134 xBaseIndex->getPropertyValue(
name) >>= xGetTextSection);
135 CPPUNIT_ASSERT_EQUAL_MESSAGE(
name.toUtf8().getStr(), OUString(
""),
136 xGetTextSection->getAnchor()->getString());
141 OUString
name =
"HeaderSection";
143 css::uno::Reference<css::text::XTextSection> xGetTextSection;
144 if (xBaseIndex->getPropertyValue(
name).hasValue())
145 CPPUNIT_ASSERT_MESSAGE(
name.toUtf8().getStr(),
146 xBaseIndex->getPropertyValue(
name) >>= xGetTextSection);
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testBaseIndexProperties()
void EnableKillingFile(bool bEnable=true)
OUString const & GetURL() const
void testStringOptionalProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &rName, const OUString &rValue)
void testStringProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const OUString &rValue)
void testBooleanProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name)
void testColorProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const util::Color &rValue)
void testBooleanOptionalProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &rName)
BitmapEx CreateFromData(sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_Int8 nBitCount, bool bReversColors, bool bReverseAlpha)