summaryrefslogtreecommitdiff
path: root/xmlscript
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-03-16 13:31:12 +0300
committerThorsten Behrens <thorsten.behrens@allotropia.de>2021-04-06 10:08:15 +0200
commitce135ba8a693fc0d4c749b7409bf9deb8ae8e59e (patch)
tree468d371dc12ff77413dde2bfca0bade5b0af7e91 /xmlscript
parentc47ad11f8c2e917adebbd5d7b3a3ef6cc4b3e670 (diff)
tdf#137652 add xmlscript unittest & infrastructure
entire module was not covered by unittests and there was no way to test some of the latest fixes done there, like f4a5893ece. Now it is possible and a test for https://gerrit.libreoffice.org/c/core/+/104619 was added Removed remains of older unused tests. Change-Id: Ide7bc3704efa1bb4bc62ed71bf4dd8b1ad4e800f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112569 Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'xmlscript')
-rw-r--r--xmlscript/CppunitTest_xmlscript_cppunit.mk43
-rw-r--r--xmlscript/Module_xmlscript.mk4
-rw-r--r--xmlscript/qa/cppunit/data/EmptyPopupItems.xdl13
-rw-r--r--xmlscript/qa/cppunit/data/test.xml (renamed from xmlscript/test/test.xml)0
-rw-r--r--xmlscript/qa/cppunit/data/w3c.jpg (renamed from xmlscript/test/w3c.jpg)bin2028 -> 2028 bytes
-rw-r--r--xmlscript/qa/cppunit/test.cxx222
-rw-r--r--xmlscript/test/imexp.cxx209
-rw-r--r--xmlscript/test/makefile.mk56
8 files changed, 282 insertions, 265 deletions
diff --git a/xmlscript/CppunitTest_xmlscript_cppunit.mk b/xmlscript/CppunitTest_xmlscript_cppunit.mk
new file mode 100644
index 000000000000..cedf2c50e694
--- /dev/null
+++ b/xmlscript/CppunitTest_xmlscript_cppunit.mk
@@ -0,0 +1,43 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,xmlscript_cppunit))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,xmlscript_cppunit, \
+ xmlscript/qa/cppunit/test \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,xmlscript_cppunit))
+$(eval $(call gb_CppunitTest_use_ure,xmlscript_cppunit))
+$(eval $(call gb_CppunitTest_use_vcl,xmlscript_cppunit))
+$(eval $(call gb_CppunitTest_use_rdb,xmlscript_cppunit,services))
+
+$(eval $(call gb_CppunitTest_use_custom_headers,xmlscript_cppunit,\
+ officecfg/registry \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,xmlscript_cppunit,\
+ libxml2 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,xmlscript_cppunit))
+
+$(eval $(call gb_CppunitTest_use_libraries,xmlscript_cppunit, \
+ comphelper \
+ cppu \
+ cppuhelper \
+ fwk \
+ sal \
+ test \
+ unotest \
+ utl \
+ xmlscript \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/xmlscript/Module_xmlscript.mk b/xmlscript/Module_xmlscript.mk
index 56df07de29d2..c76702a70fe3 100644
--- a/xmlscript/Module_xmlscript.mk
+++ b/xmlscript/Module_xmlscript.mk
@@ -14,4 +14,8 @@ $(eval $(call gb_Module_add_targets,xmlscript,\
Package_dtd \
))
+$(eval $(call gb_Module_add_check_targets,xmlscript,\
+ CppunitTest_xmlscript_cppunit \
+))
+
# vim: set noet sw=4 ts=4:
diff --git a/xmlscript/qa/cppunit/data/EmptyPopupItems.xdl b/xmlscript/qa/cppunit/data/EmptyPopupItems.xdl
new file mode 100644
index 000000000000..827469e95af2
--- /dev/null
+++ b/xmlscript/qa/cppunit/data/EmptyPopupItems.xdl
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="TestDialog" dlg:left="116" dlg:top="56" dlg:width="175" dlg:height="123" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:combobox dlg:id="ComboBox1" dlg:tab-index="0" dlg:left="9" dlg:top="15" dlg:width="92" dlg:height="15" dlg:spin="true">
+ <dlg:menupopup>
+ <dlg:menuitem dlg:value="Eintrag1"/>
+ <dlg:menuitem dlg:value=""/>
+ <dlg:menuitem dlg:value="Eintrag2"/>
+ </dlg:menupopup>
+ </dlg:combobox>
+ </dlg:bulletinboard>
+</dlg:window> \ No newline at end of file
diff --git a/xmlscript/test/test.xml b/xmlscript/qa/cppunit/data/test.xml
index 06e44309b13d..06e44309b13d 100644
--- a/xmlscript/test/test.xml
+++ b/xmlscript/qa/cppunit/data/test.xml
diff --git a/xmlscript/test/w3c.jpg b/xmlscript/qa/cppunit/data/w3c.jpg
index c541c20dcd1b..c541c20dcd1b 100644
--- a/xmlscript/test/w3c.jpg
+++ b/xmlscript/qa/cppunit/data/w3c.jpg
Binary files differ
diff --git a/xmlscript/qa/cppunit/test.cxx b/xmlscript/qa/cppunit/test.cxx
new file mode 100644
index 000000000000..692837a19615
--- /dev/null
+++ b/xmlscript/qa/cppunit/test.cxx
@@ -0,0 +1,222 @@
+/* -*- 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 <test/bootstrapfixture.hxx>
+#include <test/xmltesttools.hxx>
+#include <unotest/macros_test.hxx>
+#include <unotools/tempfile.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/frame/DispatchHelper.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XInputStreamProvider.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
+#include <comphelper/processfactory.hxx>
+#include <comphelper/propertysequence.hxx>
+
+#include <config_folders.h>
+#include <osl/file.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/byteseq.hxx>
+#include <sal/log.hxx>
+
+#include <xmlscript/xmldlg_imexp.hxx>
+#include <xmlscript/xml_helper.hxx>
+#include <cppuhelper/bootstrap.hxx>
+
+using namespace ::cppu;
+using namespace ::com::sun::star::uno;
+
+using namespace ::com::sun::star;
+
+/// Sample tests for import
+class XmlScriptTest : public test::BootstrapFixture, public unotest::MacrosTest, public XmlTestTools
+{
+ uno::Reference<lang::XComponent> mxComponent;
+ OUString maDataPath;
+
+ void testBasicElements();
+ void testEmptyPopupItems();
+
+ Reference<container::XNameContainer> importFile(std::u16string_view sFileName);
+ void exportToFile(std::u16string_view sFileName,
+ Reference<container::XNameContainer> const& xDialogModel);
+
+public:
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ virtual void registerNamespaces(xmlXPathContextPtr& pXmlXpathCtx) override
+ {
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("dlg"),
+ BAD_CAST("http://openoffice.org/2000/dialog"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("script"),
+ BAD_CAST("http://openoffice.org/2000/script"));
+ }
+ CPPUNIT_TEST_SUITE(XmlScriptTest);
+ CPPUNIT_TEST(testBasicElements);
+ CPPUNIT_TEST(testEmptyPopupItems);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void XmlScriptTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+ maDataPath = "/xmlscript/qa/cppunit/data/";
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void XmlScriptTest::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<container::XNameContainer> XmlScriptTest::importFile(std::u16string_view sFileName)
+{
+ OUString sFullName = m_directories.getURLFromSrc(maDataPath) + sFileName;
+ osl::File aFile(sFullName);
+ CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aFile.open(osl_File_OpenFlag_Read));
+ sal_uInt64 nBytes;
+ aFile.getSize(nBytes);
+ std::vector<sal_Int8> bytes(nBytes);
+ sal_uInt64 nBytesRead;
+ aFile.read(bytes.data(), nBytes, nBytesRead);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("File not read correctly", nBytes, nBytesRead);
+ aFile.close();
+
+ Reference<container::XNameContainer> xDialogModel(
+ mxComponentContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.awt.UnoControlDialogModel", mxComponentContext),
+ UNO_QUERY);
+
+ ::xmlscript::importDialogModel(::xmlscript::createInputStream(bytes), xDialogModel,
+ mxComponentContext, nullptr);
+
+ return xDialogModel;
+}
+
+void XmlScriptTest::exportToFile(std::u16string_view sURL,
+ Reference<container::XNameContainer> const& xDialogModel)
+{
+ Reference<io::XInputStreamProvider> xProvider(
+ ::xmlscript::exportDialogModel(xDialogModel, mxComponentContext, nullptr));
+ Reference<io::XInputStream> xStream(xProvider->createInputStream());
+
+ Sequence<sal_Int8> bytes;
+ sal_Int32 nRead = xStream->readBytes(bytes, xStream->available());
+ for (;;)
+ {
+ Sequence<sal_Int8> readBytes;
+ nRead = xStream->readBytes(readBytes, 1024);
+ if (!nRead)
+ break;
+
+ sal_Int32 nPos = bytes.getLength();
+ bytes.realloc(nPos + nRead);
+ memcpy(bytes.getArray() + nPos, readBytes.getConstArray(), static_cast<sal_uInt32>(nRead));
+ }
+
+ osl::File aFile(OUString() + sURL);
+ CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, aFile.open(osl_File_OpenFlag_Write));
+ sal_uInt64 nBytesWritten;
+ CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None,
+ aFile.write(bytes.getConstArray(), bytes.getLength(), nBytesWritten));
+ aFile.close();
+}
+
+void XmlScriptTest::testBasicElements()
+{
+ // Import
+ Reference<container::XNameContainer> xModel(importFile(u"test.xml"));
+ CPPUNIT_ASSERT(xModel.is());
+
+ // Export
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ exportToFile(aTempFile.GetURL(), xModel);
+
+ // Parse & check
+ xmlDocUniquePtr pXmlDoc = parseXml(aTempFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Ensure we have all elements
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[1]", "id", "button1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:button[2]", "id", "button3");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[1]", "id", "check1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[2]", "id", "check2");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:checkbox[3]", "id", "check3");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[1]", "id", "list1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:menulist[2]", "id", "list2");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox[1]", "id", "combo1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[1]", "id",
+ "radio1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[2]", "id",
+ "radio2");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[1]/dlg:radio[3]", "id",
+ "radio3");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:titledbox[1]", "id", "groupbox1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[1]", "id",
+ "radio5");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[2]", "id",
+ "radio7");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:radiogroup[2]/dlg:radio[3]", "id",
+ "radio8");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:text[1]", "id", "fixed1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:textfield[1]", "id", "field1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:textfield[2]", "id", "field2");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:img[1]", "id", "image1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:filecontrol[1]", "id", "file1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:datefield[1]", "id", "datefield1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:timefield[1]", "id", "time1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:patternfield[1]", "id", "pattern1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:currencyfield[1]", "id", "currency1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:numericfield[1]", "id", "numeric1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:fixedline[1]", "id", "fixedline1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:progressmeter[1]", "id", "progress1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:scrollbar[1]", "id", "scrollbar1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:formattedfield[1]", "id", "ffield0");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:formattedfield[2]", "id", "ffield1");
+}
+
+void XmlScriptTest::testEmptyPopupItems()
+{
+ // Import
+ Reference<container::XNameContainer> xModel(importFile(u"EmptyPopupItems.xdl"));
+ CPPUNIT_ASSERT(xModel.is());
+
+ // Export
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ exportToFile(aTempFile.GetURL(), xModel);
+
+ // Parse & check
+ xmlDocUniquePtr pXmlDoc = parseXml(aTempFile);
+ CPPUNIT_ASSERT(pXmlDoc);
+
+ // Ensure we have 3 items in combobox after import/export and second one is empty
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[1]",
+ "value", "Eintrag1");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[2]",
+ "value", "");
+ assertXPath(pXmlDoc, "/dlg:window/dlg:bulletinboard/dlg:combobox/dlg:menupopup/dlg:menuitem[3]",
+ "value", "Eintrag2");
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(XmlScriptTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx
deleted file mode 100644
index d4dfd1679423..000000000000
--- a/xmlscript/test/imexp.cxx
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- 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/.
- *
- * 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 .
- */
-
-#include <config_folders.h>
-
-#include <stdio.h>
-#include <osl/file.h>
-
-#include <rtl/ustrbuf.hxx>
-#include <sal/log.hxx>
-
-#include <xmlscript/xmldlg_imexp.hxx>
-#include <xmlscript/xml_helper.hxx>
-
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/bootstrap.hxx>
-
-#include <comphelper/processfactory.hxx>
-
-#include <vcl/svapp.hxx>
-
-#include <com/sun/star/awt/UnoControlDialog.hpp>
-#include <com/sun/star/awt/Toolkit.hpp>
-#include <com/sun/star/awt/XToolkit.hpp>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/awt/XControl.hpp>
-#include <com/sun/star/awt/XDialog.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <com/sun/star/registry/XImplementationRegistration.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-
-using namespace ::cppu;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-Reference< XComponentContext > createInitialComponentContext(
- OUString const & inst_dir )
-{
- Reference< XComponentContext > xContext;
-
- try
- {
- OUString file_url;
- oslFileError rc = osl_getFileURLFromSystemPath(
- inst_dir.pData, &file_url.pData );
- OSL_ASSERT( osl_File_E_None == rc );
-
- OUString unorc = file_url + ("/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("louno") );
-
- return defaultBootstrap_InitialComponentContext( unorc );
- }
-
- catch( const Exception& rExc )
- {
- SAL_WARN( "xmlscript", rExc );
- }
-
- return xContext;
-}
-
-Reference< container::XNameContainer > importFile(
- char const * fname,
- Reference< XComponentContext > const & xContext )
-{
- // create the input stream
- FILE *f = ::fopen( fname, "rb" );
- if (f)
- {
- ::fseek( f, 0 ,SEEK_END );
- int nLength = ::ftell( f );
- ::fseek( f, 0, SEEK_SET );
-
- ByteSequence bytes( nLength );
- ::fread( bytes.getArray(), nLength, 1, f );
- ::fclose( f );
-
- Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.UnoControlDialogModel", xContext ), UNO_QUERY );
- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel, xContext );
-
- return xModel;
- }
- else
- {
- throw Exception( "### Cannot read file!" );
- }
-}
-
-void exportToFile(
- char const * fname,
- Reference< container::XNameContainer > const & xModel,
- Reference< XComponentContext > const & xContext )
-{
- Reference< io::XInputStreamProvider > xProvider( ::xmlscript::exportDialogModel( xModel, xContext ) );
- Reference< io::XInputStream > xStream( xProvider->createInputStream() );
-
- Sequence< sal_Int8 > bytes;
- sal_Int32 nRead = xStream->readBytes( bytes, xStream->available() );
- for (;;)
- {
- Sequence< sal_Int8 > readBytes;
- nRead = xStream->readBytes( readBytes, 1024 );
- if (! nRead)
- break;
- OSL_ASSERT( readBytes.getLength() >= nRead );
-
- sal_Int32 nPos = bytes.getLength();
- bytes.realloc( nPos + nRead );
- memcpy( bytes.getArray() + nPos, readBytes.getConstArray(), (sal_uInt32)nRead );
- }
-
- FILE * f = ::fopen( fname, "w" );
- ::fwrite( bytes.getConstArray(), 1, bytes.getLength(), f );
- ::fclose( f );
-}
-
-class MyApp : public Application
-{
-public:
- void Main();
-};
-
-MyApp aMyApp;
-
-void MyApp::Main()
-{
- if (GetCommandLineParamCount() < 2)
- {
- OSL_FAIL( "usage: imexp inst_dir inputfile [outputfile]" );
- return;
- }
-
- Reference< XComponentContext > xContext(
- createInitialComponentContext( OUString( GetCommandLineParam( 0 ) ) ) );
- Reference< lang::XMultiServiceFactory > xMSF(
- xContext->getServiceManager(), UNO_QUERY );
-
- try
- {
- ::comphelper::setProcessServiceFactory( xMSF );
-
- Reference< awt::XToolkit> xToolkit = awt::Toolkit::create( xContext );
-
- // import dialogs
- OString aParam1( OUStringToOString(
- OUString( GetCommandLineParam( 1 ) ),
- RTL_TEXTENCODING_ASCII_US ) );
- Reference< container::XNameContainer > xModel(
- importFile( aParam1.getStr(), xContext ) );
- OSL_ASSERT( xModel.is() );
-
- Reference< awt::XUnoControlDialog > xDlg = UnoControlDialog::create( xContext );
- xDlg->setModel( xModel );
- xDlg->createPeer( xToolkit, 0 );
- xDlg->execute();
-
- if (GetCommandLineParamCount() == 3)
- {
- // write modified dialogs
- OString aParam2( OUStringToOString(
- OUString( GetCommandLineParam( 2 ) ), RTL_TEXTENCODING_ASCII_US ) );
- exportToFile( aParam2.getStr(), xModel, xContext );
- }
- }
- catch (const xml::sax::SAXException & rExc)
- {
- OUString aStr( rExc );
- uno::Exception exc;
- if (rExc.WrappedException >>= exc)
- {
- aStr += " >>> ";
- aStr += exc;
- }
- SAL_WARN( "xmlscript", aStr );
- }
- catch (const uno::Exception & rExc)
- {
- SAL_WARN( "xmlscript", rExc );
- }
-
- Reference< lang::XComponent > xComp( xContext, UNO_QUERY );
- if (xComp.is())
- {
- xComp->dispose();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlscript/test/makefile.mk b/xmlscript/test/makefile.mk
deleted file mode 100644
index 6a08433f13ba..000000000000
--- a/xmlscript/test/makefile.mk
+++ /dev/null
@@ -1,56 +0,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 .
-#
-PRJ=..
-
-PRJNAME=xmlscript
-TARGET=imexp
-TARGETTYPE=GUI
-LIBTARGET=NO
-ENABLE_EXCEPTIONS=TRUE
-
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# --- Files --------------------------------------------------------
-
-CXXFILES= \
- imexp.cxx
-
-OBJFILES= \
- $(OBJ)$/imexp.obj
-
-APP1TARGET=$(TARGET)
-APP1OBJS=$(OBJFILES)
-APP1STDLIBS= \
- $(TOOLSLIB) \
- $(SOTLIB) \
- $(SVTOOLLIB) \
- $(COMPHELPERLIB) \
- $(VCLLIB) \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(SALLIB) \
- $(XMLSCRIPTLIB)
-
-APP1DEF= $(MISC)$/imexp.def
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk