jl165 merging heads
[LibreOffice.git] / testautomation / framework / required / includes / basic_dialog_i18n_import.inc
blobdf193a2bddbf5336679258a4c4c3351a5f1bf897
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 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
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.
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).
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.
26 '/************************************************************************
28 '*  owner : gregor.hartmann@oracle.com
30 '*  short description : 
32 '\******************************************************************************
34 testcase tBasicDialogI18nImport
36     printlog( "Dialogs that show up when importing multi locale dialogs into BASIC IDE" )
37     
38     dim cDialogPath as string
39         cDialogPath = gTesttoolPath & "framework\required\input\basic_ide\Dialog5.xdl"
40         cDialogPath = convertpath( cDialogPath )
41         
42     dim iNumberOfLanguages as integer
43     dim iTry as integer
44         
45     const LANGUAGE_COUNT = 5
46     const MAX_RETRIES = 5
47     const WAIT_TIME = 100
48     const MODULE_NAME = "tDialogI18nImport"
49     const DIALOG_WAIT_TIMEOUT = 2
50     const MSG_LOCALE_CLASH_WARNING_BUTTONCOUNT = 4
51     const MSG_DIALOG_REPLACE_WARNING_BUTTONCOUNT = 3
52         
53     printlog( "Open BASIC-IDE" )
54     hCreateDocument()
55     hInitFormControls( MODULE_NAME )
56     
57     kontext "ToolsCollectionBar"
58     if ( ToolsCollectionBar.exists() ) then ToolsCollectionBar.close()
59     
60     Kontext "DialogBar"
61     if ( DialogBar.exists() ) then
62     
63         printlog( "Click on <Import> button on <DialogBar>" )
64         Import.click()
65         
66         kontext "OeffnenDlg"
67         if ( OeffnenDlg.exists( DIALOG_WAIT_TIMEOUT ) ) then
68         
69             printlog( "Enter path to test dialog" )
70             DateiName.setText( cDialogPath ) 
71             Oeffnen.click()
72             
73             printlog( "Test messagebox" )
74             kontext "active"
75             if ( Active.exists( DIALOG_WAIT_TIMEOUT ) ) then
76             
77                 printlog( "Messagebox: " & Active.getText() ) 
78                 if ( Active.getButtonCount() <> MSG_LOCALE_CLASH_WARNING_BUTTONCOUNT ) then
79                     warnlog( "Incorrect messagebox, expected locale clash warning" )
80                 endif
81                 
82                 call DialogTest( Active )
83                 
84                 printlog( "Accept with yes" )
85                 hCloseDialog( Active, "yes" )
87                 Kontext "TranslationBar"
88                 if ( TranslationBar.exists() ) then
90                     for iTry = 1 to MAX_RETRIES
91                         iNumberOfLanguages = CurrentLanguage.getItemCount()
92                         if ( iNumberOfLanguages = LANGUAGE_COUNT ) then exit for
93                         wait( WAIT_TIME )
94                     next iTry
95                 
96                     printlog( "Check number of imported languages" )
97                     if ( iNumberOfLanguages <> LANGUAGE_COUNT ) then
98                         warnlog( "Incorrect language count in listbox <CurrentLanguage>" )
99                         printlog( "Expected: " & LANGUAGE_COUNT )
100                         printlog( "Found...: " & iNumberOfLanguages )
101                     endif
102                     
103                     Kontext "DialogBar"
104                     if ( DialogBar.exists() ) then
105                     
106                         printlog( "Click on <Import> button on <DialogBar>" )
107                         Import.click()
108                         
109                         kontext "OeffnenDlg"
110                         if ( OeffnenDlg.exists( DIALOG_WAIT_TIMEOUT ) ) then
112                             printlog( "Enter path to test dialog" )                        
113                             DateiName.setText( cDialogPath )
114                             Oeffnen.click()
115                             
116                             printlog( "Test messagebox" )
117                             kontext "Active"
118                             if ( Active.exists( DIALOG_WAIT_TIMEOUT ) ) then
119                             
120                                 printlog( "Messagebox: " & Active.getText() ) 
121                                 if ( Active.getButtonCount() <> MSG_DIALOG_REPLACE_WARNING_BUTTONCOUNT ) then
122                                     warnlog( "Incorrect messagebox, expected dialog replace warning" )
123                                 endif
124                                 
125                                 call DialogTest( Active )
126                                 
127                                 Printlog( "Rename the new dialog" )
128                                 hCloseDialog( Active, "yes" )
129                             else
130                                 warnlog( "Overwrite warning missing" )
131                             endif
132                         else
133                             warnlog( "<OeffnenDlg> did not open" )
134                         endif
135                     else
136                         warnlog( "<DialogBar> is not available" )
137                     endif
138                 else
139                     warnlog( "<TranslationBar> is not available" )
140                 endif
141             else
142                 warning( "Conflicting locales messagebox is missing" )
143             endif
144         else
145             warnlog( "<OeffnenDlg> did not open" )
146         endif
147     else
148         warnlog( "<DialogBar> is not available" )
149     endif
150     hCloseBasicIde()
151     hDestroyDocument()
152     
153 endcase