File: ScrollText2.scr

package info (click to toggle)
motif 2.3.4-13
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 81,160 kB
  • ctags: 51,769
  • sloc: ansic: 596,938; cpp: 3,951; yacc: 2,854; makefile: 2,070; csh: 1,199; sh: 1,070; lex: 455
file content (586 lines) | stat: -rw-r--r-- 16,263 bytes parent folder | download | duplicates (3)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# $XConsortium: ScrollText2.scr /main/6 1995/07/17 20:40:18 drk $
# 
# 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
# 

#  @) 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.
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 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.
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)
#      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.

## ** Text1 tests ** ##
## test Cut/Paste in Text1
LocatePointer Text1 RTextChar 5
DragComponent Text1 RTextChar 10
PressMB Btn3
LocatePointer Cut1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Copy/Paste in Text1
LocatePointer Text1 RTextChar 25
DragComponent Text1 RTextChar 30
PressMB Btn3
LocatePointer Copy1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Remove in Text1
LocatePointer Text1 RTextChar 40
DragComponent Text1 RTextChar 45
PressMB Btn3
LocatePointer Remove1
ReleaseMB Btn3
CompareVisual Text1
LocatePointer Text1 RTextChar 5
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test highlight selected in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Selected1
ReleaseMB Btn3
LocatePointer Text1
CompareVisual Text1

## test highlight normal in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Normal1
ReleaseMB Btn3

## test highlight secondary in Text1
LocatePointer Text1 RTextChar 40
PressMB Btn3
LocatePointer HiLi_Secondary1
ReleaseMB Btn3

## test scroll up 2 in Text1
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Up_21
ReleaseMB Btn3
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Up_21
ReleaseMB Btn3
CompareVisual Text1

## test scroll down 3 in Text1
LocatePointer Text1
PressMB Btn3
LocatePointer Scroll_Down_31
ReleaseMB Btn3
CompareVisual Text1

## test toggle addmode in Text1
LocatePointer Text1 RTextChar 10
DragComponent Text1 RTextChar 15
PressMB Btn3
LocatePointer Toggle_AddMode1
ReleaseMB Btn3
LocatePointer Text1
ClickKey KRight
ClickKey KRight
CompareVisual Text1
PressMB Btn3
LocatePointer Toggle_AddMode1
ReleaseMB Btn3
LocatePointer Text1
ClickKey KLeft
ClickKey KLeft
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 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test Copy/Paste in Text2
LocatePointer Text2 RTextChar 25
DragComponent Text2 RTextChar 30
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 30
PressMB Btn3
LocatePointer HiLi_Selected2
ReleaseMB Btn3
CompareVisual Text2

## test highlight normal in Text2
LocatePointer Text2 RTextChar 30
PressMB Btn3
LocatePointer HiLi_Normal2
ReleaseMB Btn3
CompareVisual Text2

## test highlight secondary in Text2
LocatePointer Text2 RTextChar 30
PressMB Btn3
LocatePointer HiLi_Secondary2
ReleaseMB Btn3
CompareVisual Text2

## test scroll up 2 in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Up_22
ReleaseMB Btn3
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Up_22
ReleaseMB Btn3
CompareVisual Text2

## test scroll down 3 in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Scroll_Down_32
ReleaseMB Btn3
CompareVisual Text2

## test toggle addmode in Text2
LocatePointer Text2
ClickMB Btn1
ClickKey KBeginData
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 Switch Source in Text2
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text2 RTextChar 5
ClickMB Btn1
InputString "SHARE"
CompareVisual Text1
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
LocatePointer Text2 RTextChar 5
ClickMB Btn1
InputString "SHARE"
CompareVisual Text1
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 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste2
ReleaseMB Btn3
CompareVisual Text2

## test Copy in Text1/Paste in Text2
LocatePointer Text1 RTextChar 25
DragComponent Text1 RTextChar 30
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 30
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1

## test Copy in Text2/Paste in Text1
LocatePointer Text2 RTextChar 25
DragComponent Text2 RTextChar 30
PressMB Btn3
LocatePointer Copy2
ReleaseMB Btn3
CompareVisual Text2
LocatePointer Text1 RTextChar 15
ClickMB Btn1
PressMB Btn3
LocatePointer Paste1
ReleaseMB Btn3
CompareVisual Text1


#  C)
Continue

#  #) 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.
LocatePointer Text1 RTextChar 10
ClickMB Btn1
CompareVisual Text1

#  #) Try double clicking MB1 on a word in the Scrolled Text widget.  The
#  entire word should be selected.
LocatePointer Text1 RTextChar 20
ClickMB Btn1 2
CompareVisual Text1

#  #) Now try triple clicking on a word
#  in the Scrolled Text widget.  The entire line should be selected.
LocatePointer Text1 RTextChar 30
ClickMB Btn1 3
CompareVisual Text1

