diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /smoketest/data/Basic/Standard/Test_Ext.xml | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'smoketest/data/Basic/Standard/Test_Ext.xml')
-rw-r--r-- | smoketest/data/Basic/Standard/Test_Ext.xml | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/smoketest/data/Basic/Standard/Test_Ext.xml b/smoketest/data/Basic/Standard/Test_Ext.xml new file mode 100644 index 000000000..a46449a13 --- /dev/null +++ b/smoketest/data/Basic/Standard/Test_Ext.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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 . + --> +<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> +<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Test_Ext" script:language="StarBasic">REM ***** BASIC ***** + +const cMessageExtensionService = "Extension Service" +const cMessageExtensionInstall = "Install Extension" +const cMessageExtensionUninstall = "Uninstall Extension" + +Sub TestExtensions + Dim oTestExtension as Object, obj_null as Object + Dim sCurrentMessage as String + Dim bResult as Boolean + Dim sImplementationNameString as String + sImplementationNameString = cUnoSmoketestTestExtension + "$_TestExtension" + + On Local Error GoTo EXTERROR + + gCurrentTestCase = cLogfileFailed + LocalTestLog% = OpenLogDat (GetLogFileName(gCurrentDocTest)) + + sCurrentMessage = "SmokeTestCommandEnvironment (implemented in Java)" + gCurrentTestCase = cEXTService + + 'Create an implementation of com.sun.star.ucb.XCommandEnvironment which is needed for + 'adding the extension. The implementation is in + 'smoketest/org/libreoffice/smoketest/SmoketestCommandEnvironment.java and the code is in smoketest.jar + cmdEnv = createUnoService(cUnoSmoketestCommandEnvironment) + + 'Create the component context and then get the singleton ExtensionManager + 'A singleton cannot be created with createUnoService + sCurrentMessage = cMessageExtensionService + ctx = getDefaultContext + ext_mgr = ctx.getValueByName("/singletons/" + cExtensionManager) + + LogTestResult( "Extension "+ cMessageExtensionService, not IsNull (ext_mgr) ) + if (IsNull(ext_mgr)) then + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub + End If + + sCurrentMessage = cMessageExtensionInstall + gCurrentTestCase = cEXTInstall + + 'Add the extension. We must provide a file URL here. + 'By passing "user" we determine that the actions we perform on + 'XExtensionManager only affect the user installation. To modify the share installation one would pass "share". + + Dim props() as Object + ext_mgr.addExtension(sExtensionURL, props, "user", obj_null, cmdEnv) + + 'Check if the extension has been added by creating a service which is contained in the extension. + oTestExtension = createUnoService(cUnoSmoketestTestExtension) + bResult = (oTestExtension.getImplementationName = sImplementationNameString) + LogTestResult( "Extension "+ cMessageExtensionInstall, bResult ) + if (not bResult) then + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub + End If + + sCurrentMessage = cMessageExtensionUninstall + gCurrentTestCase = cEXTUninstall + + 'Remove the package + ext_mgr.removeExtension("org.libreoffice.smoketest.TestExtension", cExtensionFileName, "user",obj_null, cmdEnv) + + 'Try to create the service which is contained in the now removed extension. + oTestExtension = createUnoService(cUnoSmoketestTestExtension) + + 'The service must not be available anymore. Therefore isNull must return true. + LogTestResult( "Extension "+ cMessageExtensionUninstall, IsNull (oTestExtension) ) + + Print #LocalTestLog, "---" + Close #LocalTestLog% + LocalTestLog = 0 + Exit Sub ' Without error + + EXTERROR: + If ( gCurrentTestCase = cLogfileFailed ) then + LogTestResult( " ", False ) + Exit Sub + else + LogTestResult( "Extension "+ sCurrentMessage, False ) + Close #LocalTestLog% + LocalTestLog = 0 + End If + Exit Sub ' With error + +End Sub +</script:module> |