diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-08 09:01:17 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-08 12:56:51 +0100 |
commit | dfee7d93b4e863d673c45921f79bb876b5738ea6 (patch) | |
tree | d82ed3b540f740ef2aae3cb5f58692bf56a76a1e /qadevOOo/tests/java | |
parent | 8f79f22a8d4b1c2d209c55cd618c24428960088f (diff) |
sw: get rid of FN_UNO_GRAPHIC_U_R_L and "GraphicURL" property
Change-Id: I6148016658e5bb46fd4f8765a233a434174791fd
Reviewed-on: https://gerrit.libreoffice.org/50922
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'qadevOOo/tests/java')
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/SwXTextDocument.java | 4 | ||||
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java | 28 | ||||
-rw-r--r-- | qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java | 24 |
3 files changed, 46 insertions, 10 deletions
diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java index 75ffd622d6dd..442d94b2cc05 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextDocument.java @@ -153,8 +153,8 @@ public class SwXTextDocument extends TestCase { SOfficeFactory.insertTextContent(xTextDoc, oTC); log.println(" adding TextGraphic"); - WriterTools.insertTextGraphic(xTextDoc, oDocMSF, 5200, 4200, 4400, - 4000, "space-metal.jpg", "SwXTextDocument"); + WriterTools.insertTextGraphic(xTextDoc, oDocMSF, Param.getComponentContext(), + 5200, 4200, 4400, 4000, "space-metal.jpg", "SwXTextDocument"); log.println(" adding EndNote"); diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java index 695bf61480da..7d2cfcdd19d3 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObject.java @@ -26,14 +26,19 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.PropertyValue; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.text.TextContentAnchorType; import com.sun.star.text.XText; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; +import com.sun.star.graphic.XGraphic; +import com.sun.star.graphic.XGraphicProvider; +import com.sun.star.graphic.GraphicProvider; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; +import com.sun.star.uno.XComponentContext; public class SwXTextGraphicObject extends TestCase { @@ -124,12 +129,26 @@ public class SwXTextGraphicObject extends TestCase { the_text.insertTextContent(the_cursor, the_content, true); log.println("adding graphic"); + + XComponentContext xContext = tParam.getComponentContext(); + + XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class, + xContext.getServiceManager().createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xContext)); + + String fullURL = util.utils.getFullTestURL("space-metal.jpg"); + + PropertyValue[] aMediaProps = new PropertyValue[] { new PropertyValue() }; + aMediaProps[0].Name = "URL"; + aMediaProps[0].Value = fullURL; + + XGraphic xGraphic = UnoRuntime.queryInterface(XGraphic.class, + xGraphicProvider.queryGraphic(aMediaProps)); + XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class, oObj); - String wat = util.utils.getFullTestURL("space-metal.jpg"); - oProps.setPropertyValue("AnchorType", - TextContentAnchorType.AT_PARAGRAPH); - oProps.setPropertyValue("GraphicURL", wat); + + oProps.setPropertyValue("AnchorType", TextContentAnchorType.AT_PARAGRAPH); + oProps.setPropertyValue("Graphic", xGraphic); oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500)); oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200)); oProps.setPropertyValue("Width", Integer.valueOf(4400)); @@ -167,4 +186,3 @@ public class SwXTextGraphicObject extends TestCase { } // finish method getTestEnvironment } // finish class SwXTextGraphicObject - diff --git a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java index 7e3a6dbb59cc..87982b31a5ab 100644 --- a/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java +++ b/qadevOOo/tests/java/mod/_sw/SwXTextGraphicObjects.java @@ -26,13 +26,18 @@ import lib.TestParameters; import util.SOfficeFactory; import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.PropertyValue; import com.sun.star.text.XText; import com.sun.star.text.XTextContent; import com.sun.star.text.XTextCursor; import com.sun.star.text.XTextDocument; import com.sun.star.text.XTextGraphicObjectsSupplier; +import com.sun.star.graphic.XGraphic; +import com.sun.star.graphic.XGraphicProvider; +import com.sun.star.graphic.GraphicProvider; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; +import com.sun.star.uno.XComponentContext; public class SwXTextGraphicObjects extends TestCase { @@ -112,10 +117,24 @@ public class SwXTextGraphicObjects extends TestCase { the_text.insertTextContent(the_cursor, the_content, true); log.println("adding graphic"); + + XComponentContext xContext = tParam.getComponentContext(); + + XGraphicProvider xGraphicProvider = UnoRuntime.queryInterface(XGraphicProvider.class, + xContext.getServiceManager().createInstanceWithContext("com.sun.star.graphic.GraphicProvider", xContext)); + + String fullURL = util.utils.getFullTestURL("space-metal.jpg"); + + PropertyValue[] aMediaProps = new PropertyValue[] { new PropertyValue() }; + aMediaProps[0].Name = "URL"; + aMediaProps[0].Value = fullURL; + + XGraphic xGraphic = UnoRuntime.queryInterface(XGraphic.class, + xGraphicProvider.queryGraphic(aMediaProps)); + XPropertySet oProps = UnoRuntime.queryInterface(XPropertySet.class, oObj); - String wat = util.utils.getFullTestURL("space-metal.jpg"); - oProps.setPropertyValue("GraphicURL", wat); + oProps.setPropertyValue("Graphic", xGraphic); oProps.setPropertyValue("HoriOrientPosition", Integer.valueOf(5500)); oProps.setPropertyValue("VertOrientPosition", Integer.valueOf(4200)); oProps.setPropertyValue("Width", Integer.valueOf(4400)); @@ -132,4 +151,3 @@ public class SwXTextGraphicObjects extends TestCase { } // finish method getTestEnvironment } // finish class SwXTextGraphicObjects - |