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: w_dropdownLB1.inc,v $
13 '* last change: $Author: vg $ $Date: 2008-08-18 12:26:11 $
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 : helge.delfs@sun.com
36 '* short description : Test Drop Down List Box
38 '************************************************************************
40 ' #1 tDropDownLB_1 'Check 'Input List'
41 ' #1 tDropDownLB_2 'All input field should be initially empty
42 ' #1 tDropDownLB_3 'Test Add button
43 ' #1 tDropDownLB_4 'Test Return in Item editbox
44 ' #1 tDropDownLB_5 'Test new item will always be added at the end of 'Items on list'
45 ' #1 tDropDownLB_6 'The first entry in the list box is the shown default
46 ' #1 tDropDownLB_7 'Test 'Remove' button
47 ' #1 tDropDownLB_8 'Test 'Move Up' button
48 ' #1 tDropDownLB_9 'Test 'Move Down' button
49 ' #1 tDropDownLB_10 'Test 'Ctrl+Shift+F9'
50 ' #1 tDropDownLB_11 'OK button should insert new value
51 ' #1 tDropDownLB_12 'Test Next button
52 ' #1 tDropDownLB_13 'Test Edit button
53 ' #1 tDropDownLB_14 'Test Edit/Fields
54 ' #1 tDropDownLB_15 'Test Right arrow button
55 ' #1 tDropDownLB_16 'Test Left arrow button
56 ' #1 tDropDownLB_17 'Import from Word document
58 '\***********************************************************************
60 testcase tDropDownLB_1
65 PrintLog "- Check 'Input List'"
69 PrintLog "- Insert/Field/Other/ Functions"
70 PrintLog "- Check if 'Input List' exists in Type area"
71 Call fInsertFieldsOther("TabFunktionen")
74 if Not EntrysList.IsVisible then
75 Warnlog "Maybe wrong type selected in list. Not 'Input list'"
83 '-------------------------------------------------------------------------------------------
85 testcase tDropDownLB_2
91 PrintLog "- All input field should be initially empty"
93 PrintLog "- Open a new document"
96 PrintLog "- Insert/Field/Other/ Functions"
97 PrintLog "- select Input list"
98 PrintLog "- Check if all input field should be initially empty"
99 Call fInsertFieldsOther("TabFunktionen")
102 if Len(NewListEntry.GetText) <> 0 then Warnlog "Item isn't empty!"
103 if EntrysList.GetItemCount <> 0 then Warnlog "Items on list isn't empty!"
104 if Len(EntryName.GetText) <> 0 then Warnlog "Name isn't empty!"
111 '-------------------------------------------------------------------------------------------
113 testcase tDropDownLB_3
118 iType = 2 : sItem = "Entry 1"
120 PrintLog "- Test Add button"
122 PrintLog "- Open a new document"
125 PrintLog "- Insert/Field/Other/ Functions"
126 PrintLog "- select Input list"
127 PrintLog "- Input text in 'Item' , then click 'Add' button"
128 PrintLog "- Check if the text is inserted into 'Items on List'"
129 Call fInsertFieldsOther("TabFunktionen")
132 NewListEntry.SetText sItem
136 if EntrysList.GetSelText(1) <> sItem then Warnlog "the text isn't inserted into 'Items on list' correctly!"
143 '-------------------------------------------------------------------------------------------
145 testcase tDropDownLB_4
150 iType = 2 : sItem = "Entry 1"
152 PrintLog "- Test Pressing return in Item editbox"
154 PrintLog "- Open a new document"
157 PrintLog "- Insert/Field/Other/ Functions"
158 PrintLog "- select Input list"
159 PrintLog "- Input text in 'Item' , then click 'Add' button"
160 PrintLog "- Check if the text is inserted into 'Items on List'"
161 Call fInsertFieldsOther("TabFunktionen")
164 NewListEntry.SetText sItem
166 NewListEntry.Typekeys "<Return>"
168 if EntrysList.GetSelText(1) <> sItem then Warnlog "the text isn't inserted into 'Items on list' correctly!"
175 '-------------------------------------------------------------------------------------------
177 testcase tDropDownLB_5
180 Dim sItem() as String
195 PrintLog "- Test new item will always be added at the end of 'Items on list'"
197 PrintLog "- Open a new document"
200 PrintLog "- Insert/Field/Other/ Functions"
201 PrintLog "- select Input list"
202 PrintLog "- Input some items"
203 PrintLog "- Check if new item will always be added at the end of 'Items on list'"
204 Call fInsertFieldsOther("TabFunktionen")
209 NewListEntry.SetText sItem(i)
217 EntrysList.Select i+1
220 Warnlog "There should be 6 itmes in the Items on list!"
222 if EntrysList.GetSelText <> sItem(i) then Warnlog "Hope to get " & sItem(i) & " but get " & EntrysList.GetSelText
230 '-------------------------------------------------------------------------------------------
232 testcase tDropDownLB_6
235 Dim sItem() as String
250 PrintLog "- The first entry in the list box is the shown default"
252 PrintLog "- Open a new document"
255 PrintLog "- Insert/Field/Other/ Functions"
256 PrintLog "- select Input list"
257 PrintLog "- Input some items"
258 PrintLog "- Set focus to the middle Item"
259 PrintLog "- click insert button , then Close the dialog"
260 Call fInsertFieldsOther("TabFunktionen")
265 NewListEntry.SetText sItem(i)
279 if GetClipboardText <> sItem(0) then Warnlog "should get " &sItem(0) & " but get " & GetClipboardText
285 '-------------------------------------------------------------------------------------------
287 testcase tDropDownLB_7
290 Dim sItem() as String
303 PrintLog "- Test Remove button"
305 PrintLog "- Open a new document"
308 PrintLog "- Insert/Field/Other/ Functions"
309 PrintLog "- select Input list"
310 PrintLog "- Input some items"
311 PrintLog "- Set focus to the middle Item"
312 PrintLog "- click remove button"
313 PrintLog "- check if the selected item is removed"
314 Call fInsertFieldsOther("TabFunktionen")
320 Warnlog "The remove button should be only ebabled when an item is selected!"
325 NewListEntry.SetText sItem(i)
338 if EntrysList.GetSelText <> sItem(0) then Warnlog "Hope to get " & sItem(0) & " but get " & EntrysList.GetSelText
342 if EntrysList.GetSelText <> sItem(1) then Warnlog "Hope to get " & sItem(1) & " but get " & EntrysList.GetSelText
346 if EntrysList.GetSelText <> sItem(3) then Warnlog "Hope to get " & sItem(3) & " but get " & EntrysList.GetSelText
350 Warnlog "There should be only 3 itmes in the Items on list !"
360 '-------------------------------------------------------------------------------------------
362 testcase tDropDownLB_8
365 Dim sItem() as String
366 Dim sNewItem() as String
386 PrintLog "- Test 'Move Up' button"
388 PrintLog "- Open a new document"
391 PrintLog "- Insert/Field/Other/ Functions"
392 PrintLog "- select Input list"
393 PrintLog "- Input some items"
394 PrintLog "- Set focus to the last Item,"
395 PrintLog "- click Move Up button third times"
396 PrintLog "- check if the 4th item is the 1st one"
397 Call fInsertFieldsOther("TabFunktionen")
402 NewListEntry.SetText sItem(i)
418 EntrysList.Select i+1
420 if EntrysList.GetSelText <> sNewItem(i) then Warnlog "Hope to get " & sItem(i) & " but get " & EntrysList.GetSelText
428 '-------------------------------------------------------------------------------------------
430 testcase tDropDownLB_9
433 Dim sItem() as String
434 Dim sNewItem() as String
453 PrintLog "- Test 'Move Down' button"
455 PrintLog "- Open a new document"
458 PrintLog "- Insert/Field/Other/ Functions"
459 PrintLog "- select Input list"
460 PrintLog "- Input some items"
461 PrintLog "- Set focus to the 1st Item,"
462 PrintLog "- click Move Down button third times"
463 PrintLog "- check if the 1st item is the 4th one"
464 Call fInsertFieldsOther("TabFunktionen")
469 NewListEntry.SetText sItem(i)
485 EntrysList.Select i+1
487 if EntrysList.GetSelText <> sNewItem(i) then Warnlog "Hope to get " & sItem(i) & " but get " & EntrysList.GetSelText
495 '-------------------------------------------------------------------------------------------
497 testcase tDropDownLB_10
505 PrintLog "- Test 'Ctrl+Shift+F9'"
507 PrintLog "- Open a new document"
510 PrintLog "- Insert/Field/Other/ Functions"
511 PrintLog "- select Input list"
512 PrintLog "- Input 1 item"
513 PrintLog "- click insert and close the dialog"
514 Call fInsertFieldsOther("TabFunktionen")
517 NewListEntry.SetText sItem
525 PrintLog "- Set focus in front of the list"
526 Call wTypeKeys "<MOD1 Home>"
528 PrintLog "- Press Ctrl+Shift+F9"
529 Call wTypeKeys "<MOD1 Shift F9>"
531 Kontext "EditInputList"
532 if EditInputList.Exists then
535 Warnlog "The dialog can't be actived ."
542 '-------------------------------------------------------------------------------------------
544 testcase tDropDownLB_11
551 sItem1 = "Entry 1" : sItem2 = "Entry 2"
553 PrintLog "- OK button should insert new value"
555 PrintLog "- Open a new document"
558 PrintLog "- Insert/Field/Other/ Functions"
559 PrintLog "- select Input list"
560 PrintLog "- Input 2 items"
561 PrintLog "- click insert and close the dialog"
562 Call fInsertFieldsOther("TabFunktionen")
565 NewListEntry.SetText sItem1
569 NewListEntry.SetText sItem2
578 PrintLog "- Set focus in front of the list"
579 Call wTypeKeys "<MOD1 Home>"
581 PrintLog "- Press Ctrl+Shift+F9"
582 Call wTypeKeys "<MOD1 Shift F9>"
584 PrintLog "- select 2nd list and press OK"
585 Kontext "EditInputList"
586 AllListEntrys.Select 2
590 PrintLog "- Check if the result is right"
594 if GetClipboardText <> sItem2 then Warnlog "should get " &sItem2 & " but get " & GetClipboardText
600 '-------------------------------------------------------------------------------------------
602 testcase tDropDownLB_12
605 Dim sItem1() as String
606 Dim sItem2() as String
626 PrintLog "- Test Next button"
627 PrintLog "- Open a new document"
630 PrintLog "- Insert/Field/Other/ Functions"
631 PrintLog "- select Input list"
632 PrintLog "- Input some items"
633 PrintLog "- click insert and close the dialog"
634 Call fInsertFieldsOther("TabFunktionen")
640 NewListEntry.SetText sItem1(i)
650 PrintLog "- Set focus to another line"
651 Call wTypeKeys "<End><Return><Return>"
653 PrintLog "- Insert/Field/Other/ Functions"
654 PrintLog "- select Input list"
655 PrintLog "- Input some other items"
656 PrintLog "- click insert and close the dialog"
657 Call fInsertFieldsOther("TabFunktionen")
663 NewListEntry.SetText sItem2(i)
673 PrintLog "- Set focus in front of the 1st list."
674 Call wTypeKeys "<MOD1 Home>"
676 PrintLog "- Press Ctrl+Shift+F9"
677 Call wTypeKeys "<MOD1 Shift F9>"
679 PrintLog "- the 1st group items should be in edit area."
680 Kontext "EditInputList"
682 AllListEntrys.Select i+1
684 if AllListEntrys.GetSelText <> sItem1(i) then Warnlog "Hope to get " & sItem1(i) & " but get " & AllListEntrys.GetSelText
687 PrintLog "- Press next button , the 2nd group items should be in edit area."
692 AllListEntrys.Select i+1
694 if AllListEntrys.GetSelText <> sItem2(i) then Warnlog "Hope to get " & sItem2(i) & " but get " & AllListEntrys.GetSelText
703 '-------------------------------------------------------------------------------------------
705 testcase tDropDownLB_13
712 sItem1 = "Entry 1" : sItem2 = "Entry A"
714 PrintLog "- Test Edit button"
716 PrintLog "- Open a new document"
719 PrintLog "- Insert/Field/Other/ Functions"
720 PrintLog "- select Input list"
721 PrintLog "- Input a item"
722 PrintLog "- click insert and close the dialog"
723 Call fInsertFieldsOther("TabFunktionen")
727 NewListEntry.SetText sItem1
736 PrintLog "- Set focus to another line"
737 Call wTypeKeys "<End><Return><Return>"
739 PrintLog "- Insert/Field/Other/ Functions"
740 PrintLog "- select Input list"
741 PrintLog "- Input another item"
742 PrintLog "- click insert and close the dialog"
743 Call fInsertFieldsOther("TabFunktionen")
747 NewListEntry.SetText sItem2
756 PrintLog "- Set focus in front of the 1st list"
757 Call wTypeKeys "<MOD1 Home>"
759 PrintLog "- Press Ctrl+Shift+F9"
760 Call wTypeKeys "<MOD1 Shift F9>"
762 PrintLog "- Press Edit button , the edit/field dialog should be up"
763 Kontext "EditInputList"
767 Kontext "FeldbefehlBearbeitenFunktionen"
768 if FeldbefehlBearbeitenFunktionen.Exists then
770 if EntrysList.GetSelText <> sItem1 then
771 Warnlog "Hope to get " & sItem1 & " but get " & EntrysList.GetSelText & "->Bug#115731"
773 FeldbefehlBearbeitenFunktionen.Cancel
775 Warnlog "The dialog can't be actived ."
778 Kontext "EditInputList"
785 '-------------------------------------------------------------------------------------------
787 testcase tDropDownLB_14
790 Dim sItem() as String
791 Dim sEntryName as String
796 sEntryName = "entryTest"
807 PrintLog "- Test Edit/Fields"
809 PrintLog "- Open a new document"
812 PrintLog "- Insert/Field/Other/ Functions"
813 PrintLog "- select Input list"
814 PrintLog "- Input some items"
815 PrintLog "- set Entry name"
816 PrintLog "- click insert button , then Close the dialog"
817 Call fInsertFieldsOther("TabFunktionen")
822 NewListEntry.SetText sItem(i)
828 EntryName.SetText sEntryName
834 PrintLog "- Set focus in front of the 1st list"
835 Call wTypeKeys "<Home>"
837 PrintLog "- Edit/Fields , check if the entry items' info is correct."
839 Kontext "FeldbefehlBearbeitenFunktionen"
841 EntrysList.Select i+1
843 if EntrysList.GetSelText <> sItem(i) then Warnlog "Hope to get " & sItem(i) & " but get " & EntrysList.GetSelText
845 if EntryName.GetText <> sEntryName then Warnlog "Entry name should be " & sEntryName & " but get " & EntryName.GetText
846 FeldbefehlBearbeitenFunktionen.Cancel
852 '-------------------------------------------------------------------------------------------
854 testcase tDropDownLB_15
861 sItem1 = "Entry 1" : sItem2 = "Entry A"
863 PrintLog "- Test Right arrow button"
865 PrintLog "- Open a new document"
868 PrintLog "- Insert/Field/Other/ Functions"
869 PrintLog "- select Input list"
870 PrintLog "- Input a item"
871 PrintLog "- click insert and close the dialog"
872 Call fInsertFieldsOther("TabFunktionen")
876 NewListEntry.SetText sItem1
885 PrintLog "- Set focus to another line"
886 Call wTypeKeys "<End><Return><Return>"
888 PrintLog "- Insert/Field/Other/ Functions"
889 PrintLog "- select Input list"
890 PrintLog "- Input another item"
891 PrintLog "- click insert and close the dialog"
892 Call fInsertFieldsOther("TabFunktionen")
896 NewListEntry.SetText sItem2
905 PrintLog "- Set focus in front of the 1st list."
906 Call wTypeKeys "<MOD1 Home>"
908 PrintLog "- Edit/Fields"
911 PrintLog "- click Right arrow button"
912 Kontext "FeldbefehlBearbeitenFunktionen"
914 if EntrysList.GetSelText <> sItem1 then
915 Warnlog "1.Hope to get " & sItem1 & " but get " & EntrysList.GetSelText
917 NaechsterFeldbefehl.Click
920 if EntrysList.GetSelText <> sItem2 then
921 Warnlog "2.Hope to get " & sItem2 & " but get " & EntrysList.GetSelText
923 FeldbefehlBearbeitenFunktionen.Cancel
929 '-------------------------------------------------------------------------------------------
931 testcase tDropDownLB_16
938 sItem1 = "Entry 1" : sItem2 = "Entry A"
940 PrintLog "- Test Left arrow button"
942 PrintLog "- Open a new document"
945 PrintLog "- Insert/Field/Other/ Functions"
946 PrintLog "- select Input list"
947 PrintLog "- Input a item"
948 PrintLog "- click insert and close the dialog"
949 Call fInsertFieldsOther("TabFunktionen")
953 NewListEntry.SetText sItem1
962 PrintLog "- Set focus to another line."
963 Call wTypeKeys "<End><Return><Return>"
965 PrintLog "- Insert/Field/Other/ Functions"
966 PrintLog "- select Input list"
967 PrintLog "- Input another item"
968 PrintLog "- click insert and close the dialog"
969 Call fInsertFieldsOther("TabFunktionen")
973 NewListEntry.SetText sItem2
982 PrintLog "- Set focus in front of the 2nd list."
983 Call wTypeKeys "<Home>"
985 PrintLog "- Edit/Fields"
988 PrintLog "- click Left arrow button."
989 Kontext "FeldbefehlBearbeitenFunktionen"
991 if EntrysList.GetSelText <> sItem2 then
992 Warnlog "1.Hope to get " & sItem2 & " but get " & EntrysList.GetSelText
994 VorigerFeldbefehl.Click
997 if EntrysList.GetSelText <> sItem1 then
998 Warnlog "2.Hope to get " & sItem1 & " but get " & EntrysList.GetSelText
1000 FeldbefehlBearbeitenFunktionen.Cancel
1006 '-------------------------------------------------------------------------------------------
1008 testcase tDropDownLB_17
1010 Dim sTestFile as String
1011 Dim sItem1() as String
1012 Dim sItem2() as String
1016 sTestFile = Convertpath (gTesttoolpath + "writer\optional\input\dropdownLB\DropDownListBox.doc")
1029 PrintLog "- Import from Word document"
1030 PrintLog "- Open a new document"
1032 PrintLog "- Open a word document which includes 2 entries."
1033 Call hFileOpen(sTestFile)
1034 Call sMakeReadOnlyDocumentEditable
1035 PrintLog "- Set focus in front of first line."
1036 Call wTypeKeys "<MOD1 Home>"
1037 PrintLog "- Edit/Fields."
1041 Warnlog "Can't import word document!"
1046 PrintLog "- click Left arrow button"
1047 Kontext "FeldbefehlBearbeitenFunktionen"
1048 if EntrysList.GetItemCount = 3 then
1049 For i = 1 to EntrysList.GetItemCount
1052 if EntrysList.GetSelText <> sItem1(i-1) then Warnlog "Hope to get " & sItem1(i-1) & " but get " & EntrysList.GetSelText
1055 warnlog "Not all entrys in field correctly imported!"
1058 FeldbefehlBearbeitenFunktionen.Cancel
1060 PrintLog "- Set focus in front of third line"
1061 Call wTypeKeys "<MOD1 Home>"
1062 Call wTypeKeys "<Down>" , 2
1063 Call wTypeKeys "<Home>"
1065 PrintLog "- Edit/Fields"
1069 Warnlog "Can't import word document!"
1074 PrintLog "- click Left arrow button"
1075 Kontext "FeldbefehlBearbeitenFunktionen"
1076 if EntrysList.GetItemCount = 3 then
1077 For i = 1 to EntrysList.GetItemCount
1080 if EntrysList.GetSelText <> sItem2(i-1) then Warnlog "Hope to get " & sItem2(i-1) & " but get " & EntrysList.GetSelText
1083 warnlog "Not all entrys in field correctly imported!"
1086 FeldbefehlBearbeitenFunktionen.Cancel
1088 Call hCloseDocument ' <- close word document
1092 '-------------------------------------------------------------------------------------------