Test receiving C++ classes by value in a slot
Thu Apr 9 00:37:07 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Test receiving C++ classes by value in a slot
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:03:31.000000000 +0100
+++ new-qt.tests/src/signal-slot.lisp 2014-10-30 07:03:31.000000000 +0100
@@ -140,7 +140,7 @@
(5am:is (= value (read-from-string current-string-value)))))))
(5am:test object-signal
- "Receive a qt:object signal."
+ "Receive a qt:object pointer signal."
(qt:with-app
(let ((button (make-instance 'qt:push-button))
(click-count 0)
@@ -151,9 +151,26 @@
(qt:connect (qt:get-signal signal-mapper "mapped(QObject*)")
#'(lambda (object)
- (5am:is (eq object button))
+ (5am:is (eq button object))
(incf click-count)))
(5am:is (= 0 click-count))
(qt.test:test.mouse-click button qt:+left-button+)
(5am:is (= 1 click-count)))))
+(5am:test receive-by-value
+ "Receive a C++ class by value signal."
+ (qt:with-app
+ (let ((model (make-instance 'qt:string-list-model))
+ (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)))
+ (incf count)))
+ (5am:is (= 0 count))
+ (cxx:insert-rows model 0 1)
+ (5am:is (= 1 count))
+ (cxx:insert-rows model 0 3)
+ (5am:is (= 2 count)))))