Mercurial > emacs
annotate test/redisplay-testsuite.el @ 111877:8d22a439225b
* lisp/textmodes/sgml-mode.el (sgml-xml-guess): Add .xhtml extension.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Fri, 10 Dec 2010 18:50:58 -0800 |
parents | b262a4f49bf3 |
children | 417b1e4d63cd |
rev | line source |
---|---|
103698 | 1 ;;; redisplay-testsuite.el --- Test suite for redisplay. |
103593
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
106815 | 3 ;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
103593
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 ;; Author: Chong Yidong <cyd@stupidchicken.com> |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Keywords: internal |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Human-Keywords: internal |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Type M-x test-redisplay RET to generate the test buffer. |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;;; Code: |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 (defun test-insert-overlay (text &rest props) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (let ((opoint (point)) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 overlay) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (insert text) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (setq overlay (make-overlay opoint (point))) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (while props |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 (overlay-put overlay (car props) (cadr props)) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (setq props (cddr props))))) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 (defun test-redisplay-1 () |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (insert "Test 1: Displaying adjacent and overlapping overlays:\n\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 (insert " Expected: gnu emacs\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (insert " Results: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 (test-insert-overlay "n" 'before-string "g" 'after-string "u ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (test-insert-overlay "ma" 'before-string "e" 'after-string "cs") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 (insert "\n\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 (insert " Expected: gnu emacs\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (insert " Results: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (test-insert-overlay "u" 'before-string "gn") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (test-insert-overlay "ma" 'before-string " e" 'after-string "cs") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (insert "\n\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (insert " Expected: gnu emacs\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (insert " Results: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (test-insert-overlay "XXX" 'display "u " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 'before-string "gn" 'after-string "em") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (test-insert-overlay "a" 'after-string "cs") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 (insert "\n\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 (insert " Expected: gnu emacs\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (insert " Results: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (test-insert-overlay "u " 'before-string "gn" 'after-string "em") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 (test-insert-overlay "XXX" 'display "a" 'after-string "cs") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (insert "\n\n")) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 (defun test-redisplay-2 () |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (insert "Test 2: Mouse highlighting. Move your mouse over the letters XXX:\n\n") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (insert " Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 (propertize "xxxXXXxxx" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 "...---...\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 (test-insert-overlay "XXX" 'before-string "xxx" 'after-string "xxx" |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 'mouse-face 'highlight ) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (test-insert-overlay "---" 'before-string "..." 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (propertize "xxxXXX" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 "...---...\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (test-insert-overlay "XXX" 'before-string "xxx" 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (test-insert-overlay "---" 'before-string "..." 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (propertize "XXX" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 "...---...\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (test-insert-overlay "..." 'display "XXX" 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (test-insert-overlay "---" 'before-string "..." 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (propertize "XXXxxx" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "...\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (test-insert-overlay "..." 'display "XXX" 'after-string "xxx" |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (test-insert-overlay "error" 'display "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 "---..." |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (propertize "xxxXXX" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 "\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (test-insert-overlay "xxx" 'display "---" 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (test-insert-overlay "error" 'before-string "xxx" 'display "XXX" |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 "...---..." |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (propertize "xxxXXXxxx" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 "\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (test-insert-overlay "---" 'before-string "..." 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (test-insert-overlay "XXX" 'before-string "xxx" 'after-string "xxx" |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 "..." |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (propertize "XXX" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 "...\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (test-insert-overlay "---" |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 'display (propertize "XXX" 'mouse-face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 'before-string "..." |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 'after-string "...") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (insert "\n\n Expected: " |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (propertize "XXX\n" 'face 'highlight) |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 "\n Test: ") |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 (test-insert-overlay "XXX\n" 'mouse-face 'highlight) |
109045
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
113 (insert "\n\n")) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
114 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
115 (defun test-redisplay-3 () |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
116 (insert "Test 3: Overlay with before/after strings and images:\n\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
117 (let ((img-data "#define x_width 8 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
118 #define x_height 8 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
119 static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
120 ;; Control |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
121 (insert " Expected: AB" |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
122 (propertize "X" 'display `(image :data ,img-data :type xbm)) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
123 "CD\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
124 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
125 ;; Overlay with before, after, and image display string. |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
126 (insert " Result 1: ") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
127 (let ((opoint (point))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
128 (insert "AXD\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
129 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
130 (overlay-put ov 'before-string "B") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
131 (overlay-put ov 'after-string "C") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
132 (overlay-put ov 'display |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
133 `(image :data ,img-data :type xbm)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
134 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
135 ;; Overlay with before and after string, and image text prop. |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
136 (insert " Result 2: ") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
137 (let ((opoint (point))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
138 (insert "AXD\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
139 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
140 (overlay-put ov 'before-string "B") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
141 (overlay-put ov 'after-string "C") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
142 (put-text-property (1+ opoint) (+ 2 opoint) 'display |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
143 `(image :data ,img-data :type xbm)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
144 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
145 ;; Overlays with adjacent before and after strings, and image text |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
146 ;; prop. |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
147 (insert " Result 3: ") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
148 (let ((opoint (point))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
149 (insert "AXD\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
150 (let ((ov1 (make-overlay opoint (1+ opoint))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
151 (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
152 (overlay-put ov1 'after-string "B") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
153 (overlay-put ov2 'before-string "C") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
154 (put-text-property (1+ opoint) (+ 2 opoint) 'display |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
155 `(image :data ,img-data :type xbm)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
156 |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
157 ;; Three overlays. |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
158 (insert " Result 4: ") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
159 (let ((opoint (point))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
160 (insert "AXD\n\n") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
161 (let ((ov1 (make-overlay opoint (1+ opoint))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
162 (ov2 (make-overlay (+ 2 opoint) (+ 3 opoint))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
163 (ov3 (make-overlay (1+ opoint) (+ 2 opoint)))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
164 (overlay-put ov1 'after-string "B") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
165 (overlay-put ov2 'before-string "C") |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
166 (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
167 |
103593
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (defun test-redisplay () |
3acb65a2fdd5
* redisplay-testsuite.el: New file.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (interactive) |
109045
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
171 (let ((buf (get-buffer "*Redisplay Test*"))) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
172 (if buf |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
173 (kill-buffer buf)) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
174 (pop-to-buffer (get-buffer-create "*Redisplay Test*")) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
175 (erase-buffer) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
176 (test-redisplay-1) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
177 (test-redisplay-2) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
178 (test-redisplay-3) |
b262a4f49bf3
Add redisplay test for image and overlay string interaction.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
179 (goto-char (point-min)))) |
103689 | 180 |
181 ;; arch-tag: fcee53c8-024f-403d-9154-61ae3ce0bfb8 |