Fixed bugs found with random testing

svn: r18581
This commit is contained in:
Casey Klein 2010-03-19 11:39:02 +00:00
parent 4e30b8dc6b
commit 854a902cbd
8 changed files with 25 additions and 19 deletions

View File

@ -4,7 +4,7 @@
(for-syntax scheme/base)) (for-syntax scheme/base))
(provide defclass defclass* (provide defclass defclass*
def/public def/override def/override-final define/top case-args def/public def/public-final def/override def/override-final define/top case-args
maybe-box? any? bool? nonnegative-real? make-or-false make-box make-list make-alts maybe-box? any? bool? nonnegative-real? make-or-false make-box make-list make-alts
make-literal symbol-in make-procedure make-literal symbol-in make-procedure
method-name init-name method-name init-name
@ -24,6 +24,8 @@
(define-syntax (def/public stx) (define-syntax (def/public stx)
#`(def/thing define/public #,stx)) #`(def/thing define/public #,stx))
(define-syntax (def/public-final stx)
#`(def/thing define/public-final #,stx))
(define-syntax (def/override stx) (define-syntax (def/override stx)
#`(def/thing define/override #,stx)) #`(def/thing define/override #,stx))
(define-syntax (def/override-final stx) (define-syntax (def/override-final stx)

View File

@ -983,12 +983,15 @@
(define/public (change-style . args) (define/public (change-style . args)
(case-args (case-args
args args
[([style-delta% delta]) [() (do-change-style #f #f #f)]
(do-change-style #f delta #f)] [([not delta]) (do-change-style #f #f #f)]
[([style-delta% delta] [snip% snip]) [([style-delta% delta]) (do-change-style #f delta #f)]
(do-change-style #f delta snip)] [([style-delta% delta] [snip% snip]) (do-change-style #f delta snip)]
[([style<%> style] [snip% snip]) [([style<%> style] [snip% snip]) (do-change-style style #f snip)]
(do-change-style style #f snip)] [([style-delta% delta] [not snip]) (do-change-style #f delta #f)]
[([style<%> style] [not snip]) (do-change-style style #f #f)]
[([not style] [snip% snip]) (do-change-style style #f snip)]
[([not style] [not snip]) (do-change-style #f #f snip)]
(method-name 'pasteboard% 'change-style))) (method-name 'pasteboard% 'change-style)))
;; ---------------------------------------- ;; ----------------------------------------
@ -1748,7 +1751,7 @@
(let-values ([(start) snips] (let-values ([(start) snips]
[(cx cy) (get-center)]) [(cx cy) (get-center)])
(do-buffer-paste cb time) (do-buffer-paste cb time #f)
(if (and s-admin (if (and s-admin
(not (eq? snips start))) (not (eq? snips start)))

View File

@ -295,7 +295,7 @@
#f)))) #f))))
(def/public (set-unmodified) (def/public (set-unmodified)
void)) (void)))
(defclass internal-snip% snip% (defclass internal-snip% snip%
(super-new) (super-new)

View File

@ -654,11 +654,11 @@
(set! flow-invalid? #t)) (set! flow-invalid? #t))
(set! snip-cache-invalid? #t)) (set! snip-cache-invalid? #t))
(def/override (locked-for-read?) (def/override-final (locked-for-read?)
read-locked?) read-locked?)
(def/override-final (locked-for-flow?) (def/override-final (locked-for-flow?)
flow-locked?) flow-locked?)
(def/override (locked-for-write?) (def/override-final (locked-for-write?)
write-locked?) write-locked?)
;; ---------------------------------------- ;; ----------------------------------------
@ -2975,7 +2975,7 @@
(mline-get-line line))])) (mline-get-line line))]))
(def/public (get-snip-position-and-location [snip% thesnip] [maybe-box? pos] (def/public-final (get-snip-position-and-location [snip% thesnip] [maybe-box? pos]
[maybe-box? [x #f]] [maybe-box? [y #f]]) [maybe-box? [x #f]] [maybe-box? [y #f]])
(cond (cond
[(not (check-recalc (or x y) #f)) [(not (check-recalc (or x y) #f))

View File

@ -742,7 +742,7 @@ Gets the maximum display height for the contents of the editor; zero or
} }
@defmethod[(get-max-undo-history) @defmethod[(get-max-undo-history)
(integer-in 0 100000)]{ (or/c (integer-in 0 100000) 'forever)]{
Returns the maximum number of undoables that will be remembered by the Returns the maximum number of undoables that will be remembered by the
editor. Note that undoables are counted by insertion, deletion, editor. Note that undoables are counted by insertion, deletion,
@ -1192,7 +1192,7 @@ Reports whether the editor is internally locked for flowing. See
} }
@defmethod[(locked-for-read?) @defmethod[#:mode public-final (locked-for-read?)
boolean?]{ boolean?]{
Reports whether the editor is internally locked for reading. See Reports whether the editor is internally locked for reading. See
@ -1201,7 +1201,7 @@ Reports whether the editor is internally locked for reading. See
} }
@defmethod[(locked-for-write?) @defmethod[#:mode public-final (locked-for-write?)
boolean?]{ boolean?]{
Reports whether the editor is internally locked for writing. See Reports whether the editor is internally locked for writing. See

View File

@ -969,7 +969,7 @@ Does nothing.
(on-reorder [snip (is-a?/c snip%)] (on-reorder [snip (is-a?/c snip%)]
[to-snip (is-a?/c snip%)] [to-snip (is-a?/c snip%)]
[before? any/c]) [before? any/c])
boolean?]{ void?]{
@methspec{ @methspec{
Called before a snip is moved in the pasteboard's front-to-back snip Called before a snip is moved in the pasteboard's front-to-back snip

View File

@ -394,7 +394,7 @@ Returns @scheme[0.0].
@defmethod[(get-snipclass) @defmethod[(get-snipclass)
(is-a?/c snip-class%)]{ (or/c #f (is-a?/c snip-class%))]{
Returns the snip's class, which is used for file saving and Returns the snip's class, which is used for file saving and
cut-and-paste. cut-and-paste.

View File

@ -873,7 +873,8 @@ Returns the starting @techlink{position} of a given snip or
} }
@defmethod[(get-snip-position-and-location [snip (is-a?/c snip%)] @defmethod[#:mode public-final
(get-snip-position-and-location [snip (is-a?/c snip%)]
[pos (or/c (box/c exact-nonnegative-integer?) #f)] [pos (or/c (box/c exact-nonnegative-integer?) #f)]
[x (or/c (box/c real?) #f) #f] [x (or/c (box/c real?) #f) #f]
[y (or/c (box/c real?) #f) #f]) [y (or/c (box/c real?) #f) #f])