/* * @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 */ /* static char rcsid[] = "$XConsortium: ScrollText2.dat /main/7 1995/07/13 19:23:23 drk $" */ @) 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. #) 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. C) #) 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 CopyLink - copies link from the primary selection to the clipboard PasteLink - pastes link from the 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. C) #) 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. #) Try double clicking MB1 on a word in the Scrolled Text widget. The entire word should be selected. #) Now try triple clicking on a word in the Scrolled Text widget. The entire line should be selected. #) Quadruple clicking on a word should selected all the text in the widget. @) 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. #) A double click will select the word. #) But, a triple click will be interpreted as a double click followed by a single click - move the cursors. #) A quadruple click will be interpretated as two double clicks - select the word. C) #) Try clicking MB1 to the bottom and right of the end of the text in the Scrolled Text widget. This should place the cursor after the last character in the text. #) Now make a secondary selection of several words from the main part of the 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 was positioned. #) Now, verify that the window can scroll horizontally properly. C) /* 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. #) Select a word of text by dragging MB1 in the Single Line Text widget. #) Confirm that the selection highlight appears in both the Single Line Text widget and the Scrolled Text widget. #) 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. #) 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. /* end of test case for PIR 3096 */ C) /* test case for PIR 2975 */ #) With the source still shared between the two widgets, click MB1 somewhere in the Single Line Text widget. #) 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. #) Confirm that after Alt-MB2 is released, the secondarily selected text is copied to the insertion cursor in the Single Line Text widget. Verify that the secondary selection is also copied to the same location in the Scrolled Text widget and that the underlining is erased in the Scrolled Text widget. /* end of test case for PIR 2975 */ #) 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. C) /* Test case for CR 3669 */ #) The Scrolled Text widget should now be empty and the Single Line Text widget should have just one line of text. #) 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. /* End test case for CR 3669 */ C) E)