# $XConsortium: TextField2.scr /main/5 1995/07/17 20:42:51 drk $ # # @OPENGROUP_COPYRIGHT@ # COPYRIGHT NOTICE # Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc. # Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group # ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for # the full copyright text. # # This software is subject to an open license. It may only be # used on, with or for operating systems which are themselves open # source systems. You must contact The Open Group for a license # allowing distribution and sublicensing of this software on, with, # or for operating systems which are not Open Source programs. # # See http://www.opengroup.org/openmotif/license for full # details of the license agreement. Any use, reproduction, or # distribution of the program constitutes recipient's acceptance of # this agreement. # # EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS # PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY # WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY # OR FITNESS FOR A PARTICULAR PURPOSE # # EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT # NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE # EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGES. # # # HISTORY # # @) This test uses a MultiLine Text widget and a TextField widget to test # various TextField 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 TextField 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 these come out in the stdout # window. # #) 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) # Toggle AddMode - toggles AddMode on and off # (I-beam should be stippled) # Set String NULL - sets the text's string to \"\" # Get String - gets the current text string and # prints to stdout window # Set String Orig - sets the text's string back to what # it was instantiated with # SetValue String - sets the text's string to # \"new_string\", try after making a # long primary selection (uses XtSetValues) # # On the TextField widget only: # Show Pos 3 - adjusts the text string position so # that character at position 3 is # visible ## ** Text1 tests ** ## ## test Cut/Paste in Text1 #** #** No need to test Texgt1 -> Text1 cut/copy/paste here, #** it's done already this same way in ScrollText2. #** ## test set string NULL in Text1 LocatePointer Text1 PressMB Btn3 LocatePointer Set_String_NULL1 ReleaseMB Btn3 CompareVisual Text1 ## test get string in Text1 LocatePointer Text1 PressMB Btn3 LocatePointer Get_String1 ReleaseMB Btn3 CompareVisual Text1 ## test setvalue string in Text1 LocatePointer Text1 PressMB Btn3 LocatePointer SetValue_String1 ReleaseMB Btn3 CompareVisual Text1 ## test set string orig in Text1 LocatePointer Text1 PressMB Btn3 LocatePointer Set_String_Orig1 ReleaseMB Btn3 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 29 ClickMB Btn1 PressMB Btn3 LocatePointer Paste2 ReleaseMB Btn3 CompareVisual Text2 ## test Copy/Paste in Text2 LocatePointer Text2 RTextChar 24 DragComponent Text2 RTextChar 29 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 29 PressMB Btn3 LocatePointer HiLi_Selected2 ReleaseMB Btn3 CompareVisual Text2 ## test highlight normal in Text2 LocatePointer Text2 RTextChar 29 PressMB Btn3 LocatePointer HiLi_Normal2 ReleaseMB Btn3 CompareVisual Text2 ## test highlight secondary in Text2 LocatePointer Text2 RTextChar 29 PressMB Btn3 LocatePointer HiLi_Secondary2 ReleaseMB Btn3 CompareVisual Text2 ## test toggle addmode in Text2 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 set string NULL in Text2 LocatePointer Text2 PressMB Btn3 LocatePointer Set_String_NULL2 ReleaseMB Btn3 CompareVisual Text2 ## test get string in Text2 LocatePointer Text2 PressMB Btn3 LocatePointer Get_String2 ReleaseMB Btn3 CompareVisual Text2 ## test set string orig in Text2 LocatePointer Text2 PressMB Btn3 LocatePointer Set_String_Orig2 ReleaseMB Btn3 CompareVisual Text2 ## test setvalue string in Text2 LocatePointer Text2 PressMB Btn3 LocatePointer SetValue_String2 ReleaseMB Btn3 CompareVisual Text2 ## test show pos 3 in Text2 LocatePointer Text2 PressMB Btn3 LocatePointer Set_String_Orig2 ReleaseMB Btn3 LocatePointer Text2 ClickMB Btn1 ClickKey KEndLine LocatePointer Text2 PressMB Btn3 LocatePointer Show_Pos_32 ReleaseMB Btn3 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 29 ClickMB Btn1 PressMB Btn3 LocatePointer Paste2 ReleaseMB Btn3 CompareVisual Text2 ## test Copy in Text1/Paste in Text2 LocatePointer Text1 RTextChar 24 DragComponent Text1 RTextChar 29 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 29 ClickMB Btn1 PressMB Btn3 LocatePointer Paste1 ReleaseMB Btn3 CompareVisual Text1 ## test Copy in Text2/Paste in Text1 LocatePointer Text2 RTextChar 24 DragComponent Text2 RTextChar 29 PressMB Btn3 LocatePointer Copy2 ReleaseMB Btn3 CompareVisual Text2 LocatePointer Text1 RTextChar 15 ClickMB Btn1 PressMB Btn3 LocatePointer Paste1 ReleaseMB Btn3 CompareVisual Text1 # C) Continue # /* test case for PIR 2895 */ # #) If it isn't already, set the string in the TextField widget back to # its original string (use the "Set String Orig" item off popup menu). LocatePointer Text2 PressMB Btn3 LocatePointer Set_String_Orig2 ReleaseMB Btn3 # #) Click MB1 in the TextField widget. Use the osfBeginLine key to # move the insertion cursor to the very beginning of the text. LocatePointer Text2 ClickMB Btn1 ClickKey KBeginLine # #) Press the osfSelect key to place the anchor before the first # word of text. ClickKey KSelect # #) Move the insertion cursor off the anchor using the osfRight key # several times. You should now see the destination (caret) cursor before # the first word and the insertion (I-beam) cursor to its right a few # characters. ClickKey KRight ClickKey KRight ClickKey KRight CompareVisual Text2 # #) Select the "SetValue String" item off the popup menu for the # TextField widget. This will change the string in the widget to # be read "new string". Move the mouse pointer over the TextField widget. # The insertion cursor should be located before the first # "n" in "new string" with no other cursors visible in this widget. # /* end of test case for PIR 2895 */ LocatePointer Text2 PressMB Btn3 LocatePointer SetValue_String2 ReleaseMB Btn3 LocatePointer Text2 CompareVisual Text2 # E) Exit