From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- slideshow/qa/debug/colors.sh | 16 + slideshow/qa/debug/nodetree.sh | 46 ++ slideshow/qa/debug/readme.txt | 19 + slideshow/qa/debug/timings.pl | 97 ++++ slideshow/qa/engine/data/video-loop.pptx | Bin 0 -> 46545 bytes slideshow/qa/engine/engine.cxx | 102 ++++ slideshow/qa/tools/mkeffects.pl | 827 +++++++++++++++++++++++++++++++ slideshow/qa/tools/mktransitions.pl | 714 ++++++++++++++++++++++++++ 8 files changed, 1821 insertions(+) create mode 100644 slideshow/qa/debug/colors.sh create mode 100644 slideshow/qa/debug/nodetree.sh create mode 100644 slideshow/qa/debug/readme.txt create mode 100644 slideshow/qa/debug/timings.pl create mode 100644 slideshow/qa/engine/data/video-loop.pptx create mode 100644 slideshow/qa/engine/engine.cxx create mode 100644 slideshow/qa/tools/mkeffects.pl create mode 100644 slideshow/qa/tools/mktransitions.pl (limited to 'slideshow/qa') diff --git a/slideshow/qa/debug/colors.sh b/slideshow/qa/debug/colors.sh new file mode 100644 index 000000000..c85a916d0 --- /dev/null +++ b/slideshow/qa/debug/colors.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Output a PS file with a legend for the node state colors +# + +cat < tree.ps' to generate a +# PostScript file for the AnimationNode tree generated during the show. +# Since these easily get pretty huge, use only one page, and try to +# limit the slide content (which have effects assigned, that is) to +# the bare minimum (to reproduce your bug, or whatever you need this +# for). +# +# The generated output will have all nodes color-coded with their state +# at the point when the tree was dumped (see colors.sh for the color +# codes) +# +# When looking for the mechanics that generate the relevant output, +# grep for the DEBUG_NODES_SHOWTREE macros in the slideshow source: +# Each such place dumps the current node tree to the trace output. Thus, +# if you need to check the tree state at other places or times, just add +# a DEBUG_NODES_SHOWTREE +# + +################################################### +# +# Generate node tree +# +################################################### + +egrep "Node connection|Node state" $1 | \ + sed -e '/Node state/ s/.*Node state.*: \(.*\)/\1/' \ + -e '/Node connection/ s/.*Node connection.*: \(n.*\)/\1/' | \ + \ +awk 'BEGIN { print "digraph Event_network {" }; { print } END { print "}" }' | \ + \ + \ +# fill a complete A1 page with graph output +dot -Gratio=fill -Gsize=23,33 -Tps +#dot -Gratio=fill -Gorientation=land -Tps diff --git a/slideshow/qa/debug/readme.txt b/slideshow/qa/debug/readme.txt new file mode 100644 index 000000000..eb458d686 --- /dev/null +++ b/slideshow/qa/debug/readme.txt @@ -0,0 +1,19 @@ +Recognized preprocessor switches +================================ + + - TIMELOG=t: enable time logging (also for product builds) + + +Debug tools overview +==================== + +nodetree.sh: + + Generates a number of tree graphs from a trace output file, showing + the tree of AnimationNodes at various instances of the + slideshow. Each node has a fill color corresponding to its current + state, a legend for the color values can be obtained by the colors.sh + script. + To generate output at other instances, use the DEBUG_NODES_SHOWTREE + macro in animationnodefactory.cxx. + diff --git a/slideshow/qa/debug/timings.pl b/slideshow/qa/debug/timings.pl new file mode 100644 index 000000000..f41181e43 --- /dev/null +++ b/slideshow/qa/debug/timings.pl @@ -0,0 +1,97 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +# +# 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# POD Documentation + +=head1 PROGRAM NAME AND AUTHOR + +Timings + +=head1 WHAT IT IS + +Extract move effect timings from a verbose trace log of the +presentation engine. Generated is a gnuplot data file, which can be +displayed issuing a 'gnuplot ' or at a gnuplot prompt, via +'load '. + +To generate such a verbose log file, rebuild module canvas and module +slideshow with VERBOSE=t defined in the environment, and debug=t at +the build tool command line. Then run the presentation, and redirect +stdout to your log file. + +Call me like this: timings.pl < trace-file > gnuplot-target + +The whole point in doing this is to detect jerks in shape movements, +which manifest themselves clearly in the graphed gnuplot output. Note +that there's some heuristic to recognize when one effect ends and +another has started: If the time difference between two subsequent +page flipping times is more than one second, a new effect is assumed +and a new gnuplot data record is generated. + +=head1 REQUIREMENTS + +Perl 5 + +=cut + +############################################################################## +# + +print "# Autogenerated by timings.pl, do not change\n", + "set ylabel \"position\"\n", + "set xlabel \"time\"\n", + "plot '-' index 0 using (\$1):(\$2) title \"Move effect position\" with lp\n", + "#0\n"; + +$state = 0; +$last_time = 0; +$record = 1; + +while( <> ) +{ + if( $state == 0 && m|next position will be| ) + { + ($posX) = m|.*\(([0-9]+.[0-9]+),|; + ($posY) = m|.*,([0-9]+.[0-9]+)\)|; + $state = 1; + } + elsif( $state == 1 && m|output pos is| ) + { + $state = 2; + } + elsif( $state == 2 && m|flip done at| ) + { + $state = 0; + ($flippingTime) = m|.*at ([0-9]+.[0-9]+)|; + + if( $last_time != 0 ) + { + if( $last_time + 1.0 < $flippingTime ) + { + # new record + print "\n\n#", $record, "\n"; + $record++; + } + } + + $last_time = $flippingTime; + print $flippingTime, " ", $posX, " ", $posY, "\n"; + } +} diff --git a/slideshow/qa/engine/data/video-loop.pptx b/slideshow/qa/engine/data/video-loop.pptx new file mode 100644 index 000000000..4cb7e20b7 Binary files /dev/null and b/slideshow/qa/engine/data/video-loop.pptx differ diff --git a/slideshow/qa/engine/engine.cxx b/slideshow/qa/engine/engine.cxx new file mode 100644 index 000000000..09e56f73d --- /dev/null +++ b/slideshow/qa/engine/engine.cxx @@ -0,0 +1,102 @@ +/* -*- 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 +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +using namespace ::com::sun::star; + +namespace +{ +/// Covers slideshow/source/engine/ fixes. +class Test : public test::BootstrapFixture, public unotest::MacrosTest +{ +private: + uno::Reference mxComponent; + +public: + void setUp() override; + void tearDown() override; + uno::Reference& getComponent() { return mxComponent; } +}; + +void Test::setUp() +{ + test::BootstrapFixture::setUp(); + + mxDesktop.set(frame::Desktop::create(mxComponentContext)); +} + +void Test::tearDown() +{ + if (mxComponent.is()) + mxComponent->dispose(); + + test::BootstrapFixture::tearDown(); +} + +/// Get the first command node in the animation tree of the page, assuming that it's the first child +/// (recursively). +uno::Reference +GetFirstCommandNodeOfPage(const uno::Reference& xPage) +{ + uno::Reference xAnimationNodeSupplier(xPage, + uno::UNO_QUERY); + uno::Reference xNode = xAnimationNodeSupplier->getAnimationNode(); + while (true) + { + if (xNode->getType() == animations::AnimationNodeType::COMMAND) + { + break; + } + uno::Reference xEnumAccess(xNode, uno::UNO_QUERY); + uno::Reference xNodes = xEnumAccess->createEnumeration(); + xNode.set(xNodes->nextElement(), uno::UNO_QUERY); + } + uno::Reference xRet(xNode, uno::UNO_QUERY); + return xRet; +} +} + +CPPUNIT_TEST_FIXTURE(Test, testLoopingFromAnimation) +{ + // Given a document with a looping video, the looping is defined as part of its auto-play + // animation (and not on the media shape): + OUString aURL = m_directories.getURLFromSrc(u"slideshow/qa/engine/data/video-loop.pptx"); + getComponent().set(loadFromDesktop(aURL)); + uno::Reference xDoc(getComponent(), uno::UNO_QUERY); + uno::Reference xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + uno::Reference xCommandNode = GetFirstCommandNodeOfPage(xPage); + uno::Reference xShape(xPage->getByIndex(0), uno::UNO_QUERY); + + // When determining if the video should be looping or not: + bool bLooping + = slideshow::internal::AnimationCommandNode::GetLoopingFromAnimation(xCommandNode, xShape); + + // Then make sure that we detect the looping is wanted: + CPPUNIT_ASSERT(bLooping); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/slideshow/qa/tools/mkeffects.pl b/slideshow/qa/tools/mkeffects.pl new file mode 100644 index 000000000..a3065b9a8 --- /dev/null +++ b/slideshow/qa/tools/mkeffects.pl @@ -0,0 +1,827 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + +# +# 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +use IO::File; +use Cwd; +use File::Spec; +use File::Spec::Functions; +use File::Temp; +use File::Path; + +$TempDir = ""; + + +# all the XML package generation is a blatant rip from AF's +# write-calc-doc.pl + + +############################################################################### +# Open a file with the given name. +# First it is checked if the temporary directory, in which all files for +# the document are gathered, is already present and create it if it is not. +# Then create the path to the file inside the temporary directory. +# Finally open the file and return a file handle to it. +# +sub open_file +{ + my $filename = pop @_; + + # Create base directory of temporary directory tree if not already + # present. + if ($TempDir eq "") + { + $TempDir = File::Temp::tempdir (CLEANUP => 1); + } + + # Create the path to the file. + my $fullname = File::Spec->catfile ($TempDir, $filename); + my ($volume,$directories,$file) = File::Spec->splitpath ($fullname); + mkpath (File::Spec->catpath ($volume,$directories,"")); + + # Open the file and return a file handle to it. + return new IO::File ($fullname, "w"); +} + + +############################################################################### +# Zip the files in the directory tree into the given file. +# +sub zip_dirtree +{ + my $filename = pop @_; + + my $cwd = getcwd; + my $zip_name = $filename; + + # We are about to change the directory. + # Therefore create an absolute pathname for the zip archive. + + # First transfer the drive from $cwd to $zip_name. This is a + # workaround for a bug in file_name_is_absolute which thinks + # the path \bla is an absolute path under DOS. + my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name); + my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd); + $volume = $volume_cwd if ($volume eq ""); + $zip_name = File::Spec->catpath ($volume,$directories,$file); + + # Add the current working directory to a relative path. + if ( ! file_name_is_absolute ($zip_name)) + { + $zip_name = File::Spec->catfile ($cwd, $zip_name); + + # Try everything to clean up the name. + $zip_name = File::Spec->rel2abs ($filename); + $zip_name = File::Spec->canonpath ($zip_name); + + # Remove .. directories from the middle of the path. + while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//) + { + $zip_name = $` . "/" . $'; + } + } + + # Just in case the zip program gets confused by an existing file with the + # same name as the one to be written that file is removed first. + if ( -e $filename) + { + if (unlink ($filename) == 0) + { + print "Existing file $filename could not be deleted.\n"; + print "Please close the application that uses it, then try again.\n"; + return; + } + } + + # Finally create the zip file. First change into the temporary directory + # so that the resulting zip file contains only paths relative to it. + print "zipping [$ZipCmd $ZipFlags $zip_name *]\n"; + chdir ($TempDir); + system ("$ZipCmd $ZipFlags $zip_name *"); + chdir ($cwd); +} + + +sub writeHeader +{ + print $OUT qq~ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +~; + +} + +sub writeSlideHeader +{ + my $titleText = pop @_; + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Slide: $slideNum\n"; + print $OUT " Topic: $titleText\n"; + print $OUT " Some text to show text effects\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + + +sub writeSlideFooter +{ + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeFooter +{ + print $OUT qq~ + + + +~; + +} + +sub writeTransitionAnimation +{ + my $transitionSubtype = pop @_; + my $transitionType = pop @_; + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writePropertyAnimation +{ + my $propertyEnd = pop @_; + my $propertyStart = pop @_; + my $propertyName = pop @_; + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeTransformAnimation +{ + my $propertyBy = pop @_; + my $propertyName = pop @_; + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writePathMotionAnimation +{ + my $slideNum = pop @_; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeManifest +{ + my $outFile = open_file("META-INF/manifest.xml"); + + print $outFile qq~ + + + + + +~; + + $outFile->close; +} + + +############################################################################### +# Print usage information. +# +sub usage () +{ + print <* [] + +output-file-name defaults to alltransitions.odp. + +options: -a Generate _all_ combinations of type, subtype, + direction, and mode + -h Print this usage information. +END_OF_USAGE +} + +############################################################################### +# Process the command line. +# +sub process_command_line +{ + foreach (@ARGV) + { + if (/^-h/) + { + usage; + exit 0; + } + } + + $global_gen_all=0; + $global_output_name = "alltransitions.odp"; + + my $j = 0; + for (my $i=0; $i<=$#ARGV; $i++) + { + if ($ARGV[$i] eq "-a") + { + $global_gen_all=1; + } + elsif ($ARGV[$i] =~ /^-/) + { + print "Unknown option $ARGV[$i]\n"; + usage; + exit 1; + } + elsif ($#ARGV == $i ) + { + $global_output_name = $ARGV[$i]; + } + } + + print "output to $global_output_name\n"; +} + +$transitionsRef = [ + + ["barWipe", + ["leftToRight", + "topToBottom"]], + + ["blindsWipe", + ["vertical", + "horizontal"]], + + ["boxWipe", + ["topLeft", + "topRight", + "bottomRight", + "bottomLeft", + "topCenter", + "rightCenter", + "bottomCenter", + "leftCenter"]], + + ["fourBoxWipe", + ["cornersIn", + "cornersOut"]], + + ["barnDoorWipe", + ["vertical", + "horizontal", + "diagonalBottomLeft", + "diagonalTopLeft"]], + + ["bowTieWipe", + ["vertical", + "horizontal"]], + + ["miscDiagonalWipe", + ["doubleBarnDoor", + "doubleDiamond"]], + + ["veeWipe", + ["down", + "left", + "up", + "right"]], + + ["barnVeeWipe", + ["top", + "left", + "up", + "right"]], + + ["zigZagWipe", + ["leftToRight", + "topToBottom"]], + + ["barnZigZagWipe", + ["vertical", + "horizontal"]], + + ["irisWipe", + ["rectangle", + "diamond"]], + + ["triangleWipe", + ["up", + "right", + "down", + "left"]], + + ["arrowHeadWipe", + ["up", + "right", + "down", + "left"]], + + ["pentagonWipe", + ["up", + "down"]], + + ["hexagonWipe", + ["horizontal", + "vertical"]], + + ["ellipseWipe", + ["circle", + "horizontal", + "vertical"]], + + ["eyeWipe", + ["vertical", + "horizontal"]], + + ["roundRectWipe", + ["horizontal", + "vertical"]], + + ["starWipe", + ["fourPoint", + "fivePoint", + "sixPoint"]], + + ["miscShapeWipe", + ["heart", + "keyhole"]], + + ["clockWipe", + ["clockwiseTwelve", + "clockwiseThree", + "clockwiseSix", + "clockwiseNine"]], + + ["pinWheelWipe", + ["oneBlade", + "twoBladeVertical", + "twoBladeHorizontal", + "threeBlade", + "fourBlade", + "eightBlade"]], + + ["singleSweepWipe", + ["clockwiseTop", + "clockwiseRight", + "clockwiseBottom", + "clockwiseLeft", + "clockwiseTopLeft", + "counterClockwiseBottomLeft", + "clockwiseBottomRight", + "counterClockwiseTopRight"]], + + ["fanWipe", + ["centerTop", + "centerRight", + "top", + "right", + "bottom", + "left"]], + + ["doubleFanWipe", + ["fanOutVertical", + "fanOutHorizontal", + "fanInVertical", + "fanInHorizontal"]], + + ["doubleSweepWipe", + ["parallelVertical", + "parallelDiagonal", + "oppositeVertical", + "oppositeHorizontal", + "parallelDiagonalTopLeft", + "parallelDiagonalBottomLeft"]], + + ["saloonDoorWipe", + ["top", + "left", + "bottom", + "right"]], + + ["windshieldWipe", + ["right", + "up", + "vertical", + "horizontal"]], + + ["snakeWipe", + ["topLeftHorizontal", + "topLeftVertical", + "topLeftDiagonal", + "topRightDiagonal", + "bottomRightDiagonal", + "bottomLeftDiagonal"]], + + ["spiralWipe", + ["topLeftClockwise", + "topRightClockwise", + "bottomRightClockwise", + "bottomLeftClockwise", + "topLeftCounterClockwise", + "topRightCounterClockwise", + "bottomRightCounterClockwise", + "bottomLeftCounterClockwise"]], + + ["parallelSnakesWipe", + ["verticalTopSame", + "verticalBottomSame", + "verticalTopLeftOpposite", + "verticalBottomLeftOpposite", + "horizontalLeftSame", + "horizontalRightSame", + "horizontalTopLeftOpposite", + "horizontalTopRightOpposite", + "diagonalBottomLeftOpposite", + "diagonalTopLeftOpposite"]], + + ["boxSnakesWipe", + ["twoBoxTop", + "twoBoxLeft", + "twoBoxRight", + "fourBoxVertical", + "fourBoxHorizontal"]], + + ["waterfallWipe", + ["verticalLeft", + "verticalRight", + "horizontalLeft", + "horizontalRight"]], + + ["pushWipe", + ["fromLeft", + "fromTop", + "fromRight", + "fromBottom", + "fromBottomRight", + "fromBottomLeft", + "fromTopRight", + "fromTopLeft", + "combHorizontal", + "combVertical"]], + + ["slideWipe", + ["fromLeft", + "fromTop", + "fromRight", + "fromBottom"]], + + ["fade", + ["crossfade", + "fadeToColor", + "fadeFromColor", + "fadeOverColor"]], + + ["randomBarWipe", + ["vertical", + "horizontal"]], + + ["checkerBoardWipe", + ["down", + "across"]], + + ["dissolve", + ["default"]] +]; + +$propertiesRef = [ + [ "value", "color", "#000000", "#FF0000" ], + + [ "string", "font-family", "Helvetica", "Times New Roman" ], + + [ "value", "font-size", "1pt", "1.5pt" ], + + [ "string", "font-style", "normal", "italic" ], + + [ "string", "text-underline", "none", "solid" ], + + [ "string", "font-weight", "normal", "bold" ], + + [ "value", "fill-color", "#000000", "#00FF00" ], + + [ "string", "fill", "none", "solid" ], + + [ "value", "height", "0.5*height", "height" ], + + [ "value", "stroke-color", "#000000", "#0000FF" ], + + [ "string", "stroke", "none", "solid" ], + + [ "value", "opacity", "0.0", "0.9" ], + + [ "value", "rotate", "0", "90" ], + + [ "value", "skewX", "0", "-1" ], + + [ "value", "skewY", "0", "-1" ], + + [ "string", "visibility", "hidden", "visible" ], + + [ "value", "width", "0.5*width", "width" ], + + [ "value", "x", "x-0.1", "x+0.1" ], + + [ "value", "y", "y-0.1", "y+0.1" ] + ]; + +$transformsRef = [ + ["translate", "0.5*width,0.5*height"], + ["scale", "0.5*width,0.5*height"], + ["rotate", "270"], + ["skewX", "-1"], + ["skewY", "1"] +]; + + +############################################################################### +# Main +############################################################################### + +$ZipCmd = $ENV{LOG_FILE_ZIP_CMD}; +$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS}; +# Provide default values for the zip command and it's flags. +if ( ! defined $ZipCmd) +{ + $ZipCmd = "zip" unless defined $ZipCmd; + $ZipFlags = "-r -q" unless defined $ZipFlags; +} + +process_command_line(); + +writeManifest(); + +$OUT = open_file( "content.xml" ); + +writeHeader(); + +$transitionNum=0; +writeSlideHeader($transitionNum, "Transition effects"); + +foreach $transitionRef (@$transitionsRef) +{ + $transitionType = @$transitionRef[0]; + + foreach $subtype (@{$transitionRef->[1]}) + { + writeTransitionAnimation($transitionNum, + $transitionType, + $subtype); + } +} + +writeSlideFooter(); + +writeSlideHeader(++$transitionNum, "Property effects"); + +foreach $propertyRef (@$propertiesRef) +{ + $propertyType = @$propertyRef[0]; + + if( $propertyType eq "value" ) + { + writePropertyAnimation( $transitionNum, @$propertyRef[1], @$propertyRef[2], @$propertyRef[3] ); + } + elsif( $propertyType eq "string" ) + { + } + else + { + die "Unexpected case"; + } +} + +writeSlideFooter(); + +writeSlideHeader(++$transitionNum, "Transformation effects"); + +foreach $transformRef (@$transformsRef) +{ + writeTransformAnimation( $transitionNum, @$transformRef[0], @$transformRef[1] ); +} + +writeSlideFooter(); + +writeSlideHeader(++$transitionNum, "Path motion effects"); +writePathMotionAnimation($transitionNum); +writeSlideFooter(); + + print $OUT qq~ + + + + Slide: 4 + Topic: Misc effects + Some text to show accelerate effects + Some text to show decelerate effects + Some text to show additive effects + Some text to show autoreverse effects + Some text to show key value effects + Some text to show discrete key value effects + Some text to show formula effects + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +~; + +writeSlideFooter(); + +# iterate, single paragraphs, word, lines, sentences, characters + + print $OUT qq~ + + + + Slide: 5 + Topic: Text effects + Some text to show iterated single paragraph + Some text to show iterated word-by-word effects + Some text to show iterated letter-by-letter effects + Some more text + Some more text + Some more text + Some more text + Some more text + + + + + + + + + + + + + + + + + + + + + + + + + + +~; + +writeSlideFooter(); + +writeFooter(); + +$OUT->close; + +zip_dirtree ($global_output_name); + diff --git a/slideshow/qa/tools/mktransitions.pl b/slideshow/qa/tools/mktransitions.pl new file mode 100644 index 000000000..3b499253c --- /dev/null +++ b/slideshow/qa/tools/mktransitions.pl @@ -0,0 +1,714 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; + +# +# 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/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +use IO::File; +use Cwd; +use File::Spec; +use File::Spec::Functions; +use File::Temp; +use File::Path; + +$TempDir = ""; +my $FirstTransitionIndex = 0; +my $LastTransitionIndex = -1; + + +# all the XML package generation is a blatant rip from AF's +# write-calc-doc.pl + + +############################################################################### +# Open a file with the given name. +# First it is checked if the temporary directory, in which all files for +# the document are gathered, is already present and create it if it is not. +# Then create the path to the file inside the temporary directory. +# Finally open the file and return a file handle to it. +# +sub open_file +{ + my $filename = pop @_; + + # Create base directory of temporary directory tree if not already + # present. + if ($TempDir eq "") + { + $TempDir = File::Temp::tempdir (CLEANUP => 1); + } + + # Create the path to the file. + my $fullname = File::Spec->catfile ($TempDir, $filename); + my ($volume,$directories,$file) = File::Spec->splitpath ($fullname); + mkpath (File::Spec->catpath ($volume,$directories,"")); + + # Open the file and return a file handle to it. + return new IO::File ($fullname, "w"); +} + + +############################################################################### +# Zip the files in the directory tree into the given file. +# +sub zip_dirtree +{ + my $filename = pop @_; + + my $cwd = getcwd; + my $zip_name = $filename; + + # We are about to change the directory. + # Therefore create an absolute pathname for the zip archive. + + # First transfer the drive from $cwd to $zip_name. This is a + # workaround for a bug in file_name_is_absolute which thinks + # the path \bla is an absolute path under DOS. + my ($volume,$directories,$file) = File::Spec->splitpath ($zip_name); + my ($volume_cwd,$directories_cwd,$file_cwd) = File::Spec->splitpath ($cwd); + $volume = $volume_cwd if ($volume eq ""); + $zip_name = File::Spec->catpath ($volume,$directories,$file); + + # Add the current working directory to a relative path. + if ( ! file_name_is_absolute ($zip_name)) + { + $zip_name = File::Spec->catfile ($cwd, $zip_name); + + # Try everything to clean up the name. + $zip_name = File::Spec->rel2abs ($filename); + $zip_name = File::Spec->canonpath ($zip_name); + + # Remove .. directories from the middle of the path. + while ($zip_name =~ /\/[^\/][^\.\/][^\/]*\/\.\.\//) + { + $zip_name = $` . "/" . $'; # $' + } + } + + # Just in case the zip program gets confused by an existing file with the + # same name as the one to be written that file is removed first. + if ( -e $filename) + { + if (unlink ($filename) == 0) + { + print "Existing file $filename could not be deleted.\n"; + print "Please close the application that uses it, then try again.\n"; + return; + } + } + + # Finally create the zip file. First change into the temporary directory + # so that the resulting zip file contains only paths relative to it. + print "zipping [$ZipCmd $ZipFlags $zip_name *]\n"; + chdir ($TempDir); + system ("$ZipCmd $ZipFlags $zip_name *"); + chdir ($cwd); + +} + + +sub writeHeader +{ + print $OUT qq~ + + + + +~; + +} + +sub writeSlideStyles +{ + my $mode = pop @_; + my $direction = pop @_; + my $transitionSubType = pop @_; + my $transitionType = pop @_; + my $slideNum = pop @_; + + return if $slideNum<$FirstTransitionIndex || ($LastTransitionIndex>=0 && $slideNum>$LastTransitionIndex); + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; +} + +sub writeIntermediate +{ + print $OUT qq~ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +~; + +} + +sub writeSlide +{ + my $mode = pop @_; + my $direction = pop @_; + my $transitionSubtype = pop @_; + my $transitionType = pop @_; + my $slideNum = pop @_; + + return if $slideNum<$FirstTransitionIndex || ($LastTransitionIndex>=0 && $slideNum>$LastTransitionIndex); + + print $OUT " "; + + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Transition “",$slideNum-1,"”\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Transition: ",$transitionType,"\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Subtype: ",$transitionSubtype,"\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Direction: ",$direction == 0 ? "forward" : "reverse","\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " Mode: ",$mode == 0 ? "in" : "out","\n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + print $OUT " \n"; + +} + +sub writeFooter +{ + print $OUT qq~ + + + +~; + +} + +sub writeManifest +{ + my $outFile = open_file("META-INF/manifest.xml"); + + print $outFile qq~ + + + + + +~; + + $outFile->close; +} + + +$transitionsRef = [ + + ["barWipe", + ["leftToRight", + "topToBottom"]], + + ["blindsWipe", + ["vertical", + "horizontal"]], + + ["boxWipe", + ["topLeft", + "topRight", + "bottomRight", + "bottomLeft", + "topCenter", + "rightCenter", + "bottomCenter", + "leftCenter"]], + + ["fourBoxWipe", + ["cornersIn", + "cornersOut"]], + + ["barnDoorWipe", + ["vertical", + "horizontal", + "diagonalBottomLeft", + "diagonalTopLeft"]], + + ["bowTieWipe", + ["vertical", + "horizontal"]], + + ["miscDiagonalWipe", + ["doubleBarnDoor", + "doubleDiamond"]], + + ["veeWipe", + ["down", + "left", + "up", + "right"]], + + ["barnVeeWipe", + ["top", + "left", + "up", + "right"]], + + ["zigZagWipe", + ["leftToRight", + "topToBottom"]], + + ["barnZigZagWipe", + ["vertical", + "horizontal"]], + + ["irisWipe", + ["rectangle", + "diamond"]], + + ["triangleWipe", + ["up", + "right", + "down", + "left"]], + + ["arrowHeadWipe", + ["up", + "right", + "down", + "left"]], + + ["pentagonWipe", + ["up", + "down"]], + + ["hexagonWipe", + ["horizontal", + "vertical"]], + + ["ellipseWipe", + ["circle", + "horizontal", + "vertical"]], + + ["eyeWipe", + ["vertical", + "horizontal"]], + + ["roundRectWipe", + ["horizontal", + "vertical"]], + + ["starWipe", + ["fourPoint", + "fivePoint", + "sixPoint"]], + + ["miscShapeWipe", + ["heart", + "keyhole"]], + + ["clockWipe", + ["clockwiseTwelve", + "clockwiseThree", + "clockwiseSix", + "clockwiseNine"]], + + ["pinWheelWipe", + ["oneBlade", + "twoBladeVertical", + "twoBladeHorizontal", + "threeBlade", + "fourBlade", + "eightBlade"]], + + ["singleSweepWipe", + ["clockwiseTop", + "clockwiseRight", + "clockwiseBottom", + "clockwiseLeft", + "clockwiseTopLeft", + "counterClockwiseBottomLeft", + "clockwiseBottomRight", + "counterClockwiseTopRight"]], + + ["fanWipe", + ["centerTop", + "centerRight", + "top", + "right", + "bottom", + "left"]], + + ["doubleFanWipe", + ["fanOutVertical", + "fanOutHorizontal", + "fanInVertical", + "fanInHorizontal"]], + + ["doubleSweepWipe", + ["parallelVertical", + "parallelDiagonal", + "oppositeVertical", + "oppositeHorizontal", + "parallelDiagonalTopLeft", + "parallelDiagonalBottomLeft"]], + + ["saloonDoorWipe", + ["top", + "left", + "bottom", + "right"]], + + ["windshieldWipe", + ["right", + "up", + "vertical", + "horizontal"]], + + ["snakeWipe", + ["topLeftHorizontal", + "topLeftVertical", + "topLeftDiagonal", + "topRightDiagonal", + "bottomRightDiagonal", + "bottomLeftDiagonal"]], + + ["spiralWipe", + ["topLeftClockwise", + "topRightClockwise", + "bottomRightClockwise", + "bottomLeftClockwise", + "topLeftCounterClockwise", + "topRightCounterClockwise", + "bottomRightCounterClockwise", + "bottomLeftCounterClockwise"]], + + ["parallelSnakesWipe", + ["verticalTopSame", + "verticalBottomSame", + "verticalTopLeftOpposite", + "verticalBottomLeftOpposite", + "horizontalLeftSame", + "horizontalRightSame", + "horizontalTopLeftOpposite", + "horizontalTopRightOpposite", + "diagonalBottomLeftOpposite", + "diagonalTopLeftOpposite"]], + + ["boxSnakesWipe", + ["twoBoxTop", + "twoBoxLeft", + "twoBoxRight", + "fourBoxVertical", + "fourBoxHorizontal"]], + + ["waterfallWipe", + ["verticalLeft", + "verticalRight", + "horizontalLeft", + "horizontalRight"]], + + ["pushWipe", + ["fromLeft", + "fromTop", + "fromRight", + "fromBottom", + "fromBottomRight", + "fromBottomLeft", + "fromTopRight", + "fromTopLeft", + "combHorizontal", + "combVertical"]], + + ["slideWipe", + ["fromLeft", + "fromTop", + "fromRight", + "fromBottom", + "fromBottomRight", + "fromBottomLeft", + "fromTopRight", + "fromTopLeft"]], + + ["fade", + ["crossfade", + "fadeToColor", + "fadeFromColor", + "fadeOverColor"]], + + ["randomBarWipe", + ["vertical", + "horizontal"]], + + ["checkerBoardWipe", + ["down", + "across"]], + + ["dissolve", + ["default"]] +]; + + +############################################################################### +# Print usage information. +# +sub usage () +{ + print <* [] + +output-file-name defaults to alltransitions.odp. + +options: -a Generate _all_ combinations of type, subtype, + direction, and mode + -h Print this usage information. + -f First transition to include, defaults to 0 + -l Last transition to include +END_OF_USAGE +} + +############################################################################### +# Process the command line. +# +sub process_command_line +{ + foreach (@ARGV) + { + if (/^-h/) + { + usage; + exit 0; + } + } + + $global_gen_all=0; + $global_output_name = "alltransitions.odp"; + + my $j = 0; + for (my $i=0; $i<=$#ARGV; $i++) + { + if ($ARGV[$i] eq "-a") + { + $global_gen_all=1; + } + elsif ($ARGV[$i] eq "-f") + { + $FirstTransitionIndex = $ARGV[++$i]; + } + elsif ($ARGV[$i] eq "-l") + { + $LastTransitionIndex = $ARGV[++$i]; + } + elsif ($ARGV[$i] =~ /^-/) + { + print "Unknown option $ARGV[$i]\n"; + usage; + exit 1; + } + elsif ($#ARGV == $i ) + { + $global_output_name = $ARGV[$i]; + } + } + + print "output to $global_output_name\n"; +} + + +############################################################################### +# Main +############################################################################### + +$ZipCmd = $ENV{LOG_FILE_ZIP_CMD}; +$ZipFlags = $ENV{LOG_FILE_ZIP_FLAGS}; +# Provide default values for the zip command and it's flags. +if ( ! defined $ZipCmd) +{ + $ZipCmd = "zip" unless defined $ZipCmd; + $ZipFlags = "-r -q" unless defined $ZipFlags; +} + +process_command_line(); + +writeManifest(); + +$OUT = open_file( "content.xml" ); + +writeHeader(); + +$slideNum=1; +foreach $transitionRef (@$transitionsRef) +{ + $transitionType = @$transitionRef[0]; + + foreach $subtype (@{$transitionRef->[1]}) + { + if( $global_gen_all != 0 ) + { + writeSlideStyles($slideNum++, + $transitionType, + $subtype, + 0, 0); + writeSlideStyles($slideNum++, + $transitionType, + $subtype, + 1, 0); + writeSlideStyles($slideNum++, + $transitionType, + $subtype, + 0, 1); + writeSlideStyles($slideNum++, + $transitionType, + $subtype, + 1, 1); + } + else + { + writeSlideStyles($slideNum++, + $transitionType, + $subtype, + 0, 0); + } + } +} + +writeIntermediate(); + +$slideNum=1; +foreach $transitionRef (@$transitionsRef) +{ + $transitionType = @$transitionRef[0]; + + foreach $subtype (@{$transitionRef->[1]}) + { + if( $global_gen_all != 0 ) + { + writeSlide($slideNum++, + $transitionType, + $subtype, + 0, 0); + writeSlide($slideNum++, + $transitionType, + $subtype, + 1, 0); + writeSlide($slideNum++, + $transitionType, + $subtype, + 0, 1); + writeSlide($slideNum++, + $transitionType, + $subtype, + 1, 1); + } + else + { + writeSlide($slideNum++, + $transitionType, + $subtype, + 0, 0); + } + } +} + +writeFooter(); + +$OUT->close; + +zip_dirtree ($global_output_name); + -- cgit v1.2.3