diff options
| author | Eli Zaretskii | 2017-06-01 21:29:24 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-06-01 21:29:24 +0300 |
| commit | 5dc0129c299f6cc7a0bdfbf7edc92a85bb3a0597 (patch) | |
| tree | 348d788e09a20f61c21a70cdca09c9679e539746 /test | |
| parent | cb9aa3515ac00826fd27ade7dfc829134ed38acc (diff) | |
| download | emacs-5dc0129c299f6cc7a0bdfbf7edc92a85bb3a0597.tar.gz emacs-5dc0129c299f6cc7a0bdfbf7edc92a85bb3a0597.zip | |
Improve testing of octal and hex display of raw bytes
* test/manual/redisplay-testsuite.el (test-redisplay-5-toggle)
(test-redisplay-5): Add a test with a large codepoint.
Diffstat (limited to 'test')
| -rw-r--r-- | test/manual/redisplay-testsuite.el | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/manual/redisplay-testsuite.el b/test/manual/redisplay-testsuite.el index 2175cbab1b7..defc3fee328 100644 --- a/test/manual/redisplay-testsuite.el +++ b/test/manual/redisplay-testsuite.el | |||
| @@ -294,30 +294,45 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff | |||
| 294 | 294 | ||
| 295 | (insert "\n")) | 295 | (insert "\n")) |
| 296 | 296 | ||
| 297 | (defvar test-redisplay-5-expected-overlay nil) | 297 | (defvar test-redisplay-5a-expected-overlay nil) |
| 298 | (defvar test-redisplay-5-result-overlay nil) | 298 | (defvar test-redisplay-5a-result-overlay nil) |
| 299 | (defvar test-redisplay-5b-expected-overlay nil) | ||
| 300 | (defvar test-redisplay-5b-result-overlay nil) | ||
| 299 | 301 | ||
| 300 | (defun test-redisplay-5-toggle (_event) | 302 | (defun test-redisplay-5-toggle (_event) |
| 301 | (interactive "e") | 303 | (interactive "e") |
| 302 | (setq display-raw-bytes-as-hex (not display-raw-bytes-as-hex)) | 304 | (setq display-raw-bytes-as-hex (not display-raw-bytes-as-hex)) |
| 303 | (let ((label (if display-raw-bytes-as-hex "\\x80" "\\200"))) | 305 | (let ((label (if display-raw-bytes-as-hex "\\x80" "\\200"))) |
| 304 | (overlay-put test-redisplay-5-expected-overlay 'display | 306 | (overlay-put test-redisplay-5a-expected-overlay 'display |
| 307 | (propertize label 'face 'escape-glyph))) | ||
| 308 | (let ((label (if display-raw-bytes-as-hex "\\x3fffc" "\\777774"))) | ||
| 309 | (overlay-put test-redisplay-5b-expected-overlay 'display | ||
| 305 | (propertize label 'face 'escape-glyph)))) | 310 | (propertize label 'face 'escape-glyph)))) |
| 306 | 311 | ||
| 307 | (defun test-redisplay-5 () | 312 | (defun test-redisplay-5 () |
| 308 | (insert "Test 5: Display of raw bytes:\n\n") | 313 | (insert "Test 5: Display of raw bytes:\n\n") |
| 309 | (insert " Expected: ") | 314 | (insert " Expected: ") |
| 310 | (setq test-redisplay-5-expected-overlay | 315 | (setq test-redisplay-5a-expected-overlay |
| 311 | (test-insert-overlay " " 'display | 316 | (test-insert-overlay " " 'display |
| 312 | (propertize "\\200" 'face 'escape-glyph))) | 317 | (propertize "\\200" 'face 'escape-glyph))) |
| 313 | (insert "\n Result: ") | 318 | (insert "\n Result: ") |
| 314 | (setq test-redisplay-5-result-overlay | 319 | (setq test-redisplay-5a-result-overlay |
| 315 | (test-insert-overlay " " 'display "\200")) | 320 | (test-insert-overlay " " 'display "\200")) |
| 316 | (insert "\n\n") | 321 | (insert "\n\n") |
| 322 | (insert " Expected: ") | ||
| 323 | ;; This tests a large codepoint, to make sure the internal buffer we | ||
| 324 | ;; use to produce the representation is large enough. | ||
| 325 | (aset printable-chars #x3fffc nil) | ||
| 326 | (setq test-redisplay-5b-expected-overlay | ||
| 327 | (test-insert-overlay " " 'display | ||
| 328 | (propertize "\\777774" 'face 'escape-glyph))) | ||
| 329 | (insert "\n Result: ") | ||
| 330 | (setq test-redisplay-5b-result-overlay | ||
| 331 | (test-insert-overlay " " 'display (char-to-string #x3fffc))) | ||
| 332 | (insert "\n\n") | ||
| 317 | (insert-button "Toggle between octal and hex display" | 333 | (insert-button "Toggle between octal and hex display" |
| 318 | 'action 'test-redisplay-5-toggle)) | 334 | 'action 'test-redisplay-5-toggle)) |
| 319 | 335 | ||
| 320 | |||
| 321 | (defun test-redisplay () | 336 | (defun test-redisplay () |
| 322 | (interactive) | 337 | (interactive) |
| 323 | (let ((buf (get-buffer "*Redisplay Test*"))) | 338 | (let ((buf (get-buffer "*Redisplay Test*"))) |