1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
/*
* 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
*/
/*
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)
|