1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: db_Text.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:42 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : test for a text database
38 '\***********************************************************************
40 sub db_Text(sFilename as string)
42 call tCountCharacterSet(sFilename)
43 call tOpenUTF8File(sFilename)
46 '-------------------------------------------------------------------------
47 testcase tCountCharacterSet(sFilename as string)
49 '/// open the text database create in the bas file
50 call fOpendatabase(sFileName)
52 '/// open the properties dialog of the open database
53 printlog "open the properties dialog of the open database"
60 '/// switch to the Text Tabpage
61 printlog "switch to the Text Tabpage"
62 Kontext "DatabaseProperties"
63 TabControl.setPage TabTextBase
65 '/// check if there are 54 character sets
66 printlog "check if there are 54 character sets"
69 i = CharSet.getItemCount()
71 warnlog "The count of the charsets is wrong. It have to be 54 but it is:" + i
73 printlog "The count of the charsets is correct.There are 54 character sets."
75 '/// close the properties dialog with OK
76 printlog "close the properties dialog with OK"
77 Kontext "DatabaseProperties"
80 '/// close the database
81 printlog "close the database"
85 '-------------------------------------------------------------------------
86 testcase tOpenUTF8File(sFilename as string)
88 '/// copy the file TesttoolPath + dbaccess/optional/input/text_datasource/text_database.txt" to your local wotk directory
89 printlog "copy the file TesttoolPath + dbaccess/optional/input/text_datasource/text_database.txt to your local wotk directory"
90 app.FileCopy gTesttoolPath + ConvertPath("dbaccess/optional/input/text_datasource/text_database.txt"),gOfficePath + ConvertPath("user/work/text_database.txt")
92 '/// open the text database create in the bas file
93 call fOpendatabase(sFileName)
95 '/// open the properties dialog of the open database
96 printlog "open the properties dialog of the open database"
103 '/// switch to the Text Tabpage
104 printlog "switch to the Text Tabpage"
105 Kontext "DatabaseProperties"
106 TabControl.setPage TabTextBase
108 '/// set UTF-8 as character set
109 printlog "set UTF-8 as character set"
110 Kontext "TabTextBase"
111 dim iCount as integer
113 iCount = CharSet.getItemCount()
116 if (Instr(CharSet.getSelText(),"(UTF-8)") <> 0 ) then
121 '/// close the properties dialog with OK
122 printlog "close the properties dialog with OK"
123 Kontext "DatabaseProperties"
124 DatabaseProperties.OK
126 '/// save and close the database
127 call fCloseDatabase(true)
129 '/// open the text database again
130 call fOpendatabase(sFileName)
132 '/// open the table text_database
133 printlog "open the table text_Database"
134 call fOpenTable("text_database")
136 '/// check if the first row contains the string öäü
137 printlog "check if the first row contains the string öäü"
139 TableView.TypeKeys("<MOD1 C>",true)
140 if ( getClipboard = "1;öäü") then
141 printlog "The table is load with an UTF-8 locale -> OK"
143 warnlog "The table is not load ed with an UTF-8 locale -> FAILED"
147 printlog "close the table"
150 '/// close the database
151 printlog "close the database"
152 call fCloseDatabase()