view tests/frame.el @ 4847:05c519de7353

be more careful when printing to check for bad objects -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-01-13 Ben Wing <ben@xemacs.org> * print.c: * print.c (internal_object_printer): * print.c (enum printing_badness): * print.c (printing_major_badness): * print.c (print_internal): Clean up the part of the code that looks for things that might lead to crashing in the print code: -- Make the "badness" messages more consistent. -- Move the checks for circularities after the checks for bad memory, since the checks for circularities involve accessing memory (which could be bad). -- Add an extra check to see if the object's implementation structure is bad memory. -- Add extra check for object itself being a null pointer or implementation pointer being null. -- Add some extra comments to help in maintaining the code.
author Ben Wing <ben@xemacs.org>
date Wed, 13 Jan 2010 06:02:42 -0600
parents 360340f9fd5f
children 931aaa7a6b37
line wrap: on
line source

;;; Test geometry settings for frames
(defmacro check-frame-geometry (xx yy)
  `(loop for frame in (list nil (selected-frame))
	 do
	 (assert (eq (frame-property frame 'top)  ,yy))
	 (assert (eq (frame-property frame 'left) ,xx))
	 (assert (eq (frame-property frame 'top)  ,yy))
	 (assert (eq (frame-property frame 'left) ,xx))
	 (loop for plist in
	       (list (frame-properties)
		     (frame-properties nil)
		     (frame-properties (selected-frame)))
	       do
	       (assert (eq (plist-get plist 'top)  ,yy))
	       (assert (eq (plist-get plist 'left) ,xx)))))

(loop for (x y) in '((0 0) (1 1) (3 3) (9 9) (10 20) (20 40) (40 80) (100 200))
      do
      (loop for frame in (list nil (selected-frame))
	    do
	    (set-frame-properties frame `(left ,x top ,y))
	    (check-frame-geometry x y)
	    (set-frame-property frame 'top (+ y 3))
	    (check-frame-geometry x (+ y 3))
	    (set-frame-property frame 'left (+ x 3))
	    (check-frame-geometry (+ x 3) (+ y 3))))