From 117fde68571b9a355d18c24456ee83f14edba3d9 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Sat, 27 Oct 2012 16:45:44 -0500 Subject: [PATCH] adjust the online check syntax frame/tab leak test case so that it waits until online check syntax actually finishes (otherwise, there actually is a leak; the link is broken when the message comes back from the other place) --- collects/drracket/private/module-language.rkt | 1 + .../drracket/no-write-and-frame-leak.rkt | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/collects/drracket/private/module-language.rkt b/collects/drracket/private/module-language.rkt index b44142e5c0..b1d7b94128 100644 --- a/collects/drracket/private/module-language.rkt +++ b/collects/drracket/private/module-language.rkt @@ -937,6 +937,7 @@ ;; colors : (or/c #f (listof string?) 'parens) (define colors #f) (define tooltip-labels #f) + (define/public (get-online-expansion-colors) colors) (super-new) diff --git a/collects/tests/drracket/no-write-and-frame-leak.rkt b/collects/tests/drracket/no-write-and-frame-leak.rkt index ce8a622bec..0ab24883f7 100644 --- a/collects/tests/drracket/no-write-and-frame-leak.rkt +++ b/collects/tests/drracket/no-write-and-frame-leak.rkt @@ -16,6 +16,7 @@ This test checks: |# (require "private/drracket-test-util.rkt" + drracket/private/local-member-names racket/gui/base framework) @@ -35,13 +36,20 @@ This test checks: (λ () (check-menus (wait-for-drracket-frame)) - (try-to-find-leak "online compilation disabled:") + (try-to-find-leak "online compilation disabled:" void) (preferences:set 'drracket:online-compilation-default-on #t) - (try-to-find-leak "online compilation enabled:"))))) + (try-to-find-leak "online compilation enabled:" wait-for-online-compilation-to-finish))))) -(define (try-to-find-leak online-compilation-string) +(define (wait-for-online-compilation-to-finish frame) + (let loop ([i 0]) + (define current-colors (send frame get-online-expansion-colors)) + (unless (equal? current-colors '("forestgreen")) + (sleep 1) + (loop (+ i 1))))) + +(define (try-to-find-leak online-compilation-string extra-waiting) (define drs-frame1 (wait-for-drracket-frame)) (sync (system-idle-evt)) @@ -63,8 +71,9 @@ This test checks: (queue-callback/res (λ () (send (send (send (weak-box-value drs-frame2b) get-current-tab) get-defs) load-file - (collection-file-path "unit.rkt" "drracket" "private")))) + (collection-file-path "rep.rkt" "drracket" "private")))) (sleep 2) + (extra-waiting (weak-box-value drs-frame2b)) (sync (system-idle-evt)) (test:menu-select "File" (if (eq? (system-type) 'unix) "Close" "Close Window")) @@ -74,9 +83,9 @@ This test checks: (cond [(zero? n) (when (weak-box-value drs-tabb) - (eprintf "~a frame leak!\n" online-compilation-string)) - (when (weak-box-value drs-frame2b) (eprintf "~a tab leak!\n" online-compilation-string)) + (when (weak-box-value drs-frame2b) + (eprintf "~a frame leak!\n" online-compilation-string)) (when (weak-box-value tab-nsb) (eprintf "~a tab namespace leak!\n" online-compilation-string)) (when (weak-box-value frame2-nsb)