Blob Blame History Raw
# $XConsortium: Text9.scr /main/6 1995/07/17 20:42:26 drk $
# 
# Motif
#
# Copyright (c) 1987-2012, The Open Group. All rights reserved.
#
# These libraries and programs are free software; you can
# redistribute them and/or modify them under the terms of the GNU
# Lesser General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# These libraries and programs are distributed in the hope that
# they 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 for more
# details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with these librararies and programs; if not, write
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301 USA
# 
# 
# HISTORY
# 

#  @) The left side of this test contains a MultiLine Text widget and
#     the right, a SingleLine Text widget.  Each set of widgets
#     below the text widgets pertain to the text widget above them.
#     Do all the first tests on the MultiLine Text widget.
#  #) The MultiLine Text widget should have \"His wife could...
#     on the top line in the window.  Grab the vertical scrollbar
#     and slide it up so the first line is displayed reading \"Jack
#     Sprat could...\".
LocatePointer Text1 RVertScrollBarSlider
DragSliderValue Up Min
CompareVisual Text1

#  #) Click MB1 right before the word \"Sprat\" in the MultiLine
#     Text widget.  The I-beam cursor should now be at that position.
LocatePointer Text1 RTextChar 5
ClickMB Btn1
CompareVisual Text1

#  #) Try inserting new text into the widget by typing \"NEW\".
#     You should just hear the bell beep 3 times, but no text will
#     be inserted.
InputString "NEW"
CompareVisual Text1

#  #) Now click MB1 on the \"verifyBell\" togglebutton.  Click in
#     the text widget at the same position and try typing \"NEW\" again.
#     There should be NO bell, and still no text inserted.
LocatePointer veriTB1
ClickMB Btn1
LocatePointer Text1 RTextChar 5
ClickMB Btn1
InputString "NEW"
CompareVisual Text1

#  #) Now click MB1 on the \"doit flag\" togglebutton.  Click in the
#     text widget and try typing again.  It should work this time.  Note
#     that the \"text length\" should increase as you insert characters
#     into the text widget.
LocatePointer doitTB1
ClickMB Btn1
LocatePointer Text1 RTextChar 5
ClickMB Btn1
InputString "NEW"
CompareVisual Text1

#  C)
Continue

#  #) Drag the \"top character\" slider to the right until it reads 35.
#     The MultiLine text widget should now have the second line of text at
#     the top of the window (starts with \"His wife could..\").
LocatePointer topScale1 RScaleSlider
DragSliderValue Right 35
CompareVisual Text1

#  #) Drag the \"cursor position\" slider out to 12.  The widget should
#     shift so that the first line is again at the top and the caret
#     cursor is before the eighth position (just before the \'t\' in \"Sprat\").
LocatePointer cursScale1 RScaleSlider
DragSliderValue Right 12
CompareVisual Text1

#  #) Now drag the \"top character\" to 43.  The second line of text should
#     again be the top line in the window and there should be no cursor
#     visible at all.
LocatePointer topScale1 RScaleSlider
DragSliderValue Right  43
CompareVisual Text1

#  #) Click MB1 on the \"show position\" pushbutton.  The window should
#     change to have the first text line visible again.  If you press <Tab>,
#     the highlight will move to the MultiLine Text widget and the I-beam cursor
#     will again be showing before the t in \"Sprat\".
LocatePointer showPosPB1
ClickMB Btn1
ClickKey KTab
CompareVisual Text1

#  C)
Continue

#  #) Click MB1 on the \"6x12\" button in the radio box.  The text widget
#     font should shrink and its window should size itself accordingly.
#     Also, the \"text baseline\" should now read 17.
LocatePointer RB1_6x12
ClickMB Btn1
CompareVisual Text1

#  #) Click MB1 on the \"9x15\" button.  The text widget font should change
#     again and its window will grow.  The \"text baseline\" should now
#     read 21.
LocatePointer RB1_9x15
ClickMB Btn1
CompareVisual Text1

