/* * @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: Text9.dat /main/7 1995/07/13 19:32:12 drk $" */ @) The left side of this test contains a MultiLine Text widget and the right, a SingleLine Text widget. Each set of widgets below the text widgets pertain to the text widget above them. Do all the first tests on the MultiLine Text widget. #) The MultiLine Text widget should have \"His wife could... on the top line in the window. Grab the vertical scrollbar and slide it up so the first line is displayed reading \"Jack Sprat could...\". #) Click MB1 right before the word \"Sprat\" in the MultiLine Text widget. The I-beam cursor should now be at that position. #) Try inserting new text into the widget by typing \"NEW\". You should just hear the bell beep 3 times, but no text will be inserted. #) Now click MB1 on the \"verifyBell\" togglebutton. Click in the text widget at the same position and try typing \"NEW\" again. There should be NO bell, and still no text inserted. #) Now click MB1 on the \"doit flag\" togglebutton. Click in the text widget and try typing again. It should work this time. Note that the \"text length\" should increase as you insert characters into the text widget. C) #) Drag the \"top character\" slider to the right until it reads 35. The MultiLine text widget should now have the second line of text at the top of the window (starts with \"His wife could..\"). #) Drag the \"cursor position\" slider out to 12. The widget should shift so that the first line is again at the top and the insertion cursor is before the twelfth position (just before the \'t\' in \"Sprat\"). #) Now drag the \"top character\" to 43. The second line of text should again be the top line in the window and there should be no cursor visible at all. #) Click MB1 on the \"show position\" pushbutton. The window should change to have the first text line visible again. If you press , the highlight will move to the MultiLine Text widget and the I-beam cursor will again be showing before the \'t\' in \"Sprat\". C) #) Click MB1 on the \"6x12\" button in the radio box. The text widget font should shrink and its window should size itself accordingly. Also, the \"text baseline\" should now read 17. #) Click MB1 on the \"9x15\" button. The text widget font should change again and its window will grow. The \"text baseline\" should now read 21. #) Click MB1 on the \"8x13\" button. The text widget font should return to its initial size, and the window should also resize. C) @) Test whether the setting of top character works correctly when word wrap is on. #) Some text is displayed with word wrap off. Scroll text widget vertically to verify that the text runs horizontally outside of the window. #) Select the word wrap toggle. All text should now fit within the vertical bounds of the text widget. There are actually three logical lines of text. The first two lines of text end with a newline character. The third line of text does not. When word wrap is set, the third logical line of text is displayed as nine lines of physical text. #) Drag the \"top character\" slider to the right until it reads 38. The beginning of the third logical line should be displayed at the top of the window. It reads "This line of text". #) Drag the \"top character\" slider to the right until it reads 56. The text "does not end with a" should be displayed at the top of the window. C) @) Now do all of the tests again on the SingleLine Text widget. #) The SingleLine Text widget should have \"s wife could eat no\" displayed in the window. #) Click MB1 right before the word \"could\" in the SingleLine Text widget. The I-beam cursor should now be at that position. #) Try inserting new text into the widget by typing \"NEW\". You should not hear any bell and no text should be inserted. #) Now click MB1 on the \"verifyBell\" togglebutton. Click at the same position in the text widget and try typing \"NEW\" again. There should now be three bells, and still no text inserted. #) Now click MB1 on the \"doit flag\" togglebutton. Try typing into the text widget again. It should work this time. Note that the \"text length\" should increase as you insert characters into the text widget. C) #) Drag the \"top character\" slider to the right until it reads 35. The SingleLine text widget should now have shifted the text in the window (should read \"e NEWcould eat no le\"). #) Drag the \"cursor position\" slider out to 5. The widget should shift so that the first line is again in the window and the insertion cursor is before the fifth position (just before \"Sprat\"). #) Now drag the \"top character\" to 43. Part of the second line of text should again be in the window and there should be no cursor visible at all. #) Click MB1 on the \"show position\" pushbutton. The window should change to have the first text line visible again with the insertion cursor showing before the word \"Sprat\". C) #) Click MB1 on the \"6x12\" button in the radio box. The text widget font should shrink and the window should size itself accordingly. Also, the \"text baseline\" should now read 17. #) Click MB1 on the \"9x15\" button. The text widget font should change again and the window should grow. The \"text baseline\" should now read 21. #) Click MB1 on the \"8x13\" button. The text widget font should return to its initial size, and the window should also resize. C) @) You can change the range of text which is selected by a double click by changing the selection in the \"Double Click Selects...\" option menu. When you make a new selection, both text widgets will be altered. #) Try each selection in the option menu and confirm that a double click selects the correct amount of text in both widgets. !) Position double click just sets the cursor and nothing is selected. Word selects a word. Line selects one line of text source. ( When wordWrap is ON, one line of text source may be displayed as multiple output lines. Each of the output lines which correspond to one source line will be selected. ) All means the entire contents is selected. C) @) The following testcase checks the amount of indentation which results after inserting a tab into a Text widget. Before inserting tabs, verify that the wordWrap toggle is selected. #) ClickMB1 at the beginning of the Scrolled Text widget. Click KTab. Verify that the text is indented by eight columns. The first character on the first line of text should align to the right of the first occurance of the number "8" on the second line of text. #) Click KTab again. The text should indent by another eight columns. The first character on the first line of text should align to the right of the second occurance of the number "8" on the second line of text. #) Click KTab once again. Since wordWrap is on, and the first word is too long to fit on the first line after the indentation, the text moves to the next line in the Text widget. #) Click KTab seven more times. Verify that upto 10 tabs can be inserted into the Text widget. C) E)