1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SVTOOLS_HISTORYOPTTEST_HXX 29 #define SVTOOLS_HISTORYOPTTEST_HXX 30 31 #include <com/sun/star/container/XNameAccess.hpp> 32 #include <unotools/historyoptions.hxx> 33 34 namespace css = ::com::sun::star; 35 36 class HistoryOptTest 37 { 38 public: 39 40 HistoryOptTest(); 41 virtual ~HistoryOptTest(); 42 43 //--------------------------------------------------------------------- 44 /** unit test of picklist */ 45 void checkPicklist(); 46 47 //--------------------------------------------------------------------- 48 /** unit test of URL list */ 49 void checkURLHistory(); 50 51 //--------------------------------------------------------------------- 52 /** unit test of Help bookmarks */ 53 void checkHelpBookmarks(); 54 55 private: 56 57 //--------------------------------------------------------------------- 58 /** test every well known history list in the same way. 59 * Only the count of created and tested items can be defined from outside 60 * e.g. usefull for stress tests. 61 * 62 * @param eHistory 63 * specify the history list for testing. 64 * 65 * @param nMaxItems 66 * max count of new created and tested history items. 67 */ 68 void impl_testHistory(EHistoryType eHistory , 69 ::sal_Int32 nMaxItems); 70 71 //--------------------------------------------------------------------- 72 /** try to clear the whole list and check the results. 73 * If list could not be cleared successfully an exception is thrown. 74 */ 75 void impl_clearList(); 76 77 //--------------------------------------------------------------------- 78 /** define a new size for the current list and check the results. 79 * Note: The given size must match against the defined constraints. 80 * That must be checked before this method is called. 81 * 82 * @param nSize 83 * the new size. 84 */ 85 void impl_setSize(::sal_Int32 nSize); 86 87 //--------------------------------------------------------------------- 88 /** create a new item (means it's properties using a special schema using the 89 * item id). 90 * 91 * Note: This method does not check if creation was successfully. 92 * Therefore exists more specialized method impl_existsItem() 93 * and impl_existsItemAtPosition(). 94 * 95 * @param nItem 96 * id of the item 97 */ 98 void impl_appendItem(::sal_Int32 nItem); 99 100 //--------------------------------------------------------------------- 101 /** check if an entry for given item id realy exists (in memory and xcu file). 102 * 103 * @param nItem 104 * id of the item 105 * 106 * @return true if item exists - false otherwise. 107 */ 108 ::sal_Bool impl_existsItem(::sal_Int32 nItem); 109 110 //--------------------------------------------------------------------- 111 /** check if an entry for given item id realy exists (in memory and xcu file). 112 * Further it checks if the requested item is placed at the also specified 113 * position inside history list. 114 * 115 * @param nItem 116 * id of the item 117 * 118 * @param nIndex 119 * expected position of item inside history list. 120 * 121 * @return true if item exists at right position - false otherwise. 122 */ 123 ::sal_Bool impl_existsItemAtIndex(::sal_Int32 nItem , 124 ::sal_Int32 nIndex); 125 126 //--------------------------------------------------------------------- 127 /** create an URL suitable for the given item id. 128 * 129 * @param nItem 130 * id of the item 131 * 132 * @return the new created URL. 133 */ 134 ::rtl::OUString impl_createItemURL(::sal_Int32 nItem); 135 136 //--------------------------------------------------------------------- 137 /** create a title suitable for the given item id. 138 * 139 * @param nItem 140 * id of the item 141 * 142 * @return the new created title. 143 */ 144 ::rtl::OUString impl_createItemTitle(::sal_Int32 nItem); 145 146 //--------------------------------------------------------------------- 147 /** create a password suitable for the given item id. 148 * 149 * @param nItem 150 * id of the item 151 * 152 * @return the new created password. 153 */ 154 ::rtl::OUString impl_createItemPassword(::sal_Int32 nItem); 155 156 //--------------------------------------------------------------------- 157 /** returns direct access to the item list inside histories.xcu 158 * suitable for the current defined list type (m_eList). 159 * 160 * @return reference to the item list configuration 161 */ 162 css::uno::Reference< css::container::XNameAccess > impl_getItemList(); 163 164 //--------------------------------------------------------------------- 165 /** returns direct access to the order list inside histories.xcu 166 * suitable for the current defined list type (m_eList). 167 * 168 * @return reference to the order list configuration 169 */ 170 css::uno::Reference< css::container::XNameAccess > impl_getOrderList(); 171 172 //--------------------------------------------------------------------- 173 /** returns direct access to the history list inside histories.xcu 174 * suitable for the current defined list type (m_eList). 175 * 176 * @return reference to the history list configuration 177 */ 178 css::uno::Reference< css::container::XNameAccess > impl_getNewHistory(); 179 180 //--------------------------------------------------------------------- 181 /** returns direct access to the history config inside common.xcu 182 * suitable for the current defined list type (m_eList). 183 * 184 * @return reference to the history configuration 185 */ 186 css::uno::Reference< css::container::XNameAccess > impl_getOldHistory(); 187 188 private: 189 190 // the config item which should be tested here 191 SvtHistoryOptions m_aConfigItem; 192 193 // defines the special list for testing (picklist, history or url list) 194 EHistoryType m_eList; 195 196 // underlying configuration of the tested config items for cross over checks 197 css::uno::Reference< css::container::XNameAccess > m_xHistoriesXCU; 198 199 // underlying configuration of the tested config items for cross over checks 200 css::uno::Reference< css::container::XNameAccess > m_xCommonXCU; 201 }; 202 203 #endif // #ifndef SVTOOLS_HISTORYOPTTEST_HXX 204