#  #) Click MB1 on the \"8x13\" button.  The text widget font should return
#     to its initial size, and the window should also resize.
LocatePointer RB1_8x13
ClickMB Btn1
CompareVisual Text1

#  C)
Continue

# @) Test whether the setting of top character works
#    correctly when word wrap is on.
# #) Some text is displayed with word wrap off. Scroll text widget vertically
#    to verify that the text runs horizontally outside of the window.
# #) Select the word wrap toggle.  All text should now fit within
#    the vertical bounds of the text widget.
#    There are actually three logical lines of text. The first two lines
#    of text end with a newline character.  The third line of text does not.
#    When word wrap is set, the third logical line of text is displayed as
#    nine lines of physical text.
LocatePointer wordWrap
ClickMB Btn1

# #) Drag the \"top character\" slider to the right until it reads 38.
#    The beginning of the third logical line should be displayed at
#    the top of the window.  It reads "This line of text".
LocatePointer topScale1 RScaleSlider
DragSliderValue Right  38
CompareVisual Text3

# #) Drag the \"top character\" slider to the right until it reads 56.
#    The text "does not end with a" should be displayed at the top of
#    the window.
LocatePointer topScale1 RScaleSlider
DragSliderValue Right  56
CompareVisual Text3

# C)
Continue

#  @) Now do all of the tests again on the SingleLine Text widget.
#  #) The SingleLine Text widget should have \"s wife could eat no\" 
#     displayed in the window.
#  #) Click MB1 right before the word \"could\" in the SingleLine
#     Text widget.  The I-beam cursor should now be at that position.
WindowRaise Shell1
LocatePointer Text2 RTextChar 36
ClickMB Btn1
CompareVisual Text2

#  #) Try inserting new text into the widget by typing \"NEW\".
#     You should not hear any bell and no text should be inserted.
InputString "NEW"
CompareVisual Text2

#  #) Now click MB1 on the \"verifyBell\" togglebutton.  Click at the
#     same position in the text widget and try typing \"NEW\" again.
#     There should now be three bells, and still no text inserted.
LocatePointer veriTB2
ClickMB Btn1
LocatePointer Text2 RTextChar 36
ClickMB Btn1
InputString "NEW"
CompareVisual Text2

#  #) Now click MB1 on the \"doit flag\" togglebutton.  Try typing
#     into the text widget again.  It should work this time.  Note
#     that the \"text length\" should increase as you insert characters
#     into the text widget.
LocatePointer doitTB2
ClickMB Btn1
LocatePointer Text2 RTextChar 36
ClickMB Btn1
InputString "NEW"
CompareVisual Text2

#  C)
Continue

#  #) Drag the \"top character\" slider to the right until it reads 35.
#     The SingleLine text widget should now have shifted the text in
#     the window (should read \"e NEWcould eat no le\").
WindowRaise Shell1
LocatePointer topScale2 RScaleSlider
DragSliderValue Right 35
CompareVisual Text2

#  #) Drag the \"cursor position\" slider out to 5.  The widget should
#     shift so that the first line is again in the window and the caret
#     cursor is before the fifth position (just before \"Sprat\").
LocatePointer cursScale2 RScaleSlider
DragSliderValue Right 5
CompareVisual Text2

#  #) Now drag the \"top character\" to 43.  Part of the second line of text
#     should again be in the window and there should be no cursor visible at
#     all.
LocatePointer topScale2 RScaleSlider
DragSliderValue Right 43
CompareVisual Text2

#  #) Click MB1 on the \"show position\" pushbutton.  The window should
#     change to have the first text line visible again with the caret cursor
#     showing before the word \"Sprat\".
LocatePointer showPosPB2
ClickMB Btn1
CompareVisual Text2

#  C)
Continue

