(in-package :qt.tests) (5am:in-suite :qt.suite) (5am:test qvector-qpoint "Tests to QVector translation." (let* ((points (map 'vector #'(lambda (coords) (make-instance 'qt:point :arg0 (first coords) :arg1 (rest coords))) '((9 . 8) (7 . 6) (5 . 4)))) (polygon (make-instance 'qt:polygon :arg0 points))) (dotimes (i (length points)) (5am:is (= (cxx:x (aref points i)) (cxx:x (cxx:point polygon i)))) (5am:is (= (cxx:y (aref points i)) (cxx:y (cxx:point polygon i)))))) ;; Free the allocated QVector (tg:gc :full t)) (5am:test qvector-double "Test QVector <-> Lisp translation." (5am:for-all ((pattern (5am:gen-one-element #() #(1d0 2d0) #(3.1415926d0 -10d0 1d10 0d0)))) (let ((pen (make-instance 'qt:pen))) ;; set-dash-pattern only works once!? (cxx:set-dash-pattern pen pattern) (5am:is (equalp pattern (cxx:dash-pattern pen)))))) (5am:test qvector-uint "Test QVector <-> Lisp translation." (let ((image (make-instance 'qt:image :args (list 10 10 qt:image.+format-indexed8+))) (colors (map 'vector #'qt:q-rgb '(1 2 44 55 255) '(4 6 23 43 12) '(5 0 23 12 123)))) (5am:is (equalp #() (cxx:color-table image))) (cxx:set-color-table image colors) (5am:is (equalp colors (cxx:color-table image)))))