Test ownership transfer of qt:connect to a no Smoke QObject instance.
Mon Jul 27 21:28:28 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Test ownership transfer of qt:connect to a no Smoke QObject instance.
diff -rN -u old-kde.tests/src/click.lisp new-kde.tests/src/click.lisp
--- old-kde.tests/src/click.lisp 2014-10-30 06:57:09.000000000 +0100
+++ new-kde.tests/src/click.lisp 2014-10-30 06:57:09.000000000 +0100
@@ -8,15 +8,15 @@
(5am:test click-test
"Test clicking a button."
- (kde::with-kde ("hello" "hello-world" "0.0.1")
- (let ((widget (make-instance 'my-widget))
- (click-count 0))
- (qt:connect (qt:get-signal widget "clicked()")
- #'(lambda ()
- (incf click-count)))
-
- (cxx:set-text widget "Click Me")
+ (kde:with-kde ("hello" "hello-world" "0.0.1")
+ (let ((widget (make-instance 'my-widget))
+ (click-count 0))
+ (qt:connect (qt:get-signal widget "clicked()")
+ #'(lambda ()
+ (incf click-count)))
+
+ (cxx:set-text widget "Click Me")
- (5am:is (= 0 click-count))
- (qt:test.mouse-click widget qt:+left-button+)
- (5am:is (= 1 click-count)))))
+ (5am:is (= 0 click-count))
+ (qt:test.mouse-click widget qt:+left-button+)
+ (5am:is (= 1 click-count)))))
diff -rN -u old-kde.tests/src/tests.lisp new-kde.tests/src/tests.lisp
--- old-kde.tests/src/tests.lisp 2014-10-30 06:57:09.000000000 +0100
+++ new-kde.tests/src/tests.lisp 2014-10-30 06:57:09.000000000 +0100
@@ -6,6 +6,23 @@
(defun run ()
(let ((results (5am:run :kde.suite)))
- (5am:explain! results)
- (unless (5am:results-status results)
- (error "Testsuite :kde.suite failed."))))
+ (5am:explain! results)
+ (unless (5am:results-status results)
+ (error "Testsuite :kde.suite failed."))))
+
+(5am:test connect-to-non-smoke-qobject
+ "Test ownership transfer to a no Smoke QObject instance."
+ (kde:with-kde ("test" "test" "1")
+ (let* ((window (make-instance 'kde:push-button))
+ (action-collection (make-instance 'kde:action-collection
+ :arg0 window))
+ (counter 0)
+ (action (kde:make-standard-action kde:standard-action.+open+
+ action-collection
+ #'(lambda () (incf counter)))))
+ (tg:gc :full t)
+ (tg:gc :full t)
+ (5am:is (= 0 counter))
+ (cxx:activate action qt:action.+trigger+)
+ (5am:is (= 1 counter)))))
+