#  #) Click MB1 on the \"6x12\" button in the radio box.  The text widget
#     font should shrink and the window should size itself accordingly.
#     Also, the \"text baseline\" should now read 17.
WindowRaise Shell1
LocatePointer RB2_6x12
ClickMB Btn1
CompareVisual Text2

#  #) Click MB1 on the \"9x15\" button.  The text widget font should change
#     again and the window should grow.  The \"text baseline\" should now
#     read 21.
LocatePointer RB2_9x15
ClickMB Btn1
CompareVisual Text2

#  #) Click MB1 on the \"8x13\" button.  The text widget font should return
#     to its initial size, and the window should also resize.
LocatePointer RB2_8x13
ClickMB Btn1
CompareVisual Text2

#  C)
Continue

#  @) You can change the range of text which is selected by a double click
#     by changing the selection in the \"Double Click Selects...\" option
#     menu. When you make a new selection, both text widgets will be altered.
#  #) Try each selection in the option menu and confirm that a double click
#     selects the correct amount of text in both widgets.
#  !) 
#          Position    means double click just sets the
#                      cursor and nothing is selected.
LocatePointer selectionOption1 ROptionButton
PressMB Btn1
LocatePointer Position
ReleaseMB Btn1
LocatePointer Text3 RVertScrollBarSlider
DragSliderValue Up Min
LocatePointer Text3 RTextChar 38
ClickMB Btn1
CompareVisual Text3
System sleep 1
ClickMB Btn1 2
CompareVisual Text3

#          Word        selects a word. 
LocatePointer selectionOption1 ROptionButton
PressMB Btn1
LocatePointer Word
ReleaseMB Btn1
LocatePointer Text3 RTextChar 38
ClickMB Btn1
CompareVisual Text3
System sleep 1
ClickMB Btn1 2
CompareVisual Text3

#          Line        selects one line of text source.
#                   ( When wordWrap is ON, one line of text
#                     source may be displayed as multiple
#                     output lines.
#                     Each of the output lines which
#                     correspond to one source line
#                     will be selected. )
 
LocatePointer selectionOption1 ROptionButton
PressMB Btn1
LocatePointer Line
ReleaseMB Btn1
LocatePointer Text3 RTextChar 38
ClickMB Btn1
CompareVisual Text3
System sleep 1
ClickMB Btn1 2
CompareVisual Text3

#          All         means the entire contents is selected.
## insert returns to make a new paragraph
LocatePointer Text3 RTextChar 18
ClickMB Btn1
ClickKey KReturn
ClickKey KReturn
InputString "new line"
LocatePointer selectionOption1 ROptionButton
PressMB Btn1
LocatePointer All
ReleaseMB Btn1
LocatePointer Text3 RTextChar 38
ClickMB Btn1
CompareVisual Text3
System sleep 1
ClickMB Btn1 2
CompareVisual Text3

# C)
Continue

# The following testcase checks the amount of indentation which
# results after inserting a tab into a Text widget. Before inserting
# tabs, verify that the wordWrap toggle is selected.

# ClickMB1 at the beginning of the Scrolled Text widget. Click KTab.
# Verify that the text is indented by eight columns. The first character
# on the first line of text should align to the right of the first
# occurance of the number "8" on the second line of text.

LocatePointer Text3 RTextChar 0
ClickMB Btn1
ClickKey KTab
CompareVisual Text3

# Click KTab again. The text should indent by another eight columns.
# The first character on the first line of text should align to the
# right of the second occurance of the number "8" on the second
# line of text.

ClickKey KTab
CompareVisual Text3

# Click KTab once again.  Since wordWrap is on, and the first word is
# too long to fit on the first line after the indentation, the
# text moves to the next line in the Text widget.

ClickKey KTab
CompareVisual Text3

# Click KTab seven more times. Verify that upto 10 tabs can be inserted
# into the Text widget.

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

ClickKey KTab
CompareVisual Text3

# C)
Continue

#  E)
Exit