/* * @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: ScrollText3.dat /main/7 1995/07/13 19:23:47 drk $" */ @) This test is used to exercise the user-level implementation of the text widgets. Below is a list of all the keyboard/mouse bindings and their expected actions. Try each one on all four flavors of text widgets and in both add mode and normal mode on each. #) Scrolling: @) KPageUp -- pages up @) KPageDown -- pages down @) KPageLeft -- pages left @) KPageRight -- pages right #) With MB1 or MB2 pressed, moving the pointer beyond the list should scroll the text in that direction. C) #) Keyboard Navigation: @) KLeft -- move the cursor back one character (wraps) @) KRight -- move the cursor forward one character (wraps) @) Ctrl KLeft -- move the cursor to the beginning of the word @) Ctrl KRight -- move the cursor to the beginning of the following word @) KUp -- move the cursor up one line @) KDown -- move the cursor down one line @) Ctrl KUp -- move the cursor to the first non-blank character in the paragraph @) Ctrl KDown -- move the cursor to the first non-blank character in the following paragraph @) KBeginLine -- move the cursor to the beginning of the line @) KEndLine -- move the cursor to the end of the line @) KBeginData -- move the cursor to the beginning of the file @) KEndData -- move the cursor to the end of the file #) In normal mode, the previous navigation operations clear the current selection, and set the anchor at the cursor position. The cursor is shown as an I-beam. #) In add mode, the anchor and the selection remain unchanged during navigation operations. The cursor is shown as a stippled I-beam. C) @) The following is a test case for CR 5186. #) In Normal Mode, use KSelect and KExtend to select a collection of text. KDelete should delete the selection. #) Use KSelect and KExtend to select another collection of text. KBackSpace should also delete the selection. #) Switch into Add Mode, KSelect and KExtend a collection of text. #) While the cursor is within the selection, KDelete or KBackSpace should delete the selection. #) Switch back into Add Mode, KSelect and KExtend another collection of text. #) Move the cursor outside the current selection. #) KDelete should delete one character forward. #) KBackSpace should delete one character backward. C) #) Keyboard Selection -- Add Mode & Normal Mode: @) KSelect -- clears the current selection and sets the anchor @) Ctrl KSelect -- Same as KSelect (Ctrl SELECT is allowed to have no effect) @) Shift KSelect -- selects the text between the anchor and the cursor, takes ownership of primary selection @) Ctrl Shift KSelect -- no effect @) Shift -- moves the cursor as indicated, selects the text between the anchor and the cursor, takes ownership of primary selection (Rebalances the anchor if necessary) @) KSelectAll -- selects entire text and takes ownership of primary selection @) KDeselectAll -- deselects everything in that widget C) #) Mouse-based primary selection: @) BSelect Click -- moves cursor and anchor, deselect selection if in the same widget, does not take ownership of the primary selection @) BSelect Drag -- drags cursor, selects characters between press and cursor, places anchor at press, cursor at release, takes ownership of primary selection @) Ctrl BSelect Click -- moves cursor, leaves anchor and primary selection alone @) Ctrl BSelect Drag -- either no effect, or leaves cursor where pressed @) Shift BSelect Click -- moves the cursor as indicated, selects the text between the anchor and the cursor, takes ownership of primary selection (Rebalances the anchor if necessary) @) Shift BSelect Drag -- drags the cursor, selects the text between the anchor and cursor @) BSelect(2) Click -- selects word, places cursor at position and anchor at end @) BSelect(2) Drag -- drags out the word selection, moves anchor to other end of word if necessary to keep the original word selected (Rebalances anchor if necessary) #) Try extending the selection after a BSelect(2) with a Shift BSelect click or drag. Try a Shift BSelect(2) Drag after a BSelect Click. #) BSelect(3) actions should work the same, but a line at a time. C) #) Clipboard and Primary Transfer: @) Ctrl KInsert -- copy primary selection to clipboard @) KCopy -- copy primary selection to clipboard @) Shift KDelete -- cut primary selection to clipboard @) KCut -- cut primary selection to clipboard @) Shift KInsert -- paste clipboard to insertion cursor @) KPaste -- paste clipboard to insertion cursor @) Btn2 Click -- copy primary selection to pointer @) Ctrl Btn2 Click -- copy primary selection to pointer @) Shift Btn2 Click -- cut primary selection to pointer @) KPrimaryPaste -- copy primary selection to cursor @) Ctrl KPrimaryPaste -- copy primary selection to cursor @) Alt Ctrl KInsert -- copy primary selection to cursor @) Alt KCopy -- copy primary selection to cursor @) Alt KPrimaryPaste -- cut primary selection to cursor @) Alt Shift KDelete -- cut primary selection to cursor @) Alt KCut -- cut primary selection to cursor !) #) Try all the above with: @) - source and destination in same widget @) - source and destination in different widgets in same window @) - source and destination in different windows in same application @) - source and destination in different applications C) #) Quick Transfer: @) Btn2 Drag -- copy secondary selection to destination cursor @) Ctrl Btn2 Drag -- copy secondary selection to destination cursor @) Alt Btn2 Drag -- cut secondary selection to destination cursor @) KCancel -- cancels quick transfer operations (Region between Btn2 Press and pointer is underlined) @) KQuickPaste -- set quick anchor as copy @) Ctrl KQuickPaste -- set quick anchor as copy @) Alt KQuickPaste -- set quick anchor as cut @) Shift KQuickPaste -- do quick transfer to destination cursor /* Is this true? (Region between KQuickPaste and cursor underlined until Shift KQuickPaste) */ !) #) Try all the above with: @) - source and destination in same widget @) - source and destination in different widgets in same window @) - source and destination in different windows in same application @) - source and destination in different applications C) #) Other Behavior: @) Space just inserts a space. @) Return does a carriage return in multi-line. @) Tab inserts a tab in multi-line. #) Check that if pending delete enabled, typing a character or doing any kind of paste deletes the text only if the cursor is within the bounds of the selected area. #) Check that KClear clears the selected area (fills it with spaces). Use a fixed font, and try a multi-line selected region. #) Check that Ctrl KDelete erases text between the cursor and the end of line. C) /* test case for PIR 3768 */ #) Make a small selection in the TextField widget. Click MB2 elsewhere in the TextField to copy the primary selection. The original selection should remain highlighted. #) Click MB2 several more times to copy the selection several times. Confirm that the original selection remains highlighted the whole time. /* end of test case for PIR 3768 */ C) /* test case for PIR 1983 */ #) Click MB1 on the ScrolledText widget. It should now have focus. #) Now press Ctrl-Tab twice to get the focus to the MultiLine Text widget. #) Holding the Shift key, drag MB1 in the ScrolledText widget to select some text there. As this text is selected, the focus should also move off of the MultiLine Text widget and onto this widget. #) Try typing some text to confirm that the selected text in the ScrolledText widget is replaced with the newly typed text. /* end of test case for PIR 1983 */ C) #) Each of the four widgets now have their XmNsensitive resource set to False. They should all be grayed out and inaccessible from the keyboard or the mouse. E)