You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2020/07/31 15:36:38 UTC

[openoffice] 02/05: Add the registry modification that will disable clearing user personal info on saving, so that saving and reloading fields like revision number can be tested.

This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit ac56a168e7d000e3e410d6bdc94da73acbf62486
Author: Damjan Jovanovic <da...@apache.org>
AuthorDate: Fri Jul 31 04:45:12 2020 +0200

    Add the registry modification that will disable clearing user personal
    info on saving, so that saving and reloading fields like revision number
    can be tested.
    
    Closes #i128398# - autotest fvt.uno.sd.file.CheckFileProperties loses some DocumentProperties when saving
    
    Patch by: me
    
    (cherry picked from commit ce8ed6d52e206eeb0bf9eb7547f3b52546514d5e)
---
 .../source/fvt/uno/sd/file/CheckFileProperties.java        | 14 ++++++++++++--
 test/testuno/source/org/openoffice/test/uno/UnoApp.java    | 13 ++++++-------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/test/testuno/source/fvt/uno/sd/file/CheckFileProperties.java b/test/testuno/source/fvt/uno/sd/file/CheckFileProperties.java
index 8e169a5..f9b9407 100644
--- a/test/testuno/source/fvt/uno/sd/file/CheckFileProperties.java
+++ b/test/testuno/source/fvt/uno/sd/file/CheckFileProperties.java
@@ -29,6 +29,7 @@ import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openoffice.test.OpenOffice;
 import org.openoffice.test.uno.UnoApp;
 import org.openoffice.test.common.FileUtil;
 import org.openoffice.test.common.Testspace;
@@ -61,7 +62,7 @@ import com.sun.star.uno.UnoRuntime;
  */
 public class CheckFileProperties {
 
-	private static final UnoApp app = new UnoApp();
+	private static UnoApp app;
 
 	private XComponent m_xSDComponent = null;
 	private static String m_filePath = null;
@@ -117,6 +118,15 @@ public class CheckFileProperties {
 
 	@BeforeClass
 	public static void setUpConnection() throws Exception {
+		OpenOffice openOffice = UnoApp.getDefaultOpenOffice();
+                // #128398#
+                openOffice.addRegistryModifications(
+                    " <item oor:path=\"/org.openoffice.Office.Common/Security/Scripting\">\n" +
+                    "  <prop oor:name=\"RemovePersonalInfoOnSaving\" oor:op=\"fuse\">\n" +
+                    "   <value>false</value>\n" +
+                    "  </prop>\n" +
+                    " </item>");
+                app = new UnoApp(openOffice);
 		app.start();
 		m_filePath = Testspace.getPath("temp/CheckFileProperties.odp");	
 		FileUtil.deleteFile(m_filePath);
@@ -319,7 +329,7 @@ public class CheckFileProperties {
 		app.closeDocument(m_xSDComponent);
 		m_xSDComponent = app.loadDocument(m_filePath);
 		XDocumentProperties xDocPro2 = getDocumentProperties();
-		assertEquals("Revision number should be "+ revisionNumber+1, revisionNumber+1, xDocPro2.getEditingCycles());		
+		assertEquals("Revision number increments by 1", revisionNumber+1, xDocPro2.getEditingCycles());
 	}
 	
 	/*
diff --git a/test/testuno/source/org/openoffice/test/uno/UnoApp.java b/test/testuno/source/org/openoffice/test/uno/UnoApp.java
index 8c78593..261f3f5 100644
--- a/test/testuno/source/org/openoffice/test/uno/UnoApp.java
+++ b/test/testuno/source/org/openoffice/test/uno/UnoApp.java
@@ -62,16 +62,15 @@ public class UnoApp {
 	
 	private int reconnectCount = 10;
 	
-	private static OpenOffice defaultOpenOffice = null;
-	
-	static {
-		defaultOpenOffice = new OpenOffice();
-		defaultOpenOffice.addArgs("-nofirststartwizard", "-norestore", "-quickstart=no");
-		defaultOpenOffice.setUnoUrl(OpenOffice.DEFAULT_UNO_URL);
+	public static OpenOffice getDefaultOpenOffice() {
+		OpenOffice openOffice = new OpenOffice();
+		openOffice.addArgs("-nofirststartwizard", "-norestore", "-quickstart=no");
+		openOffice.setUnoUrl(OpenOffice.DEFAULT_UNO_URL);
+                return openOffice;
 	}
 	
 	public UnoApp() {
-		this.openOffice = defaultOpenOffice;
+		this.openOffice = getDefaultOpenOffice();
 	}
 	
 	public UnoApp(OpenOffice openOffice) {