<commit_before>#lang racket/base
(require racket/class
         racket/draw
         racket/draw/private/record-dc)

(define bm1 (make-bitmap 100 100))
(define bm2 (make-bitmap 100 100))
(define bm3 (make-bitmap 100 100))

(define dc1 (make-object bitmap-dc% bm1))
(define dc2 (make-object (record-dc-mixin bitmap-dc%) bm2))
(define dc3 (make-object bitmap-dc% bm3))

(define (config dc)
  (send dc set-origin 2 3)
  (send dc set-scale 1.1 0.9)
  (send dc set-rotation 0.1)
  (send dc set-initial-matrix '#(1.0 -0.1 0.1 1.0 1.0 2.0))
  (send dc set-pen "red" 2 'solid)
  (send dc set-brush "blue" 'solid)
  (send dc set-font (make-font #:size 32))
  (send dc set-smoothing 'smoothed)
  (send dc set-text-mode 'solid)
  (send dc set-alpha 0.8)
  (send dc set-clipping-rect 5 5 95 95))

(define (draw dc)
  (send dc draw-ellipse 2 2 100 100)
  (send dc draw-text "Hello" 10 10))

(define (get-bytes bm)
  (define w (send bm get-width))
  (define h (send bm get-height))
  (define bstr (make-bytes (* 4 w h)))
  (send bm get-argb-pixels 0 0 w h bstr)
  bstr)

(config dc1)
(draw dc1)

(define pre-bytes (get-bytes bm1))

(config dc2)
(send dc2 erase)
(draw dc2)

(define middle-bytes (get-bytes bm2))

(define cms (send dc2 get-recorded-command))

(cms dc3)

(define post-bytes (get-bytes bm3))

(unless (equal? pre-bytes middle-bytes)
  (error "middle != pre"))

(unless (equal? pre-bytes post-bytes)
  (error "post != pre"))<commit_msg>fix `record-dc%' test<commit_after>#lang racket/base
(require racket/class
         racket/draw
         (only-in racket/draw/private/record-dc 
                  record-dc-mixin
                  get-recorded-command))

(define bm1 (make-bitmap 100 100))
(define bm2 (make-bitmap 100 100))
(define bm3 (make-bitmap 100 100))

(define dc1 (make-object bitmap-dc% bm1))
(define dc2 (make-object (record-dc-mixin bitmap-dc%) bm2))
(define dc3 (make-object bitmap-dc% bm3))

(define (config dc)
  (send dc set-origin 2 3)
  (send dc set-scale 1.1 0.9)
  (send dc set-rotation 0.1)
  (send dc set-initial-matrix '#(1.0 -0.1 0.1 1.0 1.0 2.0))
  (send dc set-pen "red" 2 'solid)
  (send dc set-brush "blue" 'solid)
  (send dc set-font (make-font #:size 32))
  (send dc set-smoothing 'smoothed)
  (send dc set-text-mode 'solid)
  (send dc set-alpha 0.8)
  (send dc set-clipping-rect 5 5 95 95))

(define (draw dc)
  (send dc draw-ellipse 2 2 100 100)
  (send dc draw-text "Hello" 10 10))

(define (get-bytes bm)
  (define w (send bm get-width))
  (define h (send bm get-height))
  (define bstr (make-bytes (* 4 w h)))
  (send bm get-argb-pixels 0 0 w h bstr)
  bstr)

(config dc1)
(draw dc1)

(define pre-bytes (get-bytes bm1))

(config dc2)
(send dc2 erase)
(draw dc2)

(define middle-bytes (get-bytes bm2))

(define cms (send dc2 get-recorded-command))

(void (cms dc3))

(define post-bytes (get-bytes bm3))

(unless (equal? pre-bytes middle-bytes)
  (error "middle != pre"))

(unless (equal? pre-bytes post-bytes)
  (error "post != pre"))
{'fraction_non_alphanumeric': 0.15392388009430785, 'fraction_numerical': 0.05591108117211182, 'mean_word_length': 3.242857142857143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3729561', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1187, 'n_words': 379}