incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject svn commit: r1401952 - in /incubator/ooo/trunk/test/testuno/source/fvt/uno/sd: ./ animation/ paragraph/ slideshow/
Date Thu, 25 Oct 2012 02:15:28 GMT
Author: wanglf
Date: Thu Oct 25 02:15:27 2012
New Revision: 1401952

URL: http://svn.apache.org/viewvc?rev=1401952&view=rev
Log:
#120782 - [testguo] testscripts for TextAnimation in presentation
patch by liupingtan, reviewed by WangLifeng

Added:
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/CustomAnimation.java
      - copied, changed from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomAnimation.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphStyle.java
      - copied, changed from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphStyle.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphTextProperty.java
      - copied, changed from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphTextProperty.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/CustomShow.java
      - copied, changed from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomShow.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/SlideShow.java
      - copied, changed from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/SlideShow.java
Removed:
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CheckBuildInBullet.java
    incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CheckCharacterStyle.java

Copied: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/CustomAnimation.java
(from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomAnimation.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/CustomAnimation.java?p2=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/CustomAnimation.java&p1=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomAnimation.java&r1=1401594&r2=1401952&rev=1401952&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomAnimation.java (original)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/CustomAnimation.java Thu
Oct 25 02:15:27 2012
@@ -1,4 +1,4 @@
-package fvt.uno.sd;
+package fvt.uno.sd.animation;
 
 import junit.framework.Assert;
 

Added: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java?rev=1401952&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java (added)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/animation/TextAnimation.java Thu Oct
25 02:15:27 2012
@@ -0,0 +1,183 @@
+package fvt.uno.sd.animation;
+
+import junit.framework.Assert;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Testspace;
+import org.openoffice.test.uno.UnoApp;
+
+import testlib.uno.ShapeUtil;
+
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Size;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexContainer;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XNamed;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.drawing.XShapes;
+import com.sun.star.frame.XStorable;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.presentation.AnimationEffect;
+import com.sun.star.presentation.XCustomPresentationSupplier;
+import com.sun.star.presentation.XPresentation;
+import com.sun.star.presentation.XPresentationSupplier;
+import com.sun.star.text.ControlCharacter;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.UnoRuntime;
+
+public class TextAnimation {
+	XPresentationSupplier sdDocument = null;
+	XPresentation pre = null;
+	XComponent precomp = null;
+	XComponent impressDocument = null;
+	XComponent reLoadFile = null;
+	XDrawPagesSupplier drawsupplier = null;
+	XDrawPages drawpages = null;
+
+	String filePath = null;
+
+	UnoApp unoApp = new UnoApp();
+
+	/**
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		unoApp.start();
+		createDocumentAndSlide();
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		unoApp.closeDocument(impressDocument);
+		unoApp.closeDocument(reLoadFile);
+		unoApp.close();
+	}
+
+	@Test
+	public void testTextAnimation() throws Exception {
+
+		XShapes xShapes;
+		XPropertySet xShapePropSet;
+		Point po = new Point(5000, 5000);
+
+		// create pages, so that three are available
+		drawpages.insertNewByIndex(0);
+		// get the shape container for page one
+		xShapes = (XShapes) UnoRuntime.queryInterface(XShapes.class,
+				drawpages.getByIndex(0));
+		// create a rectangle that is placed on the top left of the page
+		XShape xRectangle = ShapeUtil.createShape(impressDocument, po,
+				new Size(21000, 12500), "com.sun.star.drawing.RectangleShape");
+		xShapes.add(xRectangle);
+
+		XPropertySet xTextPropSet = addPortion(xRectangle, "Text Animation",
+				false);
+
+		xTextPropSet.setPropertyValue("TextEffect",
+				AnimationEffect.MOVE_FROM_RIGHT);
+
+		saveAndLoadSlide();
+
+		// assert if Text Animation is set
+		Assert.assertEquals("Text Animation Effect is MOVE_FROM_RIGHT",
+				AnimationEffect.MOVE_FROM_RIGHT,
+				xTextPropSet.getPropertyValue("TextEffect"));
+
+	}
+
+	public XPropertySet addPortion(XShape xShape, String sText,
+			boolean bNewParagraph)
+			throws com.sun.star.lang.IllegalArgumentException {
+		XText xText = (XText) UnoRuntime.queryInterface(XText.class, xShape);
+
+		XTextCursor xTextCursor = xText.createTextCursor();
+		xTextCursor.gotoEnd(false);
+		if (bNewParagraph == true) {
+			xText.insertControlCharacter(xTextCursor,
+					ControlCharacter.PARAGRAPH_BREAK, false);
+			xTextCursor.gotoEnd(false);
+		}
+		XTextRange xTextRange = (XTextRange) UnoRuntime.queryInterface(
+				XTextRange.class, xTextCursor);
+		xTextRange.setString(sText);
+		xTextCursor.gotoEnd(true);
+		XPropertySet xPropSet = (XPropertySet) UnoRuntime.queryInterface(
+				XPropertySet.class, xText);
+		return xPropSet;
+	}
+
+	/**
+	 * create a new presentation document and insert a new slide.
+	 * 
+	 * @throws Exception
+	 */
+	public void createDocumentAndSlide() throws Exception {
+		impressDocument = (XComponent) UnoRuntime.queryInterface(
+				XComponent.class, unoApp.newDocument("simpress"));
+		drawsupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(
+				XDrawPagesSupplier.class, impressDocument);
+		drawpages = drawsupplier.getDrawPages();
+
+		sdDocument = (XPresentationSupplier) UnoRuntime.queryInterface(
+				XPresentationSupplier.class, impressDocument);
+		pre = sdDocument.getPresentation();
+	}
+
+	/**
+	 * Save presentation and reLoad the slide.
+	 * 
+	 * @param no
+	 * @return void
+	 * @throws Exception
+	 */
+	public void saveAndLoadSlide() throws Exception {
+		reLoadFile = saveAndReloadDoc(impressDocument,
+				"StarOffice XML (Impress)", "odp");
+		drawsupplier = (XDrawPagesSupplier) UnoRuntime.queryInterface(
+				XDrawPagesSupplier.class, reLoadFile);
+		drawpages = drawsupplier.getDrawPages();
+
+		sdDocument = (XPresentationSupplier) UnoRuntime.queryInterface(
+				XPresentationSupplier.class, reLoadFile);
+		pre = sdDocument.getPresentation();
+	}
+
+	/**
+	 * save and reload Presentation document.
+	 * 
+	 * @param presentationDocument
+	 * @param sFilter
+	 * @param sExtension
+	 * @return
+	 * @throws Exception
+	 */
+	private XComponent saveAndReloadDoc(XComponent presentationDocument,
+			String sFilter, String sExtension) throws Exception {
+		filePath = Testspace.getPath("tmp/customshow." + sExtension);
+		PropertyValue[] aStoreProperties = new PropertyValue[2];
+		aStoreProperties[0] = new PropertyValue();
+		aStoreProperties[1] = new PropertyValue();
+		aStoreProperties[0].Name = "Override";
+		aStoreProperties[0].Value = true;
+		aStoreProperties[1].Name = "FilterName";
+		aStoreProperties[1].Value = sFilter;
+		XStorable xStorable = (XStorable) UnoRuntime.queryInterface(
+				XStorable.class, presentationDocument);
+		xStorable.storeToURL(FileUtil.getUrl(filePath), aStoreProperties);
+
+		return UnoRuntime.queryInterface(XComponent.class,
+				unoApp.loadDocument(filePath));
+	}
+}

Copied: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphStyle.java (from
r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphStyle.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphStyle.java?p2=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphStyle.java&p1=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphStyle.java&r1=1401594&r2=1401952&rev=1401952&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphStyle.java (original)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphStyle.java Thu Oct
25 02:15:27 2012
@@ -1,4 +1,4 @@
-package fvt.uno.sd;
+package fvt.uno.sd.paragraph;
 
 import junit.framework.Assert;
 

Copied: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphTextProperty.java
(from r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphTextProperty.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphTextProperty.java?p2=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphTextProperty.java&p1=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphTextProperty.java&r1=1401594&r2=1401952&rev=1401952&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/ParagraphTextProperty.java (original)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/paragraph/ParagraphTextProperty.java
Thu Oct 25 02:15:27 2012
@@ -1,4 +1,4 @@
-package fvt.uno.sd;
+package fvt.uno.sd.paragraph;
 
 import junit.framework.Assert;
 

Copied: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/CustomShow.java (from
r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomShow.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/CustomShow.java?p2=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/CustomShow.java&p1=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomShow.java&r1=1401594&r2=1401952&rev=1401952&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/CustomShow.java (original)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/CustomShow.java Thu Oct 25
02:15:27 2012
@@ -1,4 +1,4 @@
-package fvt.uno.sd;
+package fvt.uno.sd.slideshow;
 
 import junit.framework.Assert;
 

Copied: incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/SlideShow.java (from
r1401594, incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/SlideShow.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/SlideShow.java?p2=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/SlideShow.java&p1=incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/SlideShow.java&r1=1401594&r2=1401952&rev=1401952&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/SlideShow.java (original)
+++ incubator/ooo/trunk/test/testuno/source/fvt/uno/sd/slideshow/SlideShow.java Thu Oct 25
02:15:27 2012
@@ -1,4 +1,4 @@
-package fvt.uno.sd;
+package fvt.uno.sd.slideshow;
 
 import junit.framework.Assert;
 



Mime
View raw message