[Libreoffice-commits] core.git: 3 commits - oox/source sd/qa
Muthu Subramanian
sumuthu at collabora.com
Wed Nov 13 07:26:28 PST 2013
oox/source/export/drawingml.cxx | 13 +++++++++++++
sd/qa/unit/import-tests.cxx | 21 ++++++++++++---------
sd/qa/unit/sdmodeltestbase.hxx | 32 ++++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 9 deletions(-)
New commits:
commit 08a52b17cb2e8c4c2a8c1ad7b95d2cfc5a9e844e
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Wed Nov 13 20:54:46 2013 +0530
n#828390: Export subscript text.
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7a75d88..3f5731b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -697,6 +697,7 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
const char* italic = NULL;
const char* underline = NULL;
sal_Int32 nSize = 1800;
+ sal_Int32 nCharEscapement = 0;
if( GETAD( CharHeight ) )
nSize = (sal_Int32) (100*(*((float*) mAny.getValue())));
@@ -777,12 +778,24 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, sal_Bool bIs
usLanguage = aLanguageTag.getBcp47();
}
+ if( GETAD( CharEscapement ) )
+ mAny >>= nCharEscapement;
+
+ if( nCharEscapement && GETAD( CharEscapementHeight ) ) {
+ sal_uInt32 nCharEscapementHeight;
+ mAny >>= nCharEscapementHeight;
+ nSize = (nSize * nCharEscapementHeight) / 100;
+ // MSO uses default ~58% size
+ nSize = (nSize / 0.58);
+ }
+
mpFS->startElementNS( XML_a, XML_rPr,
XML_b, bold,
XML_i, italic,
XML_lang, usLanguage.isEmpty() ? NULL : USS( usLanguage ),
XML_sz, nSize == 1800 ? NULL : IS( nSize ),
XML_u, underline,
+ XML_baseline, nCharEscapement == 0 ? NULL : IS( nCharEscapement*1000 ),
FSEND );
// mso doesn't like text color to be placed after typeface
commit 5656393f02ddd501d60673b0686688156336f0ee
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Wed Nov 13 20:45:18 2013 +0530
Add export unit test helper to testDocumentLayout.
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 2a7de2d..6862815 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -88,16 +88,17 @@ the test, and re-running; it should break.
*/
void SdFiltersTest::testDocumentLayout()
{
- struct { const char *pInput, *pDump; } aFilesToCompare[] =
+ struct { const char *pInput, *pDump; sal_Int32 nExportType; } aFilesToCompare[] =
{
- { "odp/shapes-test.odp", "xml/shapes-test_page" },
- { "pptx/fdo47434-all.pptx", "pptx/xml/fdo47434_page" },
- { "n758621.ppt", "xml/n758621_" },
- { "fdo64586.ppt", "xml/fdo64586_" },
- { "n819614.pptx", "xml/n819614_" },
- { "n820786.pptx", "xml/n820786_" },
- { "n762695.pptx", "xml/n762695_" },
- { "n593612.pptx", "xml/n593612_" },
+ { "odp/shapes-test.odp", "xml/shapes-test_page", -1 },
+ { "pptx/fdo47434-all.pptx", "pptx/xml/fdo47434_page", -1 },
+ { "n758621.ppt", "xml/n758621_", -1 },
+ { "fdo64586.ppt", "xml/fdo64586_", -1 },
+ { "n819614.pptx", "xml/n819614_", -1 },
+ { "n820786.pptx", "xml/n820786_", -1 },
+ { "n762695.pptx", "xml/n762695_", -1 },
+ { "n593612.pptx", "xml/n593612_", -1 },
+ // { "pptx/n828390.pptx", "pptx/xml/n828390_", PPTX }, // Example
};
for ( int i = 0; i < static_cast< int >( SAL_N_ELEMENTS( aFilesToCompare ) ); ++i )
@@ -105,6 +106,8 @@ void SdFiltersTest::testDocumentLayout()
int nUpdateMe = -1; // index of test we want to update; supposedly only when the test is created
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pInput ) );
+ if( aFilesToCompare[i].nExportType >= 0 )
+ xDocShRef = saveAndReload( xDocShRef, aFilesToCompare[i].nExportType );
compareWithShapesDump( xDocShRef,
getPathFromSrc( "/sd/qa/unit/data/" ) + OUString::createFromAscii( aFilesToCompare[i].pDump ),
i == nUpdateMe );
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 6c05ffa..00b5892 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -120,10 +120,10 @@ protected:
return xDocShRef;
}
- ::sd::DrawDocShellRef saveAndReload( ::sd::DrawDocShell *pShell, sal_uLong nExportType )
+ ::sd::DrawDocShellRef saveAndReload( ::sd::DrawDocShell *pShell, sal_Int32 nExportType )
{
FileFormat *pFmt = &aFileFormats[0];
- if( nExportType < SAL_N_ELEMENTS( aFileFormats ) )
+ if( ( (sal_uInt32) nExportType ) < SAL_N_ELEMENTS( aFileFormats ) )
pFmt = &aFileFormats[ nExportType ];
OUString aExt = OUString( "." ) + OUString::createFromAscii( pFmt->pName );
utl::TempFile aTempFile( OUString(), &aExt );
commit 9694f8bc26fec366d518ce913a1a48b69fadf26c
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Wed Nov 13 17:34:47 2013 +0530
Adding unit test case helper for export and reload.
[Similar to the one in the sc module]
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx
index 945fdee..6c05ffa 100644
--- a/sd/qa/unit/sdmodeltestbase.hxx
+++ b/sd/qa/unit/sdmodeltestbase.hxx
@@ -18,6 +18,7 @@
#include "drawdoc.hxx"
#include "../source/ui/inc/DrawDocShell.hxx"
+#include "unotools/tempfile.hxx"
#include <rtl/strbuf.hxx>
#include <sfx2/docfile.hxx>
@@ -52,6 +53,10 @@ FileFormat aFileFormats[] = {
{ 0, 0, 0, 0, 0 }
};
+#define ODP 0
+#define PPT 1
+#define PPTX 2
+
/// Base class for filter tests loading or roundtriping a document, and asserting the document model.
class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
{
@@ -115,6 +120,33 @@ protected:
return xDocShRef;
}
+ ::sd::DrawDocShellRef saveAndReload( ::sd::DrawDocShell *pShell, sal_uLong nExportType )
+ {
+ FileFormat *pFmt = &aFileFormats[0];
+ if( nExportType < SAL_N_ELEMENTS( aFileFormats ) )
+ pFmt = &aFileFormats[ nExportType ];
+ OUString aExt = OUString( "." ) + OUString::createFromAscii( pFmt->pName );
+ utl::TempFile aTempFile( OUString(), &aExt );
+ aTempFile.EnableKillingFile();
+ SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE );
+ sal_uInt32 nExportFormat = 0;
+ if( pFmt->nFormatType == ODP_FORMAT_TYPE )
+ nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS;
+ SfxFilter* pExportFilter = new SfxFilter(
+ OUString::createFromAscii( pFmt->pFilterName ),
+ OUString(), pFmt->nFormatType, nExportFormat,
+ OUString::createFromAscii( pFmt->pTypeName ),
+ 0, OUString(),
+ OUString::createFromAscii( pFmt->pUserData ),
+ OUString("private:factory/simpress*") );
+ pExportFilter->SetVersion( SOFFICE_FILEFORMAT_CURRENT );
+ aStoreMedium.SetFilter( pExportFilter );
+ pShell->DoSaveAs( aStoreMedium );
+ pShell->DoClose();
+
+ return loadURL( aTempFile.GetURL() );
+ }
+
/** Dump shapes in xDocShRef, and compare the dump against content of pShapesDumpFileNameBase<number>.xml.
@param bCreate Instead of comparing to the reference file(s), create it/them.
More information about the Libreoffice-commits
mailing list