Blob Blame History Raw
# $XConsortium: ScrollText2.scr /main/6 1995/07/17 20:40:18 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
# 

#  @) This test uses a Scrolled Text widget and a SingleLine Text widget
#  to test various Text widget functions.  Almost all of the functions to
#  test can be found on a popup menu accessible by pressing MB3 in either
#  widget.
#  @) In the stdout window, there should now be several messages about
#  TextPositions and XY locations of various characters.  Verify that they
#  all are correct.
#  @) The SingleLine Text widget should have a string starting at character
#  position 3 reading \"**THIS TEXT INSERTED**\" that was inserted into
#  the original source after the widget was created.
CompareVisual Text2

#  #) Whenever a primary selection of any kind is made in either widget, a
#  callback is called that prints a message saying that it gained or lost the
#  primary selection ownership.  Verify that one message comes out in the stdout
#  window for every gain or loss of primary selection.
#  #) Whenever a selection is made in either widget and a function is chosen
#  off the popup menu, the selection's left and right character positions
#  are displayed in the stdout window.  If the widget does not own the Primary
#  selection or can not perform the operation for some reason, a message to
#  that affect will be printed in the stdout window.
LocatePointer Text1 RTextChar 5
DragComponent Text1 RTextChar 10 Btn1
LocatePointer Text2 RTextChar 5
DragComponent Text2 RTextChar 10 Btn1

#  C)
Continue

#  #) The following functions are found on the popup menus.  Each one should be
#  tested in both widgets and between the widgets where appropriate:
#  !) 
#      Cut            - cuts primary selection to clipboard
#      Copy           - copies primary selection to clipboard
#      Paste          - pastes from clipboard to current
#                       cursor location
#      Remove         - deletes primary selection
#      HiLi Normal    - highlights 5 characters left of
#                       cursor location in normal mode (no
#                       highlight)
#      HiLi Selected  - highlights 5 characters left of
#                       cursor in selected mode (reverse
#                       video)
#      HiLi Secondary - highlights 5 characters left of
#                       cursor in secondary selected mode
#                       (underlined)
#      Scroll Up 2    - scrolls the text widget up 2 lines
#      Scroll Down 3  - scrolls the text widget down 2 lines
#      Toggle AddMode - toggles AddMode on and off
#                       (I-beam should be stippled)
#  
#                On the SingleLine Text widget only:
#  
#      Switch Source  - toggles the text source between its
#                       own original source and sharing the
#                       source used for the Scrolled Text
#                       widget.

## ** Text1 tests ** ##
## test Cut/Paste in Text1
LocatePointer Text1 RTextChar 5
DragComponent Text1 RTextChar 10
PressMB Btn3
LocatePointer Cut1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Copy/Paste in Text1
LocatePointer Text1 RTextChar 25
DragComponent Text1 RTextChar 30
PressMB Btn3
LocatePointer Copy1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Remove in Text1
LocatePointer Text1 RTextChar 40
DragComponent Text1 RTextChar 45
PressMB Btn3
LocatePointer Remove1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 5
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test highlight selected in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Selected1
ReleaseMB Btn3
LocatePointer Text1
CompareVisual Text1

## test highlight normal in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Normal1
ReleaseMB Btn3

## test highlight secondary in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Secondary1
ReleaseMB Btn3

## test scroll up 2 in Text1
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Up_21
ReleaseMB Btn3
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Up_21
ReleaseMB Btn3
CompareVisual Text1

## test scroll down 3 in Text1
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Down_31
ReleaseMB Btn3
CompareVisual Text1

## test toggle addmode in Text1
LocatePointer Text1 RTextChar 10
DragComponent Text1 RTextChar 15
PressMB Btn3
LocatePointer Toggle_AddMode1
ReleaseMB Btn3
LocatePointer Text1
ClickKey KRight
ClickKey KRight
CompareVisual Text1
PressMB Btn3
LocatePointer Toggle_AddMode1
ReleaseMB Btn3
LocatePointer Text1
ClickKey KLeft
ClickKey KLeft
CompareVisual Text1


## ** Text2 tests ** ##
## test Cut/Paste in Text2
LocatePointer Text2 RTextChar 5
DragComponent Text2 RTextChar 10
PressMB Btn3
LocatePointer Cut2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text2 RTextChar 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test Copy/Paste in Text2
LocatePointer Text2 RTextChar 25
DragComponent Text2 RTextChar 30
PressMB Btn3
LocatePointer Copy2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text2 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test Remove in Text2
LocatePointer Text2 RTextChar 20
DragComponent Text2 RTextChar 25
PressMB Btn3
LocatePointer Remove2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text2 RTextChar 5
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test highlight selected in Text2
LocatePointer Text2 RTextChar 30
PressMB Btn3
LocatePointer HiLi_Selected2
ReleaseMB Btn3
CompareVisual Text2

