fix teachpack tests to match commit 480afa4c4
This commit is contained in:
parent
7384af40b6
commit
9035e5d1ed
|
@ -194,13 +194,17 @@
|
||||||
(equal? #"scm" (filename-extension teachpack))
|
(equal? #"scm" (filename-extension teachpack))
|
||||||
(equal? #"rkt" (filename-extension teachpack)))
|
(equal? #"rkt" (filename-extension teachpack)))
|
||||||
(unless (or (equal? "graphing.ss" (path->string teachpack))
|
(unless (or (equal? "graphing.ss" (path->string teachpack))
|
||||||
(regexp-match #rx"^info[.].*$" (path->string teachpack)))
|
(regexp-match #rx"^info[.][^.]*$" (path->string teachpack)))
|
||||||
(printf " testing ~a\n" teachpack)
|
(printf " testing ~a\n" teachpack)
|
||||||
(fw:test:menu-select "Language" "Clear All Teachpacks")
|
(fw:test:menu-select "Language" "Clear All Teachpacks")
|
||||||
(fw:test:menu-select "Language" "Add Teachpack...")
|
(fw:test:menu-select "Language" "Add Teachpack...")
|
||||||
(wait-for-new-frame drs-frame)
|
(wait-for-new-frame drs-frame)
|
||||||
(define tp-dialog (test:get-active-top-level-window))
|
(define tp-dialog (test:get-active-top-level-window))
|
||||||
(define choice (find/select-relevant-choice tp-dialog (path->string teachpack)))
|
(define choice
|
||||||
|
(let-values ([(_1 parent-dir _2) (split-path dir)])
|
||||||
|
(find/select-relevant-choice tp-dialog
|
||||||
|
(path->string parent-dir)
|
||||||
|
(path->string teachpack))))
|
||||||
(fw:test:button-push "OK")
|
(fw:test:button-push "OK")
|
||||||
(wait-for-new-frame tp-dialog)
|
(wait-for-new-frame tp-dialog)
|
||||||
(do-execute drs-frame)
|
(do-execute drs-frame)
|
||||||
|
@ -219,25 +223,40 @@
|
||||||
(test-teachpacks (collection-file-path "image.rkt" "teachpack" "2htdp"))
|
(test-teachpacks (collection-file-path "image.rkt" "teachpack" "2htdp"))
|
||||||
(test-teachpacks (collection-file-path "image.rkt" "teachpack" "htdp")))
|
(test-teachpacks (collection-file-path "image.rkt" "teachpack" "htdp")))
|
||||||
|
|
||||||
(define (find/select-relevant-choice tp-dialog tp-string)
|
(define (find/select-relevant-choice tp-dialog parent-dir tp-string)
|
||||||
(define lb
|
(define-values (lb index)
|
||||||
(let loop ([p tp-dialog])
|
(let loop ([p tp-dialog])
|
||||||
(cond
|
(cond
|
||||||
[(and (is-a? p list-box%)
|
[(and (is-a? p list-box%)
|
||||||
(list-control-has-string? p tp-string))
|
(list-control-get-index p parent-dir tp-string))
|
||||||
p]
|
=>
|
||||||
|
(λ (i)
|
||||||
|
(values p i))]
|
||||||
[(is-a? p area-container<%>)
|
[(is-a? p area-container<%>)
|
||||||
(ormap loop (send p get-children))]
|
(let c-loop ([children (send p get-children)])
|
||||||
[else #f])))
|
|
||||||
(cond
|
(cond
|
||||||
[lb (fw:test:set-list-box! lb tp-string)]
|
[(null? children) (values #f #f)]
|
||||||
|
[else (define-values (tb index) (loop (car children)))
|
||||||
|
(if tb
|
||||||
|
(values tb index)
|
||||||
|
(c-loop (cdr children)))]))]
|
||||||
|
[else (values #f #f)])))
|
||||||
|
(cond
|
||||||
|
[lb (fw:test:set-list-box! lb index)]
|
||||||
[else
|
[else
|
||||||
(error 'find/select-relevant-choice "did not find ~s in any list-box%" tp-string)]))
|
(error 'find/select-relevant-choice "did not find ~s in any list-box%" tp-string)]))
|
||||||
|
|
||||||
(define (list-control-has-string? control str)
|
(define (list-control-get-index control parent-dir tp-string)
|
||||||
(for/or ([i (in-range 0 (send control get-number))])
|
(let loop ([i 0])
|
||||||
|
(cond
|
||||||
|
[(< i (send control get-number))
|
||||||
|
(if (or (equal? (send control get-string i)
|
||||||
|
tp-string)
|
||||||
(equal? (send control get-string i)
|
(equal? (send control get-string i)
|
||||||
str)))
|
(format "~a/~a" parent-dir tp-string)))
|
||||||
|
i
|
||||||
|
(loop (+ i 1)))]
|
||||||
|
[else #f])))
|
||||||
|
|
||||||
(define (find-leftmost-choice frame)
|
(define (find-leftmost-choice frame)
|
||||||
(let loop ([p frame])
|
(let loop ([p frame])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user