Sun Apr 12 21:51:20 CEST 2009 Tobias Rautenkranz * Test operator functions diff -rN -u old-qt.tests/qt.tests.mbd new-qt.tests/qt.tests.mbd --- old-qt.tests/qt.tests.mbd 2014-10-30 07:58:48.000000000 +0100 +++ new-qt.tests/qt.tests.mbd 2014-10-30 07:58:48.000000000 +0100 @@ -17,6 +17,7 @@ ("variant" (:needs "tests")) ("application" (:needs "tests")) ("signal-slot" (:needs "tests")) + ("operators" (:needs "tests")) ("thread" (:needs "tests")) ("properties" (:needs "tests")) ("click" (:needs "tests")))))) diff -rN -u old-qt.tests/src/operators.lisp new-qt.tests/src/operators.lisp --- old-qt.tests/src/operators.lisp 1970-01-01 01:00:00.000000000 +0100 +++ new-qt.tests/src/operators.lisp 2014-10-30 07:58:48.000000000 +0100 @@ -0,0 +1,71 @@ +(in-package :qt.tests) + +(5am:in-suite :qt.suite) + +(5am:test cxx-equality + "Test cxx:= cxx:/=" + (5am:is (eq t (cxx:= (make-instance 'qt:point)))) + (5am:is (eq t (cxx:= (make-instance 'qt:point) + (make-instance 'qt:point)))) + (5am:is (eq t (cxx:= (make-instance 'qt:point) + (make-instance 'qt:point) + (make-instance 'qt:point)))) + (5am:for-all ((x1 (5am:gen-integer)) + (x2 (5am:gen-integer)) + (y1 (5am:gen-integer)) + (y2 (5am:gen-integer))) + (let ((p1 (make-instance 'qt:point :args (list x1 y1))) + (p2 (make-instance 'qt:point :args (list x2 y2)))) +(5am:is (eq (and (= x1 x2) + (= y1 y2)) + (cxx:= p1 p2))) +(5am:is (eq (or (/= x1 x2) + (/= y1 y2)) + (cxx:/= p1 p2)))))) + +(5am:test (cxx-+ :depends-on cxx-equality) + "Test cxx:+" + (5am:for-all ((x1 (5am:gen-integer)) + (x2 (5am:gen-integer)) + (y1 (5am:gen-integer)) + (y2 (5am:gen-integer))) + (let ((p1 (make-instance 'qt:point :args (list x1 y1))) + (p2 (make-instance 'qt:point :args (list x2 y2)))) + (5am:is (eq t (cxx:= (cxx:+ p1 p2) + (make-instance 'qt:point :args (list + (+ x1 x2) + (+ y1 y2))))))))) + + +(5am:test (cxx-decf :depends-on cxx-equality) + "Test cxx:decf" + (5am:for-all ((x1 (5am:gen-integer)) + (x2 (5am:gen-integer)) + (y1 (5am:gen-integer)) + (y2 (5am:gen-integer))) + (let ((p1 (make-instance 'qt:point :args (list x1 y1))) + (p2 (make-instance 'qt:point :args (list x2 y2)))) + (cxx:decf p1 p2) + (5am:is (eq t (cxx:= p1 + (make-instance 'qt:point :args (list + (- x1 x2) + (- y1 y2))))))))) + +(5am:test (cxx-<=) + "Test cxx:<=" + (let ((p1 (make-instance 'qt:byte-array :args '(""))) + (p2 (make-instance 'qt:byte-array :args '("a"))) + (p3 (make-instance 'qt:byte-array :args '("b")))) + (5am:is (eq t (cxx:<= p1 p2 p3))) + (5am:is (eq t (cxx:<= p1 p2 p2 p3))) + (5am:is (eq nil (cxx:<= p2 p1))) + (5am:is (eq nil (cxx:<= p1 p2 p1))))) + +(5am:test cxx-aref + "Test cxx-aref" + (let ((byte-array (make-instance 'qt:byte-array :args '("foobar")))) + (5am:is (eq #\b (cxx:aref byte-array 3))) + (5am:is (eq #\B + (setf (cxx:aref byte-array 3) + #\B))) + (5am:is (eq #\B (cxx:aref byte-array 3))))) diff -rN -u old-qt.tests/src/signal-slot.lisp new-qt.tests/src/signal-slot.lisp --- old-qt.tests/src/signal-slot.lisp 2014-10-30 07:58:48.000000000 +0100 +++ new-qt.tests/src/signal-slot.lisp 2014-10-30 07:58:48.000000000 +0100 @@ -162,13 +162,12 @@ "Receive a C++ class by value signal." (qt:with-app (let ((model (make-instance 'qt:string-list-model)) - (count 0)) + (count 0)) (qt:connect (qt:get-signal model "rowsInserted(QModelIndex, int, int)") #'(lambda (parent start end) - (declare (ignore previous)) - (5am:is (eq (cxx:internal-id (cxx:parent (cxx:index model start))) - (cxx:internal-id parent))) + (5am:is (cxx:= (cxx:parent (cxx:index model start))) + parent) (incf count))) (5am:is (= 0 count)) (cxx:insert-rows model 0 1)