## test highlight normal in Text2
LocatePointer Text2 RTextChar 30
PressMB Btn3
LocatePointer HiLi_Normal2
ReleaseMB Btn3
CompareVisual Text2

## test highlight secondary in Text2
LocatePointer Text2 RTextChar 30
PressMB Btn3
LocatePointer HiLi_Secondary2
ReleaseMB Btn3
CompareVisual Text2

## test scroll up 2 in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Up_22
ReleaseMB Btn3
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Up_22
ReleaseMB Btn3
CompareVisual Text2

## test scroll down 3 in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Down_32
ReleaseMB Btn3
CompareVisual Text2

## test toggle addmode in Text2
LocatePointer Text2
ClickMB Btn1
ClickKey KBeginData
LocatePointer Text2 RTextChar 10
DragComponent Text2 RTextChar 15
PressMB Btn3
LocatePointer Toggle_AddMode2
ReleaseMB Btn3
LocatePointer Text2
ClickKey KRight
ClickKey KRight
CompareVisual Text2
PressMB Btn3
LocatePointer Toggle_AddMode2
ReleaseMB Btn3
LocatePointer Text2
ClickKey KLeft
ClickKey KLeft
CompareVisual Text2


## test Switch Source in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text2 RTextChar 5
ClickMB Btn1
InputString "SHARE"
CompareVisual Text1
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
LocatePointer Text2 RTextChar 5
ClickMB Btn1
InputString "SHARE"
CompareVisual Text1
CompareVisual Text2


## ** Text1 to Text2 tests ** ##
## test Cut in Text1/Paste in Text2
LocatePointer Text1 RTextChar 5
DragComponent Text1 RTextChar 10
PressMB Btn3
LocatePointer Cut1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text2 RTextChar 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test Copy in Text1/Paste in Text2
LocatePointer Text1 RTextChar 25
DragComponent Text1 RTextChar 30
PressMB Btn3
LocatePointer Copy1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text2 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2


## ** Text2 to Text1 tests ** ##
## test Cut in Text2/Paste in Text1
LocatePointer Text2 RTextChar 5
DragComponent Text2 RTextChar 10
PressMB Btn3
LocatePointer Cut2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text1 RTextChar 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Copy in Text2/Paste in Text1
LocatePointer Text2 RTextChar 25
DragComponent Text2 RTextChar 30
PressMB Btn3
LocatePointer Copy2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text1 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1


#  C)
Continue

#  #) A single MB1 click in any word of text in the Scrolled Text widget
#  should move the I-beam cursor and the selection cursor to that point.
LocatePointer Text1 RTextChar 10
ClickMB Btn1
CompareVisual Text1

#  #) Try double clicking MB1 on a word in the Scrolled Text widget.  The
#  entire word should be selected.
LocatePointer Text1 RTextChar 20
ClickMB Btn1 2
CompareVisual Text1

#  #) Now try triple clicking on a word
#  in the Scrolled Text widget.  The entire line should be selected.
LocatePointer Text1 RTextChar 30
ClickMB Btn1 3
CompareVisual Text1

#  #) Quadruple clicking on a word should selected all the text in the widget.
LocatePointer Text1 RTextChar 40
ClickMB Btn1 4
CompareVisual Text1

#  @) The SingleLine Text widget as the resource XmNselectionArrayCount set to
#  2.  This has the affect of only allowing the first two selection actions
#  to be recognized.
#  #) So, in the SingleLine Text widget, a single MB1 click
#  will move the I-beam and selection cursors.
LocatePointer Text2 RTextChar 5
ClickMB Btn1
CompareVisual Text2

#  #) A double click will select
#  the word.
LocatePointer Text2 RTextChar 10
ClickMB Btn1 2
CompareVisual Text2

#  #) But, a triple click will be interpreted as a double click
#  followed by a single click - move the cursors.
LocatePointer Text2 RTextChar 20
ClickMB Btn1 3
CompareVisual Text2

#  #) A quadruple click
#  will be interpretated as two double clicks - select the word.
LocatePointer Text2 RTextChar 30
ClickMB Btn1 4
CompareVisual Text2

#  C)
Continue

#  #) Try clicking MB1 to the bottom and right of the end of its text.  This
#  should place the cursor after the last character in the text.
LocatePointer Text1 RTextChar Max
ClickMB Btn1

#  #) Now
#  make a secondary selection of several words from the main part of the
#  #ifdef	MOTIF1_1
#  text (drag MB2 across some text to make secondary selection).  When you
#  release MB2, the selection will immediately be pasted where the cursor
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  text (drag Alt-MB2 across some text to make secondary selection).  When you
#  release Alt-MB2, the selection will immediately be pasted where the cursor
#  #endif	MOTIF1_2
#  was positioned.
LocatePointer Text1 RTextChar 1
DragComponent Text1 RTextChar 30 <Alt> Btn2 
CompareVisual Text1

