summaryrefslogtreecommitdiff
path: root/svl/qa/complex/ConfigItems/helper
diff options
context:
space:
mode:
Diffstat (limited to 'svl/qa/complex/ConfigItems/helper')
-rw-r--r--svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx392
-rw-r--r--svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx70
-rw-r--r--svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx245
-rw-r--r--svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx798
-rw-r--r--svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx203
-rw-r--r--svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx735
-rw-r--r--svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx84
-rw-r--r--svl/qa/complex/ConfigItems/helper/UserOptTest.cxx266
-rw-r--r--svl/qa/complex/ConfigItems/helper/UserOptTest.hxx70
-rw-r--r--svl/qa/complex/ConfigItems/helper/makefile.mk73
10 files changed, 2936 insertions, 0 deletions
diff --git a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx
new file mode 100644
index 000000000000..10112c07ac8c
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "AccessibilityOptTest.hxx"
+#include "configitems/accessibilityoptions_const.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+
+#include <comphelper/configurationhelper.hxx>
+#include <unotools/processfactory.hxx>
+
+namespace css = ::com::sun::star;
+
+AccessibilityOptTest::AccessibilityOptTest()
+{
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sAccessibility,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+}
+
+AccessibilityOptTest::~AccessibilityOptTest()
+{
+ if (m_xCfg.is())
+ m_xCfg.clear();
+}
+
+//=============================================================================
+//test GetAutoDetectSystemHC()
+void AccessibilityOptTest::impl_checkGetAutoDetectSystemHC()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bAutoDetectSystemHC;
+ sal_Bool bAutoDetectSystemHC_;
+
+ bAutoDetectSystemHC = aAccessibilityOpt.GetAutoDetectSystemHC();
+ xSet->setPropertyValue( s_sAutoDetectSystemHC, css::uno::makeAny(bAutoDetectSystemHC ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bAutoDetectSystemHC_ = aAccessibilityOpt.GetAutoDetectSystemHC();
+
+ if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetAutoDetectSystemHC() error!")), 0);
+}
+
+//=============================================================================
+//test GetIsForPagePreviews()
+void AccessibilityOptTest::impl_checkGetIsForPagePreviews()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsForPagePreviews ;
+ sal_Bool bIsForPagePreviews_;
+
+ bIsForPagePreviews = aAccessibilityOpt.GetIsForPagePreviews();
+ xSet->setPropertyValue( s_sIsForPagePreviews, css::uno::makeAny(bIsForPagePreviews ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsForPagePreviews_ = aAccessibilityOpt.GetIsForPagePreviews();
+
+ if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsForPagePreviews() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsHelpTipsDisappear()
+void AccessibilityOptTest::impl_checkGetIsHelpTipsDisappear()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsHelpTipsDisappear ;
+ sal_Bool bIsHelpTipsDisappear_;
+
+ bIsHelpTipsDisappear = aAccessibilityOpt.GetIsHelpTipsDisappear();
+ xSet->setPropertyValue( s_sIsHelpTipsDisappear, css::uno::makeAny(bIsHelpTipsDisappear ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsHelpTipsDisappear_ = aAccessibilityOpt.GetIsHelpTipsDisappear();
+
+ if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsHelpTipsDisappear() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAllowAnimatedGraphics()
+void AccessibilityOptTest::impl_checkGetIsAllowAnimatedGraphics()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedGraphics ;
+ sal_Bool bIsAllowAnimatedGraphics_;
+
+ bIsAllowAnimatedGraphics = aAccessibilityOpt.GetIsAllowAnimatedGraphics();
+ xSet->setPropertyValue( s_sIsAllowAnimatedGraphics, css::uno::makeAny(bIsAllowAnimatedGraphics ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAllowAnimatedGraphics_ = aAccessibilityOpt.GetIsAllowAnimatedGraphics();
+
+ if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedGraphics() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAllowAnimatedText()
+void AccessibilityOptTest::impl_checkGetIsAllowAnimatedText()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedText ;
+ sal_Bool bIsAllowAnimatedText_;
+
+ bIsAllowAnimatedText = aAccessibilityOpt.GetIsAllowAnimatedText();
+ xSet->setPropertyValue( s_sIsAllowAnimatedText, css::uno::makeAny(bIsAllowAnimatedText ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAllowAnimatedText_ = aAccessibilityOpt.GetIsAllowAnimatedText();
+
+ if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAllowAnimatedText() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsAutomaticFontColor()
+void AccessibilityOptTest::impl_checkGetIsAutomaticFontColor()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAutomaticFontColor ;
+ sal_Bool bIsAutomaticFontColor_;
+
+ bIsAutomaticFontColor = aAccessibilityOpt.GetIsAutomaticFontColor();
+ xSet->setPropertyValue( s_sIsAutomaticFontColor, css::uno::makeAny(bIsAutomaticFontColor ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsAutomaticFontColor_ = aAccessibilityOpt.GetIsAutomaticFontColor();
+
+ if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsAutomaticFontColor() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetIsSystemFont()
+void AccessibilityOptTest::impl_checkGetIsSystemFont()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSystemFont ;
+ sal_Bool bIsSystemFont_;
+
+ bIsSystemFont = aAccessibilityOpt.GetIsSystemFont();
+ xSet->setPropertyValue( s_sIsSystemFont, css::uno::makeAny(bIsSystemFont ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsSystemFont_ = aAccessibilityOpt.GetIsSystemFont();
+
+ if ( bIsSystemFont_ == bIsSystemFont )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetIsSystemFont() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkGetHelpTipSeconds()
+void AccessibilityOptTest::impl_checkGetHelpTipSeconds()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nHelpTipSeconds ;
+ sal_Int16 nHelpTipSeconds_;
+
+ nHelpTipSeconds = aAccessibilityOpt.GetHelpTipSeconds();
+ xSet->setPropertyValue( s_sHelpTipSeconds, css::uno::makeAny(sal_Int16(nHelpTipSeconds+1)) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ nHelpTipSeconds_ = aAccessibilityOpt.GetHelpTipSeconds();
+
+ if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetHelpTipSeconds() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkIsSelectionInReadonly()
+void AccessibilityOptTest::impl_checkIsSelectionInReadonly()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSelectionInReadonly ;
+ sal_Bool bIsSelectionInReadonly_;
+
+ bIsSelectionInReadonly = aAccessibilityOpt.IsSelectionInReadonly();
+ xSet->setPropertyValue( s_sIsSelectionInReadonly, css::uno::makeAny(bIsSelectionInReadonly ? sal_False:sal_True) );
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ bIsSelectionInReadonly_ = aAccessibilityOpt.IsSelectionInReadonly();
+
+ if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will not throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSelectionInReadonly() error!")), 0);
+}
+
+//=============================================================================
+//test SetAutoDetectSystemHC()
+void AccessibilityOptTest::impl_checkSetAutoDetectSystemHC()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bAutoDetectSystemHC;
+ sal_Bool bAutoDetectSystemHC_;
+
+ xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC;
+ aAccessibilityOpt.SetAutoDetectSystemHC( bAutoDetectSystemHC ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sAutoDetectSystemHC) >>= bAutoDetectSystemHC_;
+
+ if ( bAutoDetectSystemHC_ == bAutoDetectSystemHC )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetAutoDetectSystemHC() error!")), 0);
+}
+
+//=============================================================================
+//test SetIsForPagePreviews()
+void AccessibilityOptTest::impl_checkSetIsForPagePreviews()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsForPagePreviews ;
+ sal_Bool bIsForPagePreviews_;
+
+ xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews;
+ aAccessibilityOpt.SetIsForPagePreviews( bIsForPagePreviews ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsForPagePreviews) >>= bIsForPagePreviews_;
+
+ if ( bIsForPagePreviews_ == bIsForPagePreviews )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsForPagePreviews() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsHelpTipsDisappear()
+void AccessibilityOptTest::impl_checkSetIsHelpTipsDisappear()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsHelpTipsDisappear ;
+ sal_Bool bIsHelpTipsDisappear_;
+
+ xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear;
+ aAccessibilityOpt.SetIsHelpTipsDisappear( bIsHelpTipsDisappear ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsHelpTipsDisappear) >>= bIsHelpTipsDisappear_;
+
+ if ( bIsHelpTipsDisappear_ == bIsHelpTipsDisappear )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsHelpTipsDisappear() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAllowAnimatedGraphics()
+void AccessibilityOptTest::impl_checkSetIsAllowAnimatedGraphics()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedGraphics ;
+ sal_Bool bIsAllowAnimatedGraphics_;
+
+ xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics;
+ aAccessibilityOpt.SetIsAllowAnimatedGraphics( bIsAllowAnimatedGraphics ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bIsAllowAnimatedGraphics_;
+
+ if ( bIsAllowAnimatedGraphics_ == bIsAllowAnimatedGraphics )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedGraphics() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAllowAnimatedText()
+void AccessibilityOptTest::impl_checkSetIsAllowAnimatedText()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAllowAnimatedText ;
+ sal_Bool bIsAllowAnimatedText_;
+
+ xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText;
+ aAccessibilityOpt.SetIsAllowAnimatedText( bIsAllowAnimatedText ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAllowAnimatedText) >>= bIsAllowAnimatedText_;
+
+ if ( bIsAllowAnimatedText_ == bIsAllowAnimatedText )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAllowAnimatedText() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsAutomaticFontColor()
+void AccessibilityOptTest::impl_checkSetIsAutomaticFontColor()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsAutomaticFontColor ;
+ sal_Bool bIsAutomaticFontColor_;
+
+ xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor;
+ aAccessibilityOpt.SetIsAutomaticFontColor( bIsAutomaticFontColor ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsAutomaticFontColor) >>= bIsAutomaticFontColor_;
+
+ if ( bIsAutomaticFontColor_ == bIsAutomaticFontColor )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsAutomaticFontColor() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetIsSystemFont()
+void AccessibilityOptTest::impl_checkSetIsSystemFont()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSystemFont ;
+ sal_Bool bIsSystemFont_;
+
+ xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont;
+ aAccessibilityOpt.SetIsSystemFont( bIsSystemFont ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsSystemFont) >>= bIsSystemFont_;
+
+ if ( bIsSystemFont_ == bIsSystemFont )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetIsSystemFont() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetHelpTipSeconds()
+void AccessibilityOptTest::impl_checkSetHelpTipSeconds()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Int16 nHelpTipSeconds ;
+ sal_Int16 nHelpTipSeconds_;
+
+ xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds;
+ aAccessibilityOpt.SetHelpTipSeconds( sal_Int16(nHelpTipSeconds+1) );
+ xSet->getPropertyValue(s_sHelpTipSeconds) >>= nHelpTipSeconds_;
+
+ if ( nHelpTipSeconds_ == nHelpTipSeconds )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetHelpTipSeconds() error!")), 0);
+}
+
+//=============================================================================
+//test impl_checkSetSelectionInReadonly()
+void AccessibilityOptTest::impl_checkSetSelectionInReadonly()
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCfg, css::uno::UNO_QUERY);
+ sal_Bool bIsSelectionInReadonly ;
+ sal_Bool bIsSelectionInReadonly_;
+
+ xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly;
+ aAccessibilityOpt.SetSelectionInReadonly( bIsSelectionInReadonly ? sal_False:sal_True );
+ xSet->getPropertyValue(s_sIsSelectionInReadonly) >>= bIsSelectionInReadonly_;
+
+ if ( bIsSelectionInReadonly_ == bIsSelectionInReadonly )//old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSelectionInReadonly() error!")), 0);
+}
+
+//=============================================================================
+void AccessibilityOptTest::impl_checkAccessibilityOptions()
+{
+ impl_checkGetAutoDetectSystemHC();
+ impl_checkGetIsForPagePreviews();
+ impl_checkGetIsHelpTipsDisappear();
+ impl_checkGetIsAllowAnimatedGraphics();
+ impl_checkGetIsAllowAnimatedText();
+ impl_checkGetIsAutomaticFontColor();
+ impl_checkGetIsSystemFont();
+ impl_checkGetHelpTipSeconds();
+ impl_checkIsSelectionInReadonly();
+
+ impl_checkSetAutoDetectSystemHC();
+ impl_checkSetIsForPagePreviews();
+ impl_checkSetIsHelpTipsDisappear();
+ impl_checkSetIsAllowAnimatedGraphics();
+ impl_checkSetIsAllowAnimatedText();
+ impl_checkSetIsAutomaticFontColor();
+ impl_checkSetIsSystemFont();
+ impl_checkSetHelpTipSeconds();
+ impl_checkSetSelectionInReadonly();
+}
diff --git a/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx
new file mode 100644
index 000000000000..cf2146f54e49
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/AccessibilityOptTest.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX
+#define SVTOOLS_ACCESSIBILITYOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svl/accessibilityoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class AccessibilityOptTest
+{
+public:
+ AccessibilityOptTest();
+ ~AccessibilityOptTest();
+
+ void impl_checkAccessibilityOptions();
+
+private:
+ void impl_checkGetAutoDetectSystemHC();
+ void impl_checkGetIsForPagePreviews();
+ void impl_checkGetIsHelpTipsDisappear();
+ void impl_checkGetIsAllowAnimatedGraphics();
+ void impl_checkGetIsAllowAnimatedText();
+ void impl_checkGetIsAutomaticFontColor();
+ void impl_checkGetIsSystemFont();
+ void impl_checkGetHelpTipSeconds();
+ void impl_checkIsSelectionInReadonly();
+
+ void impl_checkSetAutoDetectSystemHC();
+ void impl_checkSetIsForPagePreviews();
+ void impl_checkSetIsHelpTipsDisappear();
+ void impl_checkSetIsAllowAnimatedGraphics();
+ void impl_checkSetIsAllowAnimatedText();
+ void impl_checkSetIsAutomaticFontColor();
+ void impl_checkSetIsSystemFont();
+ void impl_checkSetHelpTipSeconds();
+ void impl_checkSetSelectionInReadonly();
+
+private:
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ SvtAccessibilityOptions aAccessibilityOpt;
+};
+
+#endif // #ifndef SVTOOLS_ACCESSIBILITYOPTTEST_HXX
diff --git a/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
new file mode 100644
index 000000000000..f9840605a6d5
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "HistoryOptTest.hxx"
+#include "AccessibilityOptTest.hxx"
+#include "PrintOptTest.hxx"
+#include "UserOptTest.hxx"
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/task/XJob.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+//=============================================================================
+namespace css = ::com::sun::star;
+
+namespace svl{
+
+//=============================================================================
+static const ::rtl::OUString PROP_TEST = ::rtl::OUString::createFromAscii("Test");
+static const ::rtl::OUString TEST_PICKLIST = ::rtl::OUString::createFromAscii("checkPicklist");
+static const ::rtl::OUString TEST_URLHISTORY = ::rtl::OUString::createFromAscii("checkURLHistory");
+static const ::rtl::OUString TEST_HELPBOOKMARKS = ::rtl::OUString::createFromAscii("checkHelpBookmarks");
+static const ::rtl::OUString TEST_ACCESSIBILITYOPTIONS = ::rtl::OUString::createFromAscii("checkAccessibilityOptions");
+static const ::rtl::OUString TEST_PRINTOPTIONS = ::rtl::OUString::createFromAscii("checkPrintOptions");
+static const ::rtl::OUString TEST_USEROPTIONS = ::rtl::OUString::createFromAscii("checkUserOptions");
+
+//=============================================================================
+class ConfigItemTest : public ::cppu::WeakImplHelper2< css::task::XJob ,
+ css::lang::XServiceInfo >
+{
+ //-------------------------------------------------------------------------
+ // interface
+ public:
+ explicit ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext);
+
+ // css::task::XJob
+ virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception );
+
+ // css::lang::XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------------------------------------
+ // internal
+ private:
+ ConfigItemTest(ConfigItemTest &); // not defined
+ virtual ~ConfigItemTest() {}
+ void operator=(ConfigItemTest &); // not defined
+
+ //-------------------------------------------------------------------------
+ // helper for registration !
+ public:
+ static ::rtl::OUString SAL_CALL st_getImplementationName();
+ static css::uno::Sequence< ::rtl::OUString > SAL_CALL st_getSupportedServiceNames();
+ static css::uno::Reference< css::uno::XInterface > SAL_CALL st_create(const css::uno::Reference< css::uno::XComponentContext >& XContext);
+
+ //-------------------------------------------------------------------------
+ // member
+ private:
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+};
+
+//=============================================================================
+ConfigItemTest::ConfigItemTest(const css::uno::Reference< css::uno::XComponentContext >& xContext)
+ : m_xContext(xContext)
+{}
+
+//=============================================================================
+// css::task::XJob
+css::uno::Any SAL_CALL ConfigItemTest::execute(const css::uno::Sequence< css::beans::NamedValue >& lArguments)
+ throw (css::uno::RuntimeException ,
+ css::lang::IllegalArgumentException,
+ css::uno::Exception )
+{
+ ::rtl::OUString sTest;
+ ::sal_Int32 i = 0;
+ ::sal_Int32 c = lArguments.getLength();
+ for (i=0; i<c; ++i)
+ {
+ const css::beans::NamedValue& rArg = lArguments[0];
+ if (rArg.Name.equals(PROP_TEST))
+ rArg.Value >>= sTest;
+ }
+
+ if (sTest.equals(TEST_PICKLIST))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkPicklist();
+ }
+ else if (sTest.equals(TEST_URLHISTORY))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkURLHistory();
+ }
+ else if (sTest.equals(TEST_HELPBOOKMARKS))
+ {
+ HistoryOptTest aOptTest;
+ aOptTest.checkHelpBookmarks();
+ }
+ else if (sTest.equals(TEST_ACCESSIBILITYOPTIONS))
+ {
+ AccessibilityOptTest aOptTest;
+ aOptTest.impl_checkAccessibilityOptions();
+ }
+ else if (sTest.equals(TEST_PRINTOPTIONS))
+ {
+ PrintOptTest aOptTest;
+ aOptTest.impl_checkPrint();
+ }
+ else if (sTest.equals(TEST_USEROPTIONS))
+ {
+ UserOptTest aOptTest;
+ aOptTest.impl_checkUserData();
+ }
+
+ return css::uno::Any();
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+::rtl::OUString SAL_CALL ConfigItemTest::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ return ConfigItemTest::st_getImplementationName();
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+::sal_Bool SAL_CALL ConfigItemTest::supportsService(const ::rtl::OUString& sServiceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< ::rtl::OUString > lServiceNames = ConfigItemTest::st_getSupportedServiceNames();
+ for (::sal_Int32 i = 0; i < lServiceNames.getLength(); ++i)
+ {
+ if (lServiceNames[i].equals(sServiceName))
+ return sal_True;
+ }
+ return sal_False;
+}
+
+//=============================================================================
+// com::sun::star::uno::XServiceInfo
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ return ConfigItemTest::st_getSupportedServiceNames();
+}
+
+//=============================================================================
+::rtl::OUString SAL_CALL ConfigItemTest::st_getImplementationName()
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.svl.ConfigItemTest");
+}
+
+//=============================================================================
+css::uno::Sequence< ::rtl::OUString > SAL_CALL ConfigItemTest::st_getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > lServices(1);
+ lServices[0] = ::rtl::OUString::createFromAscii("com.sun.star.test.ConfigItems");
+ return lServices;
+}
+
+//=============================================================================
+css::uno::Reference< css::uno::XInterface > SAL_CALL ConfigItemTest::st_create(const css::uno::Reference< css::uno::XComponentContext >& xContext)
+{
+ ConfigItemTest* pObject = new ConfigItemTest(xContext);
+ css::uno::Reference< css::uno::XInterface > xObject (static_cast< ::cppu::OWeakObject* >(pObject));
+ return xObject;
+}
+
+} // namespace svl
+
+//=============================================================================
+static ::cppu::ImplementationEntry const lRegEntries[] =
+{
+ {
+ &::svl::ConfigItemTest::st_create,
+ &::svl::ConfigItemTest::st_getImplementationName,
+ &::svl::ConfigItemTest::st_getSupportedServiceNames,
+ &::cppu::createSingleComponentFactory, 0, 0
+ },
+
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+//=============================================================================
+extern "C" void SAL_CALL component_getImplementationEnvironment(const char** pEnvTypeName,
+ uno_Environment** )
+{
+ *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+//=============================================================================
+extern "C" void * SAL_CALL component_getFactory(const char* sImplName ,
+ void* pServiceManager,
+ void* pRegistryKey )
+{
+ return ::cppu::component_getFactoryHelper(sImplName, pServiceManager, pRegistryKey, lRegEntries);
+}
+
+//=============================================================================
+extern "C" sal_Bool SAL_CALL component_writeInfo(void* pServiceManager,
+ void* pRegistryKey )
+{
+ return ::cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, lRegEntries);
+}
diff --git a/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx
new file mode 100644
index 000000000000..4f8e2159847d
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.cxx
@@ -0,0 +1,798 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "HistoryOptTest.hxx"
+#include <unotools/historyoptions_const.hxx>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+#include <comphelper/configurationhelper.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include <unotools/processfactory.hxx>
+
+namespace css = ::com::sun::star;
+
+//=============================================================================
+static const ::rtl::OUString MESSAGE_CLEAR_FAILED = ::rtl::OUString::createFromAscii("Clearing the list failed.");
+static const ::rtl::OUString MESSAGE_SETSIZE_FAILED = ::rtl::OUString::createFromAscii("Setting a new size for a list failed.");
+static const ::rtl::OUString MESSAGE_MISS_HISTORY = ::rtl::OUString::createFromAscii("Could not get config access to history list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ITEMLIST = ::rtl::OUString::createFromAscii("Could not get config access to item list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ORDERLIST = ::rtl::OUString::createFromAscii("Could not get config access to order list inside config.");
+static const ::rtl::OUString MESSAGE_MISS_ITEM = ::rtl::OUString::createFromAscii("Could not locate item.");
+static const ::rtl::OUString MESSAGE_UNEXPECTED_ITEM = ::rtl::OUString::createFromAscii("Found an unexpected item.");
+static const ::rtl::OUString MESSAGE_WRONG_ORDER = ::rtl::OUString::createFromAscii("Wrong order in history list.");
+
+//=============================================================================
+HistoryOptTest::HistoryOptTest()
+ : m_aConfigItem ( )
+ , m_eList (ePICKLIST)
+ , m_xHistoriesXCU( )
+ , m_xCommonXCU ( )
+{
+}
+
+//=============================================================================
+HistoryOptTest::~HistoryOptTest()
+{
+ m_xHistoriesXCU.clear();
+ m_xCommonXCU.clear();
+}
+
+//=============================================================================
+void HistoryOptTest::checkPicklist()
+{
+ impl_testHistory(ePICKLIST, 4);
+}
+
+//=============================================================================
+void HistoryOptTest::checkURLHistory()
+{
+ impl_testHistory(eHISTORY, 10);
+}
+
+//=============================================================================
+void HistoryOptTest::checkHelpBookmarks()
+{
+ impl_testHistory(eHELPBOOKMARKS, 100);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_testHistory(EHistoryType eHistory ,
+ ::sal_Int32 nMaxItems)
+{
+ try
+ {
+ m_eList = eHistory;
+ ::sal_Int32 c = nMaxItems;
+ ::sal_Int32 i = 0;
+
+ impl_clearList( );
+ impl_setSize (c);
+
+ // a) fill list completely and check if all items could be realy created.
+ // But dont check its order here! Because every new item will change that order.
+ for (i=0; i<c; ++i)
+ {
+ impl_appendItem(i);
+ if ( ! impl_existsItem(i))
+ throw css::uno::Exception(MESSAGE_MISS_ITEM, 0);
+ }
+
+ // b) Check order of all items in list now.
+ // It must be reverse to the item number ...
+ // item max = index 0
+ // item max-1 = index 1
+ // ...
+ for (i=0; i<c; ++i)
+ {
+ ::sal_Int32 nExpectedIndex = (c-1)-i;
+ if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+ }
+
+ // c) increase prio of "first" item so it will switch
+ // to "second" and "second" will switch to "first" :-)
+ // Check also if all other items was not touched.
+ ::sal_Int32 nFirstItem = (c-1);
+ ::sal_Int32 nSecondItem = (c-2);
+ impl_appendItem(nSecondItem);
+
+ if (
+ ( ! impl_existsItemAtIndex(nSecondItem, 0)) ||
+ ( ! impl_existsItemAtIndex(nFirstItem , 1))
+ )
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ for (i=0; i<nSecondItem; ++i)
+ {
+ ::sal_Int32 nExpectedIndex = (c-1)-i;
+ if ( ! impl_existsItemAtIndex(i, nExpectedIndex))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+ }
+
+ // d) Check if appending new items will destroy the oldest one.
+ ::sal_Int32 nNewestItem = c;
+ ::sal_Int32 nOldestItem = 0;
+
+ impl_appendItem(nNewestItem);
+
+ if ( ! impl_existsItemAtIndex(nNewestItem, 0))
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ if (impl_existsItem(nOldestItem))
+ throw css::uno::Exception(MESSAGE_UNEXPECTED_ITEM, 0);
+
+ // e) Check if decreasing list size will remove oldest items.
+ // Note: impl_setSize() will make sure that 3 items exists only.
+ // Otherwhise it throws an exception. If we further check
+ // positions of three items no further items must be checked.
+ // They cant exists :-)
+ ::sal_Int32 nNewSize = 3;
+ impl_setSize(nNewSize);
+ if (
+ ( ! impl_existsItemAtIndex(nNewestItem, 0)) ||
+ ( ! impl_existsItemAtIndex(nSecondItem, 1)) ||
+ ( ! impl_existsItemAtIndex(nFirstItem , 2))
+ )
+ throw css::uno::Exception(MESSAGE_WRONG_ORDER, 0);
+
+ // finaly we should try to clean up all used structures so the same office can be used
+ // without problems :-)
+ impl_clearList();
+ }
+ catch (const css::uno::Exception& ex)
+ {
+ impl_clearList();
+ throw ex;
+ }
+
+}
+
+//=============================================================================
+void HistoryOptTest::impl_clearList()
+{
+ m_aConfigItem.Clear(m_eList);
+ ::sal_Int32 nCount = m_aConfigItem.GetList(m_eList).getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+
+ css::uno::Reference< css::container::XNameAccess > xList;
+ xList = impl_getItemList();
+ nCount = xList->getElementNames().getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+
+ xList = impl_getOrderList();
+ nCount = xList->getElementNames().getLength();
+
+ if (nCount != 0)
+ throw css::uno::Exception(MESSAGE_CLEAR_FAILED, 0);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_setSize(::sal_Int32 nSize)
+{
+ m_aConfigItem.SetSize (m_eList, nSize);
+
+ // a) size info returned by GetSize() means "MaxSize"
+ // so it must match exactly !
+ ::sal_Int32 nCheck = m_aConfigItem.GetSize(m_eList);
+ if (nCheck != nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+
+ // b) current size of used XCU lists reflects the current state of
+ // history list and not max size. So it can be less then size !
+ css::uno::Reference< css::container::XNameAccess > xList;
+ xList = impl_getItemList();
+ nCheck = xList->getElementNames().getLength();
+ if (nCheck > nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+
+ xList = impl_getOrderList();
+ nCheck = xList->getElementNames().getLength();
+ if (nCheck > nSize)
+ throw css::uno::Exception(MESSAGE_SETSIZE_FAILED, 0);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_appendItem(::sal_Int32 nItem)
+{
+ const ::rtl::OUString sURL = impl_createItemURL (nItem);
+ const ::rtl::OUString sTitle = impl_createItemTitle (nItem);
+ const ::rtl::OUString sPassword = impl_createItemPassword(nItem);
+
+ m_aConfigItem.AppendItem(m_eList, sURL, ::rtl::OUString(), sTitle, sPassword);
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemURL(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sURL(256);
+ sURL.appendAscii("file:///ooo_api_test/non_existing_test_url_");
+ sURL.append ((::sal_Int32)nItem );
+ sURL.appendAscii(".odt" );
+
+ return sURL.makeStringAndClear();
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemTitle(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sTitle(256);
+ sTitle.appendAscii("Non Existing Test Item Nr ");
+ sTitle.append ((::sal_Int32)nItem );
+
+ return sTitle.makeStringAndClear();
+}
+
+//=============================================================================
+::rtl::OUString HistoryOptTest::impl_createItemPassword(::sal_Int32 nItem)
+{
+ ::rtl::OUStringBuffer sPassword(256);
+ sPassword.appendAscii("Password_" );
+ sPassword.append ((::sal_Int32)nItem);
+
+ return sPassword.makeStringAndClear();
+}
+
+//=============================================================================
+::sal_Bool HistoryOptTest::impl_existsItem(::sal_Int32 nItem)
+{
+ const ::rtl::OUString sURL = impl_createItemURL(nItem);
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
+ const ::sal_Int32 c = lItems.getLength ();
+ ::sal_Int32 i = 0;
+ ::sal_Bool bFound = sal_False;
+
+ for (i=0; i<c; ++i)
+ {
+ const ::comphelper::SequenceAsHashMap aItem(lItems[i]);
+ const ::rtl::OUString& sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
+
+ bFound = sCheck.equals(sURL);
+ if (bFound)
+ break;
+ }
+
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
+ css::uno::Reference< css::container::XNameAccess > xItem ;
+ xItemList->getByName(sURL) >>= xItem;
+
+ bFound = xItem.is();
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ return bFound;
+}
+
+//=============================================================================
+::sal_Bool HistoryOptTest::impl_existsItemAtIndex(::sal_Int32 nItem ,
+ ::sal_Int32 nIndex)
+{
+ const ::rtl::OUString sURL = impl_createItemURL(nItem);
+ const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > lItems = m_aConfigItem.GetList(m_eList);
+ const ::sal_Int32 c = lItems.getLength ();
+ ::sal_Bool bFound = sal_False;
+
+ if (nIndex >= c)
+ return sal_False;
+
+ const ::comphelper::SequenceAsHashMap aItem(lItems[nIndex]);
+ ::rtl::OUString sCheck = aItem.getUnpackedValueOrDefault(s_sURL, ::rtl::OUString());
+
+ bFound = sCheck.equals(sURL);
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ css::uno::Reference< css::container::XNameAccess > xItemList = impl_getItemList();
+ css::uno::Reference< css::container::XNameAccess > xItem ;
+ xItemList->getByName(sURL) >>= xItem;
+
+ bFound = xItem.is();
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ if ( ! bFound)
+ return sal_False;
+ bFound = sal_False;
+
+ try
+ {
+ const ::rtl::OUString sOrder = ::rtl::OUString::valueOf(nIndex);
+ css::uno::Reference< css::container::XNameAccess > xOrderList = impl_getOrderList();
+ css::uno::Reference< css::container::XNameAccess > xOrder ;
+ xOrderList->getByName(sOrder) >>= xOrder;
+
+ if (xOrder.is())
+ {
+ xOrder->getByName(s_sHistoryItemRef) >>= sCheck;
+ bFound = sCheck.equals(sURL);
+ }
+ }
+ catch(const css::container::NoSuchElementException&)
+ {}
+
+ return bFound;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getItemList()
+{
+ css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
+ css::uno::Reference< css::container::XNameAccess > xList ;
+ xHistory->getByName (s_sItemList) >>= xList;
+
+ if ( ! xList.is())
+ throw css::uno::Exception(MESSAGE_MISS_ITEMLIST, 0);
+
+ return xList;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOrderList()
+{
+ css::uno::Reference< css::container::XNameAccess > xHistory = impl_getNewHistory();
+ css::uno::Reference< css::container::XNameAccess > xList ;
+ xHistory->getByName (s_sOrderList) >>= xList;
+
+ if ( ! xList.is())
+ throw css::uno::Exception(MESSAGE_MISS_ORDERLIST, 0);
+
+ return xList;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getNewHistory()
+{
+ if ( ! m_xHistoriesXCU.is())
+ {
+ m_xHistoriesXCU = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sHistories,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY_THROW);
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xHistory;
+
+ switch (m_eList)
+ {
+ case ePICKLIST :
+ m_xHistoriesXCU->getByName(s_sPickList) >>= xHistory;
+ break;
+
+ case eHISTORY :
+ m_xHistoriesXCU->getByName(s_sURLHistory) >>= xHistory;
+ break;
+
+ case eHELPBOOKMARKS :
+ m_xHistoriesXCU->getByName(s_sHelpBookmarks) >>= xHistory;
+ break;
+ }
+
+ if ( ! xHistory.is())
+ throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
+
+ return xHistory;
+}
+
+//=============================================================================
+css::uno::Reference< css::container::XNameAccess > HistoryOptTest::impl_getOldHistory()
+{
+ if ( ! m_xCommonXCU.is())
+ {
+ m_xCommonXCU = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ s_sCommonHistory,
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY_THROW);
+ }
+
+ css::uno::Reference< css::container::XNameAccess > xHistory;
+
+ switch (m_eList)
+ {
+ case ePICKLIST :
+ m_xCommonXCU->getByName(s_sPickList) >>= xHistory;
+ break;
+
+ case eHISTORY :
+ m_xCommonXCU->getByName(s_sURLHistory) >>= xHistory;
+ break;
+
+ case eHELPBOOKMARKS :
+ m_xCommonXCU->getByName(s_sHelpBookmarks) >>= xHistory;
+ break;
+ }
+
+ if ( ! xHistory.is())
+ throw css::uno::Exception(MESSAGE_MISS_HISTORY, 0);
+
+ return xHistory;
+}
+
+/*
+//=============================================================================
+// clear the list in XML directly when using the new Histories.xcs
+void HistoryOptTest::impl_clearList(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameContainer > xItemOrder;
+ css::uno::Reference< css::beans::XPropertySet > xFirstItem;
+ css::uno::Sequence< ::rtl::OUString > sFileList;
+
+ if (sList.equalsAscii("PickList"))
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+
+ else if (sList.equalsAscii("URLHistory"))
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+
+ if (xListAccess.is())
+ {
+ xListAccess->getByName(s_sItemList) >>= xItemOrder ;
+ sFileList = xItemOrder->getElementNames();
+ for(sal_Int32 i=0; i<sFileList.getLength(); ++i)
+ xItemOrder->removeByName(sFileList[i]);
+
+ xListAccess->getByName(s_sOrderList) >>= xItemOrder ;
+ sFileList = xItemOrder->getElementNames();
+ for(sal_Int32 j=0; j<sFileList.getLength(); ++j)
+ xItemOrder->removeByName(sFileList[j]);
+
+ xFirstItem = css::uno::Reference< css::beans::XPropertySet >(xListAccess, css::uno::UNO_QUERY);
+ xFirstItem->setPropertyValue( s_sFirstItem, css::uno::makeAny((sal_Int32)0) );
+
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+}
+
+//=============================================================================
+// use configuration API (not ConfigItem!) to verify the results within XML !
+sal_Bool HistoryOptTest::impl_isListEmpty(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::container::XNameAccess > xListAccess;
+ css::uno::Reference< css::container::XNameAccess > xItemList;
+ css::uno::Reference< css::container::XNameAccess > xOrderList;
+ sal_Bool bRet = sal_True;
+
+ if (sList.equalsAscii("PickList"))
+ m_xCfg->getByName(s_sPickList) >>= xListAccess;
+
+ else if (sList.equalsAscii("URLHistory"))
+ m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
+
+ if (xListAccess.is())
+ {
+ xListAccess->getByName(s_sItemList) >>= xItemList;
+ xListAccess->getByName(s_sOrderList) >>= xOrderList;
+
+ css::uno::Sequence< ::rtl::OUString > sItemList = xItemList->getElementNames();
+ css::uno::Sequence< ::rtl::OUString > sOrderList = xOrderList->getElementNames();
+ if (sItemList.getLength()!=0 || sOrderList.getLength()!=0)
+ bRet = sal_False;
+ }
+
+ return bRet;
+}
+
+//=============================================================================
+// append a item: use configuration API (not ConfigItem!) to verify the results within XML !
+void HistoryOptTest::impl_appendItem(const ::rtl::OUString& sList)
+{//to do...
+}
+
+//=============================================================================
+// test SvtHistoryOptions::GetSize()
+void HistoryOptTest::impl_checkGetSize(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
+
+ sal_uInt32 nSize = 0;
+ sal_uInt32 nSize_ = 0;
+
+ if (sList.equalsAscii("PickList"))
+ {
+ nSize = aHistoryOpt.GetSize(ePICKLIST);
+
+ xSet->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(ePICKLIST);
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ nSize = aHistoryOpt.GetSize(eHISTORY);
+
+ xSet->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(eHISTORY);
+
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ nSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ xSet->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize+1));
+ ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
+
+ nSize_ = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ if (nSize_ == nSize)
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetSize(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::SetSize()
+void HistoryOptTest::impl_checkSetSize(const ::rtl::OUString& sList)
+{
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xCommonXCU, css::uno::UNO_QUERY);
+
+ sal_uInt32 nSize = 0;
+ sal_uInt32 nSize_ = 0;
+
+ if (sList.equalsAscii("PickList"))
+ {
+ xSet->getPropertyValue(s_sPickListSize) >>= nSize;
+ aHistoryOpt.SetSize(ePICKLIST, (nSize+1));
+ xSet->getPropertyValue(s_sPickListSize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ xSet->getPropertyValue(s_sURLHistorySize) >>= nSize;
+ aHistoryOpt.SetSize(eHISTORY, (nSize+1));
+ xSet->getPropertyValue(s_sURLHistorySize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
+ aHistoryOpt.SetSize(eHELPBOOKMARKS, (nSize+1));
+ xSet->getPropertyValue(s_sHelpBookmarksSize) >>= nSize_;
+
+ if (nSize_ == nSize) //old config item will throw error
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SetSize(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::Clear()
+void HistoryOptTest::impl_checkClear(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ aHistoryOpt.Clear(ePICKLIST);
+ if ( !impl_isListEmpty(s_sPickList) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ aHistoryOpt.Clear(eHISTORY);
+ if ( !impl_isListEmpty(s_sURLHistory) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ aHistoryOpt.Clear(eHELPBOOKMARKS);
+ if ( !impl_isListEmpty(s_sHelpBookmarks) )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Clear(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+//=============================================================================
+// test SvtHistoryOptions::GetList()
+void HistoryOptTest::impl_checkGetList(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ impl_clearList(s_sPickList);
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( ePICKLIST );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(ePICKLIST) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ impl_clearList(s_sURLHistory);
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHISTORY );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHISTORY) error!")), 0);
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ impl_clearList(s_sHelpBookmarks);
+ aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ ::rtl::OUString::createFromAscii("file:///c/test1"),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > aHistoryList = aHistoryOpt.GetList( eHELPBOOKMARKS );
+
+ if ( aHistoryList.getLength()==0 )
+ throw css::uno::RuntimeException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GetList(eHELPBOOKMARKS) error!")), 0);
+ }
+}
+
+void HistoryOptTest::impl_checkAppendItem(const ::rtl::OUString& sList)
+{
+ if (sList.equalsAscii("PickList"))
+ {
+ impl_clearList(s_sPickList);
+ sal_Int32 nListSize = aHistoryOpt.GetSize(ePICKLIST);
+
+ for (sal_Int32 i=0; i<nListSize; ++i)
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::valueOf(i),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+
+ aHistoryOpt.AppendItem( ePICKLIST ,
+ ::rtl::OUString::valueOf(nListSize),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ }
+
+ else if (sList.equalsAscii("URLHistory"))
+ {
+ impl_clearList(s_sURLHistory);
+ sal_Int32 nListSize = aHistoryOpt.GetSize(eHISTORY);
+
+ for (sal_Int32 i=0; i<nListSize; ++i)
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::valueOf(i),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+
+ aHistoryOpt.AppendItem( eHISTORY ,
+ ::rtl::OUString::valueOf(nListSize),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii(""),
+ ::rtl::OUString::createFromAscii("") );
+ }
+
+ else if (sList.equalsAscii("HelpBookmarks"))
+ {
+ //impl_clearList(s_sHelpBookmarks);
+ //sal_Int32 nListSize = aHistoryOpt.GetSize(eHELPBOOKMARKS);
+
+ //for (sal_Int32 i=0; i<nListSize; ++i)
+ // aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ // ::rtl::OUString::valueOf(i),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii("") );
+
+ //aHistoryOpt.AppendItem( eHELPBOOKMARKS ,
+ // ::rtl::OUString::valueOf(nListSize),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii(""),
+ // ::rtl::OUString::createFromAscii("") );
+ }
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkPicklist()
+{
+ impl_checkGetSize(s_sPickList);
+ impl_checkSetSize(s_sPickList);
+
+ impl_checkClear(s_sPickList);
+ impl_checkGetList(s_sPickList);
+ impl_checkAppendItem(s_sPickList);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkURLHistory()
+{
+ impl_checkGetSize(s_sURLHistory);
+ impl_checkSetSize(s_sURLHistory);
+
+ impl_checkClear(s_sURLHistory);
+ impl_checkGetList(s_sURLHistory);
+ impl_checkAppendItem(s_sURLHistory);
+}
+
+//=============================================================================
+void HistoryOptTest::impl_checkHelpBookmarks()
+{
+ impl_checkGetSize(s_sHelpBookmarks);
+ impl_checkSetSize(s_sHelpBookmarks);
+
+ impl_checkClear(s_sHelpBookmarks);
+ impl_checkGetList(s_sHelpBookmarks);
+ impl_checkAppendItem(s_sHelpBookmarks);
+}
+*/
diff --git a/svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx
new file mode 100644
index 000000000000..05ea7edb01cc
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/HistoryOptTest.hxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_HISTORYOPTTEST_HXX
+#define SVTOOLS_HISTORYOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <unotools/historyoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class HistoryOptTest
+{
+ public:
+
+ HistoryOptTest();
+ virtual ~HistoryOptTest();
+
+ //---------------------------------------------------------------------
+ /** unit test of picklist */
+ void checkPicklist();
+
+ //---------------------------------------------------------------------
+ /** unit test of URL list */
+ void checkURLHistory();
+
+ //---------------------------------------------------------------------
+ /** unit test of Help bookmarks */
+ void checkHelpBookmarks();
+
+ private:
+
+ //---------------------------------------------------------------------
+ /** test every well known history list in the same way.
+ * Only the count of created and tested items can be defined from outside
+ * e.g. usefull for stress tests.
+ *
+ * @param eHistory
+ * specify the history list for testing.
+ *
+ * @param nMaxItems
+ * max count of new created and tested history items.
+ */
+ void impl_testHistory(EHistoryType eHistory ,
+ ::sal_Int32 nMaxItems);
+
+ //---------------------------------------------------------------------
+ /** try to clear the whole list and check the results.
+ * If list could not be cleared successfully an exception is thrown.
+ */
+ void impl_clearList();
+
+ //---------------------------------------------------------------------
+ /** define a new size for the current list and check the results.
+ * Note: The given size must match against the defined constraints.
+ * That must be checked before this method is called.
+ *
+ * @param nSize
+ * the new size.
+ */
+ void impl_setSize(::sal_Int32 nSize);
+
+ //---------------------------------------------------------------------
+ /** create a new item (means it's properties using a special schema using the
+ * item id).
+ *
+ * Note: This method does not check if creation was successfully.
+ * Therefore exists more specialized method impl_existsItem()
+ * and impl_existsItemAtPosition().
+ *
+ * @param nItem
+ * id of the item
+ */
+ void impl_appendItem(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** check if an entry for given item id realy exists (in memory and xcu file).
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return true if item exists - false otherwise.
+ */
+ ::sal_Bool impl_existsItem(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** check if an entry for given item id realy exists (in memory and xcu file).
+ * Further it checks if the requested item is placed at the also specified
+ * position inside history list.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @param nIndex
+ * expected position of item inside history list.
+ *
+ * @return true if item exists at right position - false otherwise.
+ */
+ ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem ,
+ ::sal_Int32 nIndex);
+
+ //---------------------------------------------------------------------
+ /** create an URL suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created URL.
+ */
+ ::rtl::OUString impl_createItemURL(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** create a title suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created title.
+ */
+ ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** create a password suitable for the given item id.
+ *
+ * @param nItem
+ * id of the item
+ *
+ * @return the new created password.
+ */
+ ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem);
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the item list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the item list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getItemList();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the order list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the order list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getOrderList();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the history list inside histories.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the history list configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getNewHistory();
+
+ //---------------------------------------------------------------------
+ /** returns direct access to the history config inside common.xcu
+ * suitable for the current defined list type (m_eList).
+ *
+ * @return reference to the history configuration
+ */
+ css::uno::Reference< css::container::XNameAccess > impl_getOldHistory();
+
+ private:
+
+ // the config item which should be tested here
+ SvtHistoryOptions m_aConfigItem;
+
+ // defines the special list for testing (picklist, history or url list)
+ EHistoryType m_eList;
+
+ // underlying configuration of the tested config items for cross over checks
+ css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU;
+
+ // underlying configuration of the tested config items for cross over checks
+ css::uno::Reference< css::container::XNameAccess > m_xCommonXCU;
+};
+
+#endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX
diff --git a/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx
new file mode 100644
index 000000000000..0731aa2a4253
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.cxx
@@ -0,0 +1,735 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "PrintOptTest.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <unotools/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
+
+namespace css = ::com::sun::star;
+
+// using test only
+#define ROOTNODE_PRINTOPTION rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option")
+#define PROPERTYNAME_REDUCETRANSPARENCY rtl::OUString::createFromAscii("ReduceTransparency")
+#define PROPERTYNAME_REDUCEDTRANSPARENCYMODE rtl::OUString::createFromAscii("ReducedTransparencyMode")
+#define PROPERTYNAME_REDUCEGRADIENTS rtl::OUString::createFromAscii("ReduceGradients")
+#define PROPERTYNAME_REDUCEDGRADIENTMODE rtl::OUString::createFromAscii("ReducedGradientMode")
+#define PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT rtl::OUString::createFromAscii("ReducedGradientStepCount")
+#define PROPERTYNAME_REDUCEBITMAPS rtl::OUString::createFromAscii("ReduceBitmaps")
+#define PROPERTYNAME_REDUCEDBITMAPMODE rtl::OUString::createFromAscii("ReducedBitmapMode")
+#define PROPERTYNAME_REDUCEDBITMAPRESOLUTION rtl::OUString::createFromAscii("ReducedBitmapResolution")
+#define PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY rtl::OUString::createFromAscii("ReducedBitmapIncludesTransparency")
+#define PROPERTYNAME_CONVERTTOGREYSCALES rtl::OUString::createFromAscii("ConvertToGreyscales")
+
+PrintOptTest::PrintOptTest()
+{
+ m_xCfg = css::uno::Reference< css::container::XNameAccess >(
+ ::comphelper::ConfigurationHelper::openConfig(
+ ::utl::getProcessServiceFactory(),
+ rtl::OUString::createFromAscii("org.openoffice.Office.Common/Print/Option"),
+ ::comphelper::ConfigurationHelper::E_STANDARD),
+ css::uno::UNO_QUERY);
+
+ if (m_xCfg.is())
+ {
+ //UniString sTmp = UniString("printer");
+ //xub_StrLen nTokenCount = sTmp.GetTokenCount('/');
+ //sTmp = sTmp.GetToken(nTokenCount - 1, '/');
+ m_xCfg->getByName(rtl::OUString::createFromAscii("Printer")) >>= m_xNode;
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedTransparencyMode() const
+{
+ sal_Int16 nRet = 0;
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nRet;
+ }
+ return nRet;
+}
+void PrintOptTest::impl_SetReducedTransparencyMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDTRANSPARENCYMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceTransparency() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference< css::beans::XPropertySet > xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bRet;
+ }
+ return bRet;
+}
+void PrintOptTest::impl_SetReduceTransparency(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCETRANSPARENCY, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceGradients() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReduceGradients(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEGRADIENTS, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedGradientMode() const
+{
+ sal_Int16 nRet = 0;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedGradientMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedGradientStepCount() const
+{
+ sal_Int16 nRet = 64;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nRet;
+ }
+ }
+ return nRet;
+}
+void PrintOptTest::impl_SetReducedGradientStepCount(sal_Int16 nStepCount )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nUpdate;
+ if (nUpdate != nStepCount)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT, css::uno::makeAny(nStepCount));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReduceBitmaps() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReduceBitmaps(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEBITMAPS, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedBitmapMode() const
+{
+ sal_Int16 nRet = 1;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapMode(sal_Int16 nMode )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nUpdate;
+ if (nUpdate != nMode)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPMODE, css::uno::makeAny(nMode));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Int16 PrintOptTest::impl_GetReducedBitmapResolution() const
+{
+ sal_Int16 nRet = 3;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nRet;
+ }
+ }
+ return nRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapResolution(sal_Int16 nResolution )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Int16 nUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nUpdate;
+ if (nUpdate != nResolution)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPRESOLUTION, css::uno::makeAny(nResolution));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsReducedBitmapIncludesTransparency() const
+{
+ sal_Bool bRet = sal_True;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetReducedBitmapIncludesTransparency(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+sal_Bool PrintOptTest::impl_IsConvertToGreyscales() const
+{
+ sal_Bool bRet = sal_False;
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bRet;
+ }
+ }
+ return bRet;
+}
+
+void PrintOptTest::impl_SetConvertToGreyscales(sal_Bool bState )
+{
+ if (m_xNode.is())
+ {
+ css::uno::Reference<css::beans::XPropertySet> xSet(m_xNode, css::uno::UNO_QUERY);
+ if (xSet.is())
+ {
+ sal_Bool bUpdate;
+ xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bUpdate;
+ if (bUpdate != bState)
+ {
+ xSet->setPropertyValue( PROPERTYNAME_CONVERTTOGREYSCALES, css::uno::makeAny(bState));
+ ::comphelper::ConfigurationHelper::flush(m_xCfg);
+ }
+ }
+ }
+}
+
+
+PrintOptTest::~PrintOptTest()
+{
+}
+
+void PrintOptTest::impl_checkPrint()
+{
+ //test SetReduceTransparency()
+ sal_Bool bNewValue = sal_False;
+ sal_Bool bOldValue = sal_False;
+ bOldValue = PrintOptTest::impl_IsReduceTransparency();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceTransparency(bNewValue) ;
+ bNewValue = impl_IsReduceTransparency();
+ // if(bNewValue != bOldValue) // test the old source
+ if ( bNewValue == bOldValue ) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceTransparency() error!"),
+ 0);
+ }
+
+ //test IsReduceTransparemcy()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceTransparency();
+ bNewValue = !bOldValue;
+ impl_SetReduceTransparency(bNewValue);
+ bNewValue = aPrintOpt.IsReduceTransparency();
+ //if(bNewValue != bOldValue) // test the old source
+ if(bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceTransparency() error!"),
+ 0);
+ }
+
+ // test SetReducedTransparencyMode()
+ sal_Int16 nOldMode, nNewMode;
+ nOldMode = nNewMode = 0;
+ nOldMode = impl_GetReducedTransparencyMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedTransparencyMode( nNewMode );
+ nNewMode = impl_GetReducedTransparencyMode();
+ //if(nNewMode != nOldMode) // test the old source
+ if ( nNewMode == nOldMode ) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedTransparencyMode() error!"),
+ 0);
+ }
+
+ //test IsReducedTransparencyMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = impl_GetReducedTransparencyMode();
+ nNewMode = nOldMode + 1;
+ impl_SetReducedTransparencyMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedTransparencyMode();
+ //if(nNewMode != nOldMode) // test the old source
+ if(nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReducedTransparencyMode() error!"
+ "nOldMode's value is :"),
+ 0);
+ }
+
+ // test the SetReduceGradients()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceGradients();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceGradients(bNewValue);
+ bNewValue = impl_IsReduceGradients();
+ //if (bNewValue != bOldValue) //test the old source
+ if (bNewValue == bOldValue) //test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceGradients() error!"),
+ 0);
+
+ }
+
+ // test the IsReduceGradients()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReduceGradients();
+ bNewValue = !bOldValue;
+ this->impl_SetReduceGradients(bNewValue);
+ bNewValue = aPrintOpt.IsReduceGradients();
+ // if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceGradients() error!"),
+ 0);
+
+ }
+
+ //test SetRedecedGradientMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = this->impl_GetReducedGradientMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedGradientMode(nNewMode);
+ nNewMode = this->impl_GetReducedGradientMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetRedecedGradientMode() error!"),
+ 0);
+ }
+
+ // test GetReducedGradientMode()
+ nOldMode = nNewMode = 0;
+ nOldMode = this->impl_GetReducedGradientMode();
+ nNewMode = nOldMode + 1;
+ this->impl_SetReducedGradientMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedGradientMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReducedGradientMode() error!"),
+ 0);
+
+ }
+
+ //test the SetReducedGradientStepCount()
+ sal_Int16 nNewStepCount;
+ sal_Int16 nOldStepCount;
+ nNewStepCount = nOldStepCount = 0;
+ nOldStepCount = this->impl_GetReducedGradientStepCount();
+ nNewStepCount = nOldStepCount + 1;
+ aPrintOpt.SetReducedGradientStepCount(nNewStepCount);
+ nNewStepCount = this->impl_GetReducedGradientStepCount();
+ // if (nNewStepCount != nOldStepCount) // test the old source
+ if (nNewStepCount == nOldStepCount) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedGradientStepCount() error!"),
+ 0);
+
+ }
+
+ // test the GetReduceGradientStepCount()
+ nNewStepCount = nOldStepCount = 0;
+ nOldStepCount = this->impl_GetReducedGradientStepCount();
+ nNewStepCount = nOldStepCount + 1;
+ this->impl_SetReducedGradientStepCount(nNewStepCount);
+ nNewStepCount = aPrintOpt.GetReducedGradientStepCount();
+ // if (nNewStepCount != nOldStepCount) //test the old source
+ if (nNewStepCount == nOldStepCount) //test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceGradientStepCount() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmaps()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsReduceBitmaps();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReduceBitmaps(bNewValue);
+ bNewValue = this->impl_IsReduceBitmaps();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmaps() error!"),
+ 0);
+ }
+
+ // test the IsReduceBitmaps()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsReduceBitmaps();
+ bNewValue = !bOldValue;
+ this->impl_SetReduceBitmaps(bNewValue);
+ bNewValue = aPrintOpt.IsReduceBitmaps();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReduceBitmaps() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmap()
+ nNewMode = nOldMode = 0;
+ nOldMode = impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedBitmapMode(nNewMode);
+ nNewMode = impl_GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmap() error!"),
+ 0);
+ }
+
+ // test the SetReduceBitmapMode()
+ nNewMode = nOldMode = 0;
+ nOldMode = this->impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ aPrintOpt.SetReducedBitmapMode(nNewMode);
+ nNewMode = this->impl_GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReduceBitmapMode() error!"),
+ 0);
+ }
+
+ // test the GetReduceBitmapMode()
+ nNewMode = nOldMode = 0;
+ nOldMode = this->impl_GetReducedBitmapMode();
+ nNewMode = nOldMode + 1;
+ this->impl_SetReducedBitmapMode(nNewMode);
+ nNewMode = aPrintOpt.GetReducedBitmapMode();
+ //if (nNewMode != nOldMode) // test the old source
+ if (nNewMode == nOldMode)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceBitmapMode() error!"),
+ 0);
+
+ }
+
+ // test the SetReducedBitmapResolution()
+ sal_Int16 nOldResolution ;
+ sal_Int16 nNewResolution ;
+ nNewResolution = nOldResolution = 0;
+ nOldResolution = impl_GetReducedBitmapResolution();
+ nNewResolution = nOldResolution + 1;
+ aPrintOpt.SetReducedBitmapResolution(nNewResolution);
+ nNewResolution = impl_GetReducedBitmapResolution();
+ //if (nNewResolution != nOldResolution) // test the old source
+ if (nNewResolution == nOldResolution)// test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedBitmapResolution() error!"),
+ 0);
+ }
+
+ // test the GetReduceBitmapResolution()
+ nNewResolution = nOldResolution = 0;
+ nOldResolution = impl_GetReducedBitmapResolution();
+ nNewResolution = nOldResolution + 1;
+ impl_SetReducedBitmapResolution(nNewResolution);
+ nNewResolution = impl_GetReducedBitmapResolution();
+ //if (nNewResolution != nOldResolution) // test the old source
+ if (nNewResolution == nOldResolution) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the GetReduceBitmapResolution() error!"),
+ 0);
+ }
+
+ // test SetReducedBitmapIncludesTransparency()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReducedBitmapIncludesTransparency();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetReducedBitmapIncludesTransparency(bNewValue);
+ bNewValue = impl_IsReducedBitmapIncludesTransparency();
+ //if (bNewValue != bOldValue) // test the new source
+ if (bNewValue == bOldValue) // test the old source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetReducedBitmapIncludesTransparency() error!"),
+ 0);
+ }
+
+ // test the IsReducedBitmapIncludesTransparency()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = impl_IsReducedBitmapIncludesTransparency();
+ bNewValue = !bOldValue;
+ impl_SetReducedBitmapIncludesTransparency(bNewValue);
+ bNewValue = aPrintOpt.IsReducedBitmapIncludesTransparency();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsReducedBitmapIncludesTransparency() error!"),
+ 0);
+ }
+
+ // test the SetConvertToGreyscales()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsConvertToGreyscales();
+ bNewValue = !bOldValue;
+ aPrintOpt.SetConvertToGreyscales(bNewValue);
+ bNewValue = this->impl_IsConvertToGreyscales();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the SetConvertToGreyscales() error!"),
+ 0);
+ }
+
+ // test the IsConvertToGreyscales()
+ bNewValue = bOldValue = sal_False;
+ bOldValue = this->impl_IsConvertToGreyscales();
+ bNewValue = !bOldValue;
+ impl_SetConvertToGreyscales(bNewValue);
+ bNewValue = aPrintOpt.IsConvertToGreyscales();
+ //if (bNewValue != bOldValue) // test the old source
+ if (bNewValue == bOldValue) // test the new source
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString::createFromAscii(
+ "null com.sun.star.configuration."
+ "the IsConvertToGreyscales() error!"),
+ 0);
+ }
+}
diff --git a/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx
new file mode 100644
index 000000000000..7d366dc38090
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/PrintOptTest.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_PRINTOPTTEST_HXX
+#define SVTOOLS_PRINTOPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <svl/printoptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class PrintOptTest
+{
+public:
+
+ PrintOptTest();
+ ~PrintOptTest();
+
+ void impl_checkPrint();
+
+private: //members
+
+ SvtPrinterOptions aPrintOpt;
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+ css::uno::Reference< css::container::XNameAccess > m_xNode;
+
+private: // methods
+ sal_Bool impl_IsReduceTransparency() const ;
+ void impl_SetReduceTransparency( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedTransparencyMode() const ;
+ void impl_SetReducedTransparencyMode( sal_Int16 nMode ) ;
+
+ sal_Bool impl_IsReduceGradients() const ;
+ void impl_SetReduceGradients( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedGradientMode() const ;
+ void impl_SetReducedGradientMode( sal_Int16 nMode ) ;
+
+ sal_Int16 impl_GetReducedGradientStepCount() const ;
+ void impl_SetReducedGradientStepCount( sal_Int16 nStepCount );
+
+ sal_Bool impl_IsReduceBitmaps() const ;
+ void impl_SetReduceBitmaps( sal_Bool bState ) ;
+
+ sal_Int16 impl_GetReducedBitmapMode() const ;
+ void impl_SetReducedBitmapMode( sal_Int16 nMode ) ;
+
+ sal_Int16 impl_GetReducedBitmapResolution() const ;
+ void impl_SetReducedBitmapResolution( sal_Int16 nResolution ) ;
+
+ sal_Bool impl_IsReducedBitmapIncludesTransparency() const ;
+ void impl_SetReducedBitmapIncludesTransparency( sal_Bool bState ) ;
+
+ sal_Bool impl_IsConvertToGreyscales() const;
+ void impl_SetConvertToGreyscales( sal_Bool bState ) ;
+
+};
+
+#endif // #ifndef SVTOOLS_PRINTOPTTEST_HXX
diff --git a/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx
new file mode 100644
index 000000000000..b14d20a76694
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "UserOptTest.hxx"
+
+namespace css = ::com::sun::star;
+
+//=============================================================================
+static const ::rtl::OUString MESSAGE_SETCOMPANY_FAILED = ::rtl::OUString::createFromAscii("set company failed") ;
+static const ::rtl::OUString MESSAGE_SETFIRSTNAME_FAILED = ::rtl::OUString::createFromAscii("set firstname failed") ;
+static const ::rtl::OUString MESSAGE_SETLASTNAME_FAILED = ::rtl::OUString::createFromAscii("set lastname failed") ;
+static const ::rtl::OUString MESSAGE_SETID_FAILED = ::rtl::OUString::createFromAscii("set ID failed") ;
+static const ::rtl::OUString MESSAGE_SETSTREET_FAILED = ::rtl::OUString::createFromAscii("set street failed") ;
+static const ::rtl::OUString MESSAGE_SETCITY_FAILED = ::rtl::OUString::createFromAscii("set city failed") ;
+static const ::rtl::OUString MESSAGE_SETSTATE_FAILED = ::rtl::OUString::createFromAscii("set state failed") ;
+static const ::rtl::OUString MESSAGE_SETZIP_FAILED = ::rtl::OUString::createFromAscii("set zip failed") ;
+static const ::rtl::OUString MESSAGE_SETCOUNTRY_FAILED = ::rtl::OUString::createFromAscii("set country failed") ;
+static const ::rtl::OUString MESSAGE_SETPOSITION_FAILED = ::rtl::OUString::createFromAscii("set position failed") ;
+static const ::rtl::OUString MESSAGE_SETTITLE_FAILED = ::rtl::OUString::createFromAscii("set title failed") ;
+static const ::rtl::OUString MESSAGE_SETTELEPHONEHOME_FAILED = ::rtl::OUString::createFromAscii("set telephonehome failed") ;
+static const ::rtl::OUString MESSAGE_SETTELEPHONEWORK_FAILED = ::rtl::OUString::createFromAscii("set telephonework failed") ;
+static const ::rtl::OUString MESSAGE_SETFAX_FAILED = ::rtl::OUString::createFromAscii("set fax failed") ;
+static const ::rtl::OUString MESSAGE_SETEMAIL_FAILED = ::rtl::OUString::createFromAscii("set email failed") ;
+static const ::rtl::OUString MESSAGE_SETCUSTOMERNUMBER_FAILED = ::rtl::OUString::createFromAscii("set customernumber failed");
+static const ::rtl::OUString MESSAGE_SETFATHERSNAME_FAILED = ::rtl::OUString::createFromAscii("set fathersname failed") ;
+static const ::rtl::OUString MESSAGE_SETAPARTMENT_FAILED = ::rtl::OUString::createFromAscii("set apartment failed") ;
+
+//=============================================================================
+
+
+UserOptTest::UserOptTest()
+ :m_aConfigItem()
+ ,m_xCfg()
+{
+}
+
+UserOptTest::~UserOptTest()
+{
+}
+
+void UserOptTest::impl_checkUserData()
+{
+ impl_checkSetCompany( ::rtl::OUString() );
+ impl_checkSetFirstName( ::rtl::OUString() );
+ impl_checkSetLastName( ::rtl::OUString() );
+ impl_checkSetID( ::rtl::OUString() );
+ impl_checkSetStreet( ::rtl::OUString() );
+ impl_checkSetCity( ::rtl::OUString() );
+ impl_checkSetState( ::rtl::OUString() );
+ impl_checkSetZip( ::rtl::OUString() );
+ impl_checkSetCountry( ::rtl::OUString() );
+ impl_checkSetPosition( ::rtl::OUString() );
+ impl_checkSetTitle( ::rtl::OUString() );
+ impl_checkSetTelephoneHome( ::rtl::OUString() );
+ impl_checkSetTelephoneWork( ::rtl::OUString() );
+ impl_checkSetFax( ::rtl::OUString() );
+ impl_checkSetEmail( ::rtl::OUString() );
+ //impl_checkSetCustomerNumber( ::rtl::OUString() );
+ impl_checkSetFathersName( ::rtl::OUString() );
+ impl_checkSetApartment( ::rtl::OUString() );
+
+ impl_checkSetCompany( ::rtl::OUString::createFromAscii("RedFlag2000") );
+ impl_checkSetFirstName( ::rtl::OUString::createFromAscii("Yan") );
+ impl_checkSetLastName( ::rtl::OUString::createFromAscii("Wu") );
+ impl_checkSetID( ::rtl::OUString::createFromAscii("wuy") );
+ impl_checkSetStreet( ::rtl::OUString::createFromAscii("SouthFifthRing") );
+ impl_checkSetCity( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetState( ::rtl::OUString::createFromAscii("Beijing") );
+ impl_checkSetZip( ::rtl::OUString::createFromAscii("100176") );
+ impl_checkSetCountry( ::rtl::OUString::createFromAscii("China") );
+ impl_checkSetPosition( ::rtl::OUString::createFromAscii("Engineer") );
+ impl_checkSetTitle( ::rtl::OUString::createFromAscii("Software Engineer") );
+ impl_checkSetTelephoneHome( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetTelephoneWork( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetFax( ::rtl::OUString::createFromAscii("010-51570010") );
+ impl_checkSetEmail( ::rtl::OUString::createFromAscii("wuy@redflag2000.cn") );
+ //impl_checkSetCustomerNumber( ::rtl::OUString::createFromAscii("87654321") );
+ impl_checkSetFathersName( ::rtl::OUString::createFromAscii("father") );
+ impl_checkSetApartment( ::rtl::OUString::createFromAscii("apartment") );
+}
+
+void UserOptTest::impl_checkSetCompany( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCompany( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCompany();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCOMPANY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFirstName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFirstName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFirstName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFIRSTNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetLastName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetLastName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetLastName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETLASTNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetID( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetID( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetID();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETID_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetStreet( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetStreet( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetStreet();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETSTREET_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCity( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCity( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCity();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCITY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetState( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetState( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetState();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETSTATE_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetZip( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetZip( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetZip();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETZIP_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCountry( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCountry( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCountry();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCOUNTRY_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetPosition( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetPosition( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetPosition();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETPOSITION_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTitle( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTitle( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTitle();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTITLE_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTelephoneHome( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneHome();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTELEPHONEHOME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetTelephoneWork( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetTelephoneWork();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETTELEPHONEWORK_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFax( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFax( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFax();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFAX_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetEmail( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetEmail( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetEmail();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETEMAIL_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetCustomerNumber( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetCustomerNumber();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETCUSTOMERNUMBER_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetFathersName( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetFathersName( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetFathersName();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETFATHERSNAME_FAILED, 0);
+}
+
+void UserOptTest::impl_checkSetApartment( const ::rtl::OUString& sUserData )
+{
+ m_aConfigItem.SetApartment( sUserData );
+
+ ::rtl::OUString sCheck = m_aConfigItem.GetApartment();
+ if ( sCheck != sUserData )
+ throw css::uno::Exception(MESSAGE_SETAPARTMENT_FAILED, 0);
+}
diff --git a/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx
new file mode 100644
index 000000000000..8fc63a58a9cc
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/UserOptTest.hxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_USEROPTTEST_HXX
+#define SVTOOLS_USEROPTTEST_HXX
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <unotools/useroptions.hxx>
+
+namespace css = ::com::sun::star;
+
+class UserOptTest
+{
+public:
+ UserOptTest();
+ ~UserOptTest();
+
+ void impl_checkUserData();
+
+private:
+ void impl_checkSetCompany( const ::rtl::OUString& sUserData );
+ void impl_checkSetFirstName( const ::rtl::OUString& sUserData );
+ void impl_checkSetLastName( const ::rtl::OUString& sUserData );
+ void impl_checkSetID( const ::rtl::OUString& sUserData );
+ void impl_checkSetStreet( const ::rtl::OUString& sUserData );
+ void impl_checkSetCity( const ::rtl::OUString& sUserData );
+ void impl_checkSetState( const ::rtl::OUString& sUserData );
+ void impl_checkSetZip( const ::rtl::OUString& sUserData );
+ void impl_checkSetCountry( const ::rtl::OUString& sUserData );
+ void impl_checkSetPosition( const ::rtl::OUString& sUserData );
+ void impl_checkSetTitle( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneHome( const ::rtl::OUString& sUserData );
+ void impl_checkSetTelephoneWork( const ::rtl::OUString& sUserData );
+ void impl_checkSetFax( const ::rtl::OUString& sUserData );
+ void impl_checkSetEmail( const ::rtl::OUString& sUserData );
+ void impl_checkSetCustomerNumber( const ::rtl::OUString& sUserData );
+ void impl_checkSetFathersName( const ::rtl::OUString& sUserData );
+ void impl_checkSetApartment( const ::rtl::OUString& sUserData );
+
+private:
+ SvtUserOptions m_aConfigItem;
+
+ css::uno::Reference< css::container::XNameAccess > m_xCfg;
+};
+
+#endif // #ifndef SVTOOLS_USEROPTTEST_HXX
diff --git a/svl/qa/complex/ConfigItems/helper/makefile.mk b/svl/qa/complex/ConfigItems/helper/makefile.mk
new file mode 100644
index 000000000000..13ea12106792
--- /dev/null
+++ b/svl/qa/complex/ConfigItems/helper/makefile.mk
@@ -0,0 +1,73 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..$/..$/..$/..
+
+PRJNAME= svl
+TARGET= ConfigItemTest
+USE_DEFFILE= TRUE
+ENABLE_EXCEPTIONS= TRUE
+NO_BSYMBOLIC= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Generate -----------------------------------------------------
+
+INCPOST += $(PRJ)$/source$/inc
+
+# --- light services library ----------------------------------------------------
+
+SHL1TARGET= svt_$(TARGET)
+
+SHL1OBJS= \
+ $(SLO)$/UserOptTest.obj \
+ $(SLO)$/PrintOptTest.obj \
+ $(SLO)$/AccessibilityOptTest.obj \
+ $(SLO)$/HistoryOptTest.obj \
+ $(SLO)$/ConfigItemTest.obj
+
+SHL1STDLIBS= \
+ $(SVLIB) \
+ $(SVLLIB) \
+ $(UNOTOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+#SHL1DEPN= $(SHL1IMPLIBN) $(SHL1TARGETN)
+
+DEF1NAME= $(SHL1TARGET)
+
+SHL1VERSIONMAP= $(SOLARENV)/src/component.map
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+