#  #) Quadruple clicking on a word should selected all the text in the widget.
LocatePointer Text1 RTextChar 40
ClickMB Btn1 4
CompareVisual Text1

#  @) 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.
LocatePointer Text2 RTextChar 5
ClickMB Btn1
CompareVisual Text2

#  #) A double click will select
#  the word.
LocatePointer Text2 RTextChar 10
ClickMB Btn1 2
CompareVisual Text2

#  #) But, a triple click will be interpreted as a double click
#  followed by a single click - move the cursors.
LocatePointer Text2 RTextChar 20
ClickMB Btn1 3
CompareVisual Text2

#  #) A quadruple click
#  will be interpretated as two double clicks - select the word.
LocatePointer Text2 RTextChar 30
ClickMB Btn1 4
CompareVisual Text2

#  C)
Continue

#  #) Try clicking MB1 to the bottom and right of the end of its text.  This
#  should place the cursor after the last character in the text.
LocatePointer Text1 RTextChar Max
ClickMB Btn1

#  #) Now
#  make a secondary selection of several words from the main part of the
#  #ifdef	MOTIF1_1
#  text (drag MB2 across some text to make secondary selection).  When you
#  release MB2, the selection will immediately be pasted where the cursor
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  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
#  #endif	MOTIF1_2
#  was positioned.
LocatePointer Text1 RTextChar 1
DragComponent Text1 RTextChar 30 <Alt> Btn2 
CompareVisual Text1

#  #) Now, verify that the window can scroll horizontally properly.
LocatePointer Text1 RHorizScrollBarSlider
DragSliderValue Right Max
CompareVisual Text1
DragSliderValue Left Min
CompareVisual Text1
DragSliderValue Right 50
CompareVisual Text1

#  C)
Continue

#  /* 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.
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3
CompareVisual Text2

#  #) Select a word of text by dragging MB1 in the Single Line Text
#  widget.
# #) Confirm that the selection highlight only appears in the
# Single Line Text widget.
LocatePointer Text2 RTextChar 15
PressMB Btn1
LocatePointer Text2 RTextChar 20
ReleaseMB Btn1
CompareVisual Text1
CompareVisual Text2

#  #ifdef	MOTIF1_1
#  #) Click Alt-MB2 somewhere in 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.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) 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.
#  #endif	MOTIF1_2
LocatePointer Text2 RTextChar 10
ClickMB <Shift> Btn2
CompareVisual Text2

#  #ifdef	MOTIF1_1
#  #) Select another word in the same widget and try the same procedure,
#  but this time click the Alt-MB2 somewhere in the text AFTER the
#  selection.  Confirm that the highlighting is maintained correctly.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) 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.
#  #endif	MOTIF1_2
#  /* end of test case for PIR 3096 */
LocatePointer Text2 RTextChar 10
PressMB Btn1
LocatePointer Text2 RTextChar 15
ReleaseMB Btn1
LocatePointer Text2 RTextChar 20
ClickMB <Shift> Btn2
CompareVisual Text2

#  C)
Continue

#  /* test case for PIR 2975 */
#  #) With the source still shared between the two widgets, click MB1
#  somewhere in the Single Line Text widget.
LocatePointer Text2 RTextChar 20
ClickMB Btn1

#  #ifdef	MOTIF1_1
#  #) Make a secondary selection in the Scrolled Text widget by dragging
#  MB2 over some text.  As MB2 is dragged, the text will be underlined.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) 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.
#  #endif	MOTIF1_2
LocatePointer Text1 RTextChar 5
PressMB <Alt> Btn2
LocatePointer Text1 RTextChar 10
CompareVisual Text1
ReleaseMB <Alt> Btn2

#  #ifdef	MOTIF1_1
#  #) Confirm that after MB2 is released, the secondarily selected text is
#  copied to the destination cursor in the Single Line Text widget and that
#  the underlining is erased in the Scrolled Text widget.
#  #endif	MOTIF1_1
#  #ifdef	MOTIF1_2
#  #) Confirm that after Alt-MB2 is released, the secondarily selected text is
#  copied to the cursor in the Single Line Text widget and that
#  the underlining is erased in the Scrolled Text widget.
#  #endif	MOTIF1_2
#  /* end of test case for PIR 2975 */
CompareVisual Text1
CompareVisual Text2

# #) 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.
LocatePointer Text2
PressMB Btn3
LocatePointer Switch_Source2
ReleaseMB Btn3

# C)
Continue

# #)  The Scrolled Text widget should now be empty and the Single
# Line Text widget should have just one line of text.
CompareVisual Text1
CompareVisual Text2

# #)  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.
LocatePointer Text1
PressMB Btn3
LocatePointer Set_Source
ReleaseMB Btn3
CompareVisual Text1

# C)
Continue

#  E)
Exit