#  #) Now, verify that the window can scroll horizontally properly.
LocatePointer Text1 RHorizScrollBarSlider
DragSliderValue Right Max
CompareVisual Text1
DragSliderValue Left Min
CompareVisual Text1
DragSliderValue Right 50
CompareVisual Text1

#  C)
Continue

#  /* test case for PIR 3096 */
#  #) Pick the Switch Source button on the Single Line Text widget's 
#  popup menu such that it is sharing source with the Scrolled Text
#  widget.
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
CompareVisual Text2

#  #) Select a word of text by dragging MB1 in the Single Line Text
#  widget.
# #) Confirm that the selection highlight only appears in the
# Single Line Text widget.
LocatePointer Text2 RTextChar 15
PressMB Btn1
LocatePointer Text2 RTextChar 20
ReleaseMB Btn1
CompareVisual Text1
CompareVisual Text2

#  #ifdef	MOTIF1_1
#  #) Click Alt-MB2 somewhere in text BEFORE the selection that was just made.
#  This should call the move-to() action and cause the selection to be
#  moved from where it was to where the click is.  Note that the text that
#  was moved should still be highlighted in its new location.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) Click Shift-MB2 somewhere in the text BEFORE the selection that
#  was just made.  This should call the move-to() action and cause the
#  selection to be moved from where it was to where the click is.  Note
#  that the text that was moved should still be highlighted in its new
#  location.
#  #endif	MOTIF1_2
LocatePointer Text2 RTextChar 10
ClickMB <Shift> Btn2
CompareVisual Text2

#  #ifdef	MOTIF1_1
#  #) Select another word in the same widget and try the same procedure,
#  but this time click the Alt-MB2 somewhere in the text AFTER the
#  selection.  Confirm that the highlighting is maintained correctly.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) Select another word in the same widget and try the same procedure,
#  but this time click the Shift-MB2 somewhere in the text AFTER the
#  selection.  Confirm that the highlighting is maintained correctly.
#  #endif	MOTIF1_2
#  /* end of test case for PIR 3096 */
LocatePointer Text2 RTextChar 10
PressMB Btn1
LocatePointer Text2 RTextChar 15
ReleaseMB Btn1
LocatePointer Text2 RTextChar 20
ClickMB <Shift> Btn2
CompareVisual Text2

#  C)
Continue

#  /* test case for PIR 2975 */
#  #) With the source still shared between the two widgets, click MB1
#  somewhere in the Single Line Text widget.
LocatePointer Text2 RTextChar 20
ClickMB Btn1

#  #ifdef	MOTIF1_1
#  #) Make a secondary selection in the Scrolled Text widget by dragging
#  MB2 over some text.  As MB2 is dragged, the text will be underlined.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) Make a secondary selection in the Scrolled Text widget by dragging
#  Alt-MB2 over some text.  As Alt-MB2 is dragged, the text will be underlined.
#  #endif	MOTIF1_2
LocatePointer Text1 RTextChar 5
PressMB <Alt> Btn2
LocatePointer Text1 RTextChar 10
CompareVisual Text1
ReleaseMB <Alt> Btn2

#  #ifdef	MOTIF1_1
#  #) Confirm that after MB2 is released, the secondarily selected text is
#  copied to the destination cursor in the Single Line Text widget and that
#  the underlining is erased in the Scrolled Text widget.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) Confirm that after Alt-MB2 is released, the secondarily selected text is
#  copied to the cursor in the Single Line Text widget and that
#  the underlining is erased in the Scrolled Text widget.
#  #endif	MOTIF1_2
#  /* end of test case for PIR 2975 */
CompareVisual Text1
CompareVisual Text2

# #) Select the Switch Source button on the Single Line Text widget's
# popup menu again. The Single Line Text widget should no longer be
# sharing source with the Scrolled Text widget.
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3

# C)
Continue

# #)  The Scrolled Text widget should now be empty and the Single
# Line Text widget should have just one line of text.
CompareVisual Text1
CompareVisual Text2

# #)  A new menu item, \"Set Source at Invalid Position\", has been added to the
# popup menu of the Scrolled Text widget. Selecting this new
# menu item will assign the source of the Single Line Text widget
# to the source of the Scrolled Text widget while setting the cursor
# position to a value beyond the length of the text.
# #)  Verify that the cursor position within the Scrolled Text widget
# immediately follows the last character in the newly displayed text string.
LocatePointer Text1
PressMB Btn3
LocatePointer Set_Source
ReleaseMB Btn3
CompareVisual Text1

# C)
Continue

#  E)
Exit