Sat Jan 23 23:18:13 CET 2010 Tobias Rautenkranz * Test to QVector translation. diff -rN -u old-qt.tests/cl-smoke.qt.tests.asd new-qt.tests/cl-smoke.qt.tests.asd --- old-qt.tests/cl-smoke.qt.tests.asd 2014-10-30 07:55:00.000000000 +0100 +++ new-qt.tests/cl-smoke.qt.tests.asd 2014-10-30 07:55:00.000000000 +0100 @@ -13,6 +13,7 @@ (:file "tests" :depends-on ("package")) (:file "qbytearray" :depends-on ("tests")) (:file "qstring" :depends-on ("tests")) + (:file "qvector" :depends-on ("tests")) (:file "overload" :depends-on ("tests")) (:file "gc" :depends-on ("tests" "object")) (:file "variant" :depends-on ("tests")) diff -rN -u old-qt.tests/src/qvector.lisp new-qt.tests/src/qvector.lisp --- old-qt.tests/src/qvector.lisp 1970-01-01 01:00:00.000000000 +0100 +++ new-qt.tests/src/qvector.lisp 2014-10-30 07:55:00.000000000 +0100 @@ -0,0 +1,41 @@ +(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)))))