2614
|
1 ;; Copyright (C) 2005 Adrian Aichner
|
|
2
|
|
3 ;; Author: Adrian Aichner <adrian@xemacs.org>
|
|
4 ;; Maintainer: XEmacs Beta List <xemacs-beta@xemacs.org>
|
|
5 ;; Created: 2005
|
|
6 ;; Keywords: tests
|
|
7
|
|
8 ;; This file is part of XEmacs.
|
|
9
|
|
10 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
11 ;; under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14
|
|
15 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
18 ;; General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
|
|
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
23 ;; 02111-1307, USA.
|
|
24
|
|
25 ;;; Synched up with: Not in FSF.
|
|
26
|
|
27 ;;; Commentary:
|
|
28
|
|
29 ;;; Test region and zmacs-region functionality
|
|
30 ;;; See test-harness.el
|
|
31
|
|
32 (condition-case err
|
|
33 (require 'test-harness)
|
|
34 (file-error
|
|
35 (when (and (boundp 'load-file-name) (stringp load-file-name))
|
|
36 (push (file-name-directory load-file-name) load-path)
|
|
37 (require 'test-harness))))
|
|
38
|
|
39 ;; Active region testing, verifying functionality of
|
|
40 ;; http://list-archive.xemacs.org/xemacs-patches/200502/msg00194.html
|
|
41 ;; Message-ID: <zmxwtboa.fsf@smtprelay.t-online.de>
|
|
42 (with-temp-buffer
|
|
43 ;; Using active regions
|
|
44 (let ((zmacs-regions t)
|
|
45 (first-buffer (current-buffer)))
|
|
46 (insert (buffer-name))
|
|
47 (Assert (not (region-exists-p)))
|
|
48 (Assert (not (region-active-p)))
|
|
49 (mark-whole-buffer)
|
|
50 (Assert (region-exists-p))
|
|
51 (Assert (region-active-p))
|
|
52 ;; Turn off active regions
|
|
53 (setq zmacs-regions nil)
|
|
54 ;; Region still exists
|
|
55 (Assert (region-exists-p))
|
|
56 ;; Region is no longer active
|
|
57 (Assert (not (region-active-p)))
|
|
58 ;; Turn active regions back on
|
|
59 (setq zmacs-regions t)
|
|
60 ;; Region still exists
|
|
61 (Assert (region-exists-p))
|
|
62 ;; Region is active again
|
|
63 (Assert (region-active-p))
|
|
64 (with-temp-buffer
|
|
65 (insert (buffer-name))
|
|
66 ;; Region exists in first buffer, not this second one
|
|
67 (Assert (not (region-exists-p)))
|
|
68 ;; Region not active in this second temp buffer
|
|
69 (Assert (not (region-active-p)))
|
|
70 ;; Region still active in first temp buffer
|
|
71 (Assert (eq (zmacs-region-buffer) first-buffer))
|
|
72 ;; Activate region in second temp buffer
|
|
73 (mark-whole-buffer)
|
|
74 ;; Region exists in second temp buffer
|
|
75 (Assert (region-exists-p))
|
|
76 ;; Region active in second temp buffer
|
|
77 (Assert (region-active-p)))
|
|
78 ;; Second temp buffer no longer exists
|
|
79 (Assert (null (zmacs-region-buffer)))))
|