Kaydet (Commit) d7763fb3 authored tarafından Szymon Kłos's avatar Szymon Kłos Kaydeden (comit) Andras Timar

tdf#115394 export correct slide transition time in PPT

Change-Id: Ie293dd4cc128c256e39d54fdcd83bb5e13484662
Reviewed-on: https://gerrit.libreoffice.org/49345Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/49523Reviewed-by: 's avatarAndras Timar <andras.timar@collabora.com>
Tested-by: 's avatarAndras Timar <andras.timar@collabora.com>
üst 6f05db5a
...@@ -95,6 +95,7 @@ public: ...@@ -95,6 +95,7 @@ public:
void testEmbeddedPdf(); void testEmbeddedPdf();
void testTdf100926(); void testTdf100926();
void testTextRotation(); void testTextRotation();
void testTdf115394PPT();
CPPUNIT_TEST_SUITE(SdExportTest); CPPUNIT_TEST_SUITE(SdExportTest);
...@@ -112,6 +113,7 @@ public: ...@@ -112,6 +113,7 @@ public:
CPPUNIT_TEST(testEmbeddedPdf); CPPUNIT_TEST(testEmbeddedPdf);
CPPUNIT_TEST(testTdf100926); CPPUNIT_TEST(testTdf100926);
CPPUNIT_TEST(testTextRotation); CPPUNIT_TEST(testTextRotation);
CPPUNIT_TEST(testTdf115394PPT);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -708,6 +710,43 @@ void SdExportTest::testTextRotation() ...@@ -708,6 +710,43 @@ void SdExportTest::testTextRotation()
xDocShRef->DoClose(); xDocShRef->DoClose();
} }
void SdExportTest::testTdf115394PPT()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/ppt/tdf115394.ppt"), PPT);
// Export the document and import again for a check
uno::Reference< lang::XComponent > xComponent(xDocShRef->GetModel(), uno::UNO_QUERY);
uno::Reference<frame::XStorable> xStorable(xComponent, uno::UNO_QUERY);
utl::MediaDescriptor aMediaDescriptor;
aMediaDescriptor["FilterName"] <<= OStringToOUString(OString(aFileFormats[PPT].pFilterName), RTL_TEXTENCODING_UTF8);
utl::TempFile aTempFile;
aTempFile.EnableKillingFile();
xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
xComponent.set(xStorable, uno::UNO_QUERY);
xComponent->dispose();
xDocShRef = loadURL(aTempFile.GetURL(), PPT);
double fTransitionDuration;
// Fast
SdPage* pPage1 = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
fTransitionDuration = pPage1->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration);
// Medium
SdPage* pPage2 = xDocShRef->GetDoc()->GetSdPage(1, PageKind::Standard);
fTransitionDuration = pPage2->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration);
// Slow
SdPage* pPage3 = xDocShRef->GetDoc()->GetSdPage(2, PageKind::Standard);
fTransitionDuration = pPage3->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration);
xDocShRef->DoClose();
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -151,6 +151,7 @@ public: ...@@ -151,6 +151,7 @@ public:
void testActiveXCheckbox(); void testActiveXCheckbox();
void testTdf108926(); void testTdf108926();
void testTdf115394(); void testTdf115394();
void testTdf115394PPT();
bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected); bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport(); void testPatternImport();
...@@ -221,6 +222,7 @@ public: ...@@ -221,6 +222,7 @@ public:
CPPUNIT_TEST(testActiveXCheckbox); CPPUNIT_TEST(testActiveXCheckbox);
CPPUNIT_TEST(testTdf108926); CPPUNIT_TEST(testTdf108926);
CPPUNIT_TEST(testTdf115394); CPPUNIT_TEST(testTdf115394);
CPPUNIT_TEST(testTdf115394PPT);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -2293,6 +2295,29 @@ void SdImportTest::testTdf115394() ...@@ -2293,6 +2295,29 @@ void SdImportTest::testTdf115394()
xDocShRef->DoClose(); xDocShRef->DoClose();
} }
void SdImportTest::testTdf115394PPT()
{
sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/ppt/tdf115394.ppt"), PPT);
double fTransitionDuration;
// Fast
SdPage* pPage1 = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
fTransitionDuration = pPage1->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.5, fTransitionDuration);
// Medium
SdPage* pPage2 = xDocShRef->GetDoc()->GetSdPage(1, PageKind::Standard);
fTransitionDuration = pPage2->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(0.75, fTransitionDuration);
// Slow
SdPage* pPage3 = xDocShRef->GetDoc()->GetSdPage(2, PageKind::Standard);
fTransitionDuration = pPage3->getTransitionDuration();
CPPUNIT_ASSERT_EQUAL(1.0, fTransitionDuration);
xDocShRef->DoClose();
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -242,11 +242,31 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_ ...@@ -242,11 +242,31 @@ void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_
sal_Int32 nSlideTime = 0; // still has to !!! sal_Int32 nSlideTime = 0; // still has to !!!
sal_uInt8 nSpeed = 1; sal_uInt8 nSpeed = 1;
if ( GetPropertyValue( aAny, mXPagePropSet, "Speed" ) ) if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionDuration" ) )
{ {
css::presentation::AnimationSpeed aAs; css::presentation::AnimationSpeed aAs;
aAny >>= aAs; double fTransitionDuration = -1.0;
nSpeed = (sal_uInt8)aAs; aAny >>= fTransitionDuration;
if (fTransitionDuration >= 0)
{
if (fTransitionDuration <= 0.5)
{
aAs = css::presentation::AnimationSpeed::AnimationSpeed_FAST;
}
else if (fTransitionDuration >= 1.0)
{
aAs = css::presentation::AnimationSpeed::AnimationSpeed_SLOW;
}
else
{
aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
}
}
else
aAs = css::presentation::AnimationSpeed::AnimationSpeed_MEDIUM;
nSpeed = static_cast<sal_uInt8>(aAs);
} }
sal_Int16 nTT = 0; sal_Int16 nTT = 0;
if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionType" ) if ( GetPropertyValue( aAny, mXPagePropSet, "TransitionType" )
......
...@@ -1777,11 +1777,11 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations ...@@ -1777,11 +1777,11 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
} }
if ( nSpeed == 0 ) if ( nSpeed == 0 )
pPage->setTransitionDuration( 3.0 ); // slow pPage->setTransitionDuration( 1.0 ); // slow
else if ( nSpeed == 1 ) else if ( nSpeed == 1 )
pPage->setTransitionDuration( 2.0 ); // medium pPage->setTransitionDuration( 0.75 ); // medium
else if ( nSpeed == 2 ) else if ( nSpeed == 2 )
pPage->setTransitionDuration( 1.0 ); // fast pPage->setTransitionDuration( 0.5 ); // fast
if ( nBuildFlags & 0x400 ) // slidechange by time if ( nBuildFlags & 0x400 ) // slidechange by time
{ // time to show (in Ticks) { // time to show (in Ticks)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment