Use new qt:with-app
Wed Jul 1 13:02:20 CEST 2009 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Use new qt:with-app
diff -rN -u old-qt.tests/src/abort.lisp new-qt.tests/src/abort.lisp
--- old-qt.tests/src/abort.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/abort.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -5,12 +5,12 @@
(defmacro with-invoke-restart ((condition restart &optional handler) &body body)
"Invokes RESTART when CONDITION is signaled in BODY."
(alexandria:with-gensyms (c)
- `(handler-bind ((,condition #'(lambda (,c)
- (declare (ignore ,c))
- (assert (find-restart ',restart))
- ,(when handler `(funcall ,handler))
- (invoke-restart ',restart))))
- ,@body)))
+ `(handler-bind ((,condition #'(lambda (,c)
+ (declare (ignore ,c))
+ (assert (find-restart ',restart))
+ ,(when handler `(funcall ,handler))
+ (invoke-restart ',restart))))
+ ,@body)))
(define-condition no-ticket (error) ())
@@ -23,18 +23,18 @@
"Test aborting the event loop."
(dotimes (i 3)
(bt:with-timeout (5)
- (with-invoke-restart (no-ticket qt::abort-app)
- (qt:with-app
- (let ((timer (make-instance 'qt:timer))
- (continued-p))
- (cxx:set-single-shot timer t)
- (qt:connect (qt:get-signal timer "timeout()")
- #'(lambda ()
- (cerror "ignore" (make-condition 'no-ticket))
- (setf continued-p t)))
- (cxx:start timer 0)
- (qt:exec)
- (5am:is (eq continued-p t))))))))
+ (with-invoke-restart (no-ticket qt::abort-app)
+ (qt:with-app ()
+ (let ((timer (make-instance 'qt:timer))
+ (continued-p))
+ (cxx:set-single-shot timer t)
+ (qt:connect (qt:get-signal timer "timeout()")
+ #'(lambda ()
+ (cerror "ignore" (make-condition 'no-ticket))
+ (setf continued-p t)))
+ (cxx:start timer 0)
+ (qt:exec)
+ (5am:is (eq continued-p t))))))))
(defclass error-object (qt:object)
()
@@ -45,30 +45,30 @@
(error (make-condition 'no-ticket)))
(5am:test error-in-callback-return
- "Test retruning from a void method on error."
- (qt:with-core-app
- (let ((object (make-instance 'error-object))
- (restarted-p))
- (with-invoke-restart (no-ticket smoke::return
- #'(lambda () (setf restarted-p t)))
- (cxx:start-timer object 0)
- (qt:core-application.process-events))
- (5am:is (eq t restarted-p)))))
+ "Test returning from a void method on error."
+ (qt:with-core-app ()
+ (let ((object (make-instance 'error-object))
+ (restarted-p))
+ (with-invoke-restart (no-ticket smoke::return
+ #'(lambda () (setf restarted-p t)))
+ (cxx:start-timer object 0)
+ (qt:core-application.process-events))
+ (5am:is (eq t restarted-p)))))
(5am:test error-in-callback-default
"Test calling the default C++ method on error in the user defined method."
- (qt:with-core-app
- (let ((object (make-instance 'error-object))
- (restarted-p))
- (with-invoke-restart (no-ticket smoke::call-default
- #'(lambda () (setf restarted-p t)))
- (cxx:start-timer object 0)
- (qt:core-application.process-events))
- (5am:is (eq t restarted-p)))))
+ (qt:with-core-app ()
+ (let ((object (make-instance 'error-object))
+ (restarted-p))
+ (with-invoke-restart (no-ticket smoke::call-default
+ #'(lambda () (setf restarted-p t)))
+ (cxx:start-timer object 0)
+ (qt:core-application.process-events))
+ (5am:is (eq t restarted-p)))))
(5am:test error-in-slot
"Test skipping a slot function when it signals an error."
- (qt:with-core-app
+ (qt:with-core-app ()
(let ((timer (make-instance 'qt:timer))
(continued-p))
(with-invoke-restart (no-ticket continue
diff -rN -u old-qt.tests/src/application.lisp new-qt.tests/src/application.lisp
--- old-qt.tests/src/application.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/application.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -5,32 +5,32 @@
(5am:test with-app
"Tests qt:with-app and qt:with-core-app"
(let ((nested (qt:app-p)))
- (5am:for-all ((core-p (5am:gen-one-element nil t)))
- (unless nested
- (5am:is (eql nil (qt:app-p))))
- (if core-p
- (qt:with-core-app
- (5am:is (eql t (qt:app-p)))
- (5am:is (typep (qt:app) (find-class 'qt:core-application)))
- (setf (cxx:object-name (qt:app)) "core-app")) ;; test for memfault
- (qt:with-app
- (5am:is (eql t (qt:app-p)))
- (5am:is (typep (qt:app) (find-class 'qt:application)))
- (setf (cxx:object-name (qt:app)) "app")))
- (unless nested
- (5am:is (eql nil (qt:app-p)))))))
+ (5am:for-all ((core-p (5am:gen-one-element nil t)))
+ (unless nested
+ (5am:is (eql nil (qt:app-p))))
+ (if core-p
+ (qt:with-core-app ()
+ (5am:is (eql t (qt:app-p)))
+ (5am:is (typep (qt:app) (find-class 'qt:core-application)))
+ (setf (cxx:object-name (qt:app)) "core-app")) ;; test for memfault
+ (qt:with-app ()
+ (5am:is (eql t (qt:app-p)))
+ (5am:is (typep (qt:app) (find-class 'qt:application)))
+ (setf (cxx:object-name (qt:app)) "app")))
+ (unless nested
+ (5am:is (eql nil (qt:app-p)))))))
(5am:test application-nest
"Test qt:with-core-app nesting."
- (qt:with-core-app
+ (qt:with-core-app ()
(5am:is (eql (qt:app) (qt:core-application.instance)))
- (qt:with-core-app
+ (qt:with-core-app ()
(5am:is (eql (qt:app) (qt:core-application.instance))))
(5am:is (eql (qt:app) (qt:core-application.instance)))))
(5am:test application-widgetlist
"Test cxx:all-widgets"
- (qt:with-app
- (5am:is (= 0 (length (cxx:all-widgets (qt:app)))))
- (let ((w (make-instance 'qt:widget)))
- (5am:is (find w (cxx:all-widgets (qt:app)))))))
+ (qt:with-app ()
+ (5am:is (= 0 (length (cxx:all-widgets (qt:app)))))
+ (let ((w (make-instance 'qt:widget)))
+ (5am:is (find w (cxx:all-widgets (qt:app)))))))
diff -rN -u old-qt.tests/src/click.lisp new-qt.tests/src/click.lisp
--- old-qt.tests/src/click.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/click.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -8,14 +8,14 @@
(5am:test (click-test :depends-on with-app)
"Test clicking a button."
- (qt:with-app
+ (qt:with-app ()
(let ((widget (make-instance 'click-test-widget))
(click-count 0))
(qt:connect (qt:get-signal widget "clicked()")
#'(lambda ()
(5am:is (eq widget (qt:sender)))
(incf click-count)))
-
+
(cxx:set-text widget "Hello World")
(5am:is (string= "Hello World" (cxx:text widget)))
@@ -27,7 +27,7 @@
(5am:test (click-test-bool :depends-on click-test)
"Test clicking a button (bool argument)."
- (qt:with-app
+ (qt:with-app ()
(let ((widget (make-instance 'click-test-widget))
(click-count 0))
(qt:connect (qt:get-signal widget "clicked(bool)")
@@ -42,7 +42,7 @@
(5am:test (click-test-bool-this :depends-on click-test)
"Test clicking a button (bool argument) for a function with this argument."
- (qt:with-app
+ (qt:with-app ()
(let ((widget (make-instance 'click-test-widget))
(click-count 0))
(qt:connect (qt:get-signal widget "clicked(bool)")
diff -rN -u old-qt.tests/src/gc.lisp new-qt.tests/src/gc.lisp
--- old-qt.tests/src/gc.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/gc.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -8,7 +8,7 @@
(defun test-gc (class)
"Returns true when some instances of class get garbage collected
and false otherwise.
-It is not required that every instance is gc'ed, since this rarly happens
+It is not required that every instance is gc'ed, since this rarely happens
and is not a bug."
(let ((objects nil))
(dotimes (x 9)
@@ -24,7 +24,7 @@
(defclass lisp-object ()
((a :initform (make-array '(1000 1000) :initial-element 3))
(b :initform (list 1 2 43)))
- (:documentation "For the object to be (hopefully) garbage colleted
+ (:documentation "For the object to be (hopefully) garbage collected
we cons up some memory."))
(5am:test gc-lisp-object
@@ -50,7 +50,7 @@
(dotimes (x 10)
(let ((object (make-instance 'qt:object)))
(make-instance 'qt:object :args (list object))
- ;(cxx:set-parent (make-instance 'qt:object) object)
+ ;;(cxx:set-parent (make-instance 'qt:object) object)
(push object objects)))
(gc :full t)))
@@ -67,7 +67,7 @@
"Test garbage collection of a qt:object with a parent."
(gc :full t)
(gc :full t)
- (qt:with-core-app
+ (qt:with-core-app ()
(let ((count (hash-table-count smoke::*object-map*)))
(eval '(run-gc-child))
(eval '(gc :full t))
@@ -80,7 +80,7 @@
(5am:test (gc-lisp-child :depends-on (and gc-child with-app))
"Test garbage collection of a qt:object with a parent."
(gc :full t)
- (qt:with-core-app
+ (qt:with-core-app ()
(let ((count (hash-table-count smoke::*object-map*)))
(eval '(run-gc-my-child))
;; a.k.a :really-full ;)
@@ -107,23 +107,23 @@
(qt:core-application.send-posted-events))
(5am:test (gc-cycle :depends-on gc-lisp-child)
- "Test GC a unreacable cycle."
+ "Test GC a unreachable cycle."
;; timer -> qslot -> closure(lambda)
;; ^------------------/
- (qt:with-core-app
- (let ((objects (hash-table-count smoke::*object-map*)))
- (eval '(test-gc-cycle))
- (eval '(gc :full t))
- (qt:core-application.send-posted-events)
- (eval '(gc :full t))
- (qt:core-application.send-posted-events)
- (gc :full t)
- (qt:core-application.send-posted-events)
- (gc :full t)
- (5am:is (>= (+ 2 objects) (hash-table-count smoke::*object-map*))))))
+ (qt:with-core-app ()
+ (let ((objects (hash-table-count smoke::*object-map*)))
+ (eval '(test-gc-cycle))
+ (eval '(gc :full t))
+ (qt:core-application.send-posted-events)
+ (eval '(gc :full t))
+ (qt:core-application.send-posted-events)
+ (gc :full t)
+ (qt:core-application.send-posted-events)
+ (gc :full t)
+ (5am:is (>= (+ 2 objects) (hash-table-count smoke::*object-map*))))))
(5am:test (ownership-transfer-no-wrapper :depends-on gc-lisp-child)
- "Test ownership tranasfer of a QObject without a wrapper."
+ "Test ownership transfer of a QObject without a wrapper."
(let ((grand-parent (make-instance 'qt:object)))
(let* ((parent (make-instance 'qt:object :args (list grand-parent)))
(object (make-instance 'my-object :args (list parent))))
@@ -139,31 +139,31 @@
(5am:test (gc-non-smoke-object :depends-on gc-lisp-child)
- "Test adding a child to a non smoke object."
- (qt:with-app
- (let ((model (make-instance 'qt:string-list-model
- :args (list #("a" "b" "c"))))
- (view (make-instance 'qt:list-view))
- (counter 0))
- (setf (cxx:model view) model)
- (qt:connect (qt:get-signal (cxx:selection-model view)
- "selectionChanged(QItemSelection, QItemSelection)")
- #'(lambda (selected deselected)
- (declare (ignore selected deselected))
- (incf counter)))
- (gc :full t)
- (qt:core-application.send-posted-events)
- (gc :full t)
- (qt:core-application.send-posted-events)
- (5am:is (= 0 counter))
- (cxx:select (cxx:selection-model view)
- (cxx:index model 0)
- qt:item-selection-model.+toggle+)
- (5am:is (= 1 counter))
- (cxx:select (cxx:selection-model view)
- (cxx:index model 1)
- qt:item-selection-model.+toggle+)
- (5am:is (= 2 counter)))))
+ "Test adding a child to a non smoke object."
+ (qt:with-app ()
+ (let ((model (make-instance 'qt:string-list-model
+ :args (list #("a" "b" "c"))))
+ (view (make-instance 'qt:list-view))
+ (counter 0))
+ (setf (cxx:model view) model)
+ (qt:connect (qt:get-signal (cxx:selection-model view)
+ "selectionChanged(QItemSelection, QItemSelection)")
+ #'(lambda (selected deselected)
+ (declare (ignore selected deselected))
+ (incf counter)))
+ (gc :full t)
+ (qt:core-application.send-posted-events)
+ (gc :full t)
+ (qt:core-application.send-posted-events)
+ (5am:is (= 0 counter))
+ (cxx:select (cxx:selection-model view)
+ (cxx:index model 0)
+ qt:item-selection-model.+toggle+)
+ (5am:is (= 1 counter))
+ (cxx:select (cxx:selection-model view)
+ (cxx:index model 1)
+ qt:item-selection-model.+toggle+)
+ (5am:is (= 2 counter)))))
#|
;; FIXME
diff -rN -u old-qt.tests/src/object.lisp new-qt.tests/src/object.lisp
--- old-qt.tests/src/object.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/object.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -3,13 +3,13 @@
(5am:in-suite :qt.suite)
(5am:test test-children
- "Test QList<Object*> to sequence conversion."
- (let ((object (make-instance 'qt:object)))
- (5am:is (= 0 (length (cxx:children object))))
- (let ((children (mapcar #'(lambda (parent)
- (make-instance 'qt:object :args (list parent)))
- (list object object object))))
- (5am:is (= (length children)
- (length (cxx:children object))))
- (dolist (c children)
- (5am:is (find c (cxx:children object)))))))
+ "Test QList<Object*> to sequence conversion."
+ (let ((object (make-instance 'qt:object)))
+ (5am:is (= 0 (length (cxx:children object))))
+ (let ((children (mapcar #'(lambda (parent)
+ (make-instance 'qt:object :args (list parent)))
+ (list object object object))))
+ (5am:is (= (length children)
+ (length (cxx:children object))))
+ (dolist (c children)
+ (5am:is (find c (cxx:children object)))))))
diff -rN -u old-qt.tests/src/overload.lisp new-qt.tests/src/overload.lisp
--- old-qt.tests/src/overload.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/overload.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -12,7 +12,7 @@
(5am:test timer
(let ((object (make-instance 'my-object)))
- (qt:with-core-app
+ (qt:with-core-app ()
(5am:is (= 0 (counter object)))
(cxx:start-timer object 0)
(with-timeout (5)
diff -rN -u old-qt.tests/src/qbytearray.lisp new-qt.tests/src/qbytearray.lisp
--- old-qt.tests/src/qbytearray.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/qbytearray.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -2,15 +2,12 @@
(5am:in-suite :qt.suite)
-
(5am:test null-bytearray
"Test empty QByteArray."
- (5am:is (string= ""
- (cxx:data (make-instance 'qt:byte-array)))))
-
+ (5am:is (string= "" (cxx:data (make-instance 'qt:byte-array)))))
(5am:test bytearray
- "Tests string <-> QByteArray."
+ "Test string <-> QByteArray."
(5am:for-all ((string (5am:gen-string)))
(5am:is (string= string
(cxx:data (make-instance 'qt:byte-array
diff -rN -u old-qt.tests/src/qstring.lisp new-qt.tests/src/qstring.lisp
--- old-qt.tests/src/qstring.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/qstring.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -5,12 +5,12 @@
(5am:test (qstring :depends-on bytearray)
"Tests string <-> QString."
(let ((object (make-instance 'qt:object)))
-; (5am:for-all ((string (5am:gen-string))) ;; FIXME (Qt bug?)
+ ;; (5am:for-all ((string (5am:gen-string))) ;; FIXME (Qt bug?)
(5am:for-all ((string (5am:gen-one-element "foo"
- "FOO bar"
- ""
- (format nil "A~AB" #\Null)
- "öäüƧЪ")))
+ "FOO bar"
+ ""
+ (format nil "A~AB" #\Null)
+ "öäüƧЪ")))
(setf (cxx:object-name object) string)
(5am:is (string= string (cxx:object-name object))))))
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:02:50.000000000 +0100
+++ new-qt.tests/src/signal-slot.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -8,14 +8,14 @@
(let ((my-signal (qt:make-signal))
(my-slot (qt::make-slot #'(lambda () (incf counter))
nil)))
-
+
(qt:connect my-signal my-slot)
(funcall my-signal)
(5am:is (= 1 counter)))))
(5am:test (emit-int-signal :depends-on with-app)
"Emits a signal with a C++ integer argument to a C++ slot."
- (qt:with-core-app
+ (qt:with-core-app ()
(let ((my-signal (qt:make-signal))
(label (make-instance 'qt:label)))
(qt:connect my-signal (qt:get-slot label "setNum(int)"))
@@ -25,7 +25,7 @@
(5am:test (emit-float-signal :depends-on with-app)
"Emits a signal with a C++ integer argument to a C++ slot."
- (qt:with-core-app
+ (qt:with-core-app ()
(let ((my-signal (qt:make-signal))
(label (make-instance 'qt:label)))
(qt:connect my-signal (qt:get-slot label "setNum(double)"))
@@ -37,7 +37,7 @@
(5am:test emit-bool-signal
"Emits a signal with an boolean C++ argument to a C++ slot."
- (qt:with-app
+ (qt:with-app ()
(let ((my-signal (qt:make-signal))
(widget (make-instance 'qt:check-box)))
(qt:connect my-signal (qt:get-slot widget "setChecked(bool)"))
@@ -48,7 +48,7 @@
(5am:test (emit-qstring-signal :depends-on (and qstring with-app))
"Emits a signal with a C++ QString argument to a C++ slot."
- (qt:with-app
+ (qt:with-app ()
(let ((my-signal (qt:make-signal))
(widget (make-instance 'qt:widget)))
(qt:connect my-signal (qt:get-slot widget "setWindowTitle(QString)"))
@@ -126,52 +126,52 @@
(5am:test int-signal
"Receive a int signal."
- (qt:with-app
- (let ((spin-box (make-instance 'qt:spin-box))
- (current-value)
- (current-string-value))
- (qt:connect (qt:get-signal spin-box "valueChanged(int)")
- #'(lambda (value)
- (setf current-value value)))
- (qt:connect (qt:get-signal spin-box "valueChanged(const QString&)")
- #'(lambda (value)
- (setf current-string-value value)))
- (5am:for-all ((value (5am:gen-integer
- :min (cxx:minimum spin-box)
- :max (cxx:maximum spin-box))))
- (cxx:set-value spin-box value)
- (5am:is (= value current-value))
- (5am:is (= value (read-from-string current-string-value)))))))
+ (qt:with-app ()
+ (let ((spin-box (make-instance 'qt:spin-box))
+ (current-value)
+ (current-string-value))
+ (qt:connect (qt:get-signal spin-box "valueChanged(int)")
+ #'(lambda (value)
+ (setf current-value value)))
+ (qt:connect (qt:get-signal spin-box "valueChanged(const QString&)")
+ #'(lambda (value)
+ (setf current-string-value value)))
+ (5am:for-all ((value (5am:gen-integer
+ :min (cxx:minimum spin-box)
+ :max (cxx:maximum spin-box))))
+ (cxx:set-value spin-box value)
+ (5am:is (= value current-value))
+ (5am:is (= value (read-from-string current-string-value)))))))
(5am:test object-signal
"Receive a qt:object pointer signal."
- (qt:with-app
- (let ((button (make-instance 'qt:push-button))
- (click-count 0)
- (signal-mapper (make-instance 'qt:signal-mapper)))
- (qt:connect (qt:get-signal button "clicked()")
- (qt:get-slot signal-mapper "map()"))
- (cxx:set-mapping signal-mapper button button)
-
- (qt:connect (qt:get-signal signal-mapper "mapped(QObject*)")
- #'(lambda (object)
- (5am:is (eq button object))
- (incf click-count)))
- (5am:is (= 0 click-count))
- (qt:test.mouse-click button qt:+left-button+)
- (5am:is (= 1 click-count)))))
+ (qt:with-app ()
+ (let ((button (make-instance 'qt:push-button))
+ (click-count 0)
+ (signal-mapper (make-instance 'qt:signal-mapper)))
+ (qt:connect (qt:get-signal button "clicked()")
+ (qt:get-slot signal-mapper "map()"))
+ (cxx:set-mapping signal-mapper button button)
+
+ (qt:connect (qt:get-signal signal-mapper "mapped(QObject*)")
+ #'(lambda (object)
+ (5am:is (eq button object))
+ (incf click-count)))
+ (5am:is (= 0 click-count))
+ (qt: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
+ (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 end))
+ (declare (ignore end))
(5am:is (cxx:= (cxx:parent (cxx:index model start)))
- parent)
+ parent)
(incf count)))
(5am:is (= 0 count))
(cxx:insert-rows model 0 1)
@@ -181,13 +181,13 @@
(5am:test (emit-user-conversion :depends-on emit-qstring-signal)
"Emit a signal with a user conversion of the argument."
- (qt:with-app
- (let ((combobox (make-instance 'qt:text-edit))
- (set-font (qt:make-signal)))
- (qt:connect set-font
- (qt:get-slot combobox "setCurrentFont(QFont)"))
- (5am:is (cxx:operator== (cxx:current-font combobox)
- (make-instance 'qt:font)))
- (funcall set-font "Times")
- (5am:is (cxx:operator== (cxx:current-font combobox)
- "Times")))))
+ (qt:with-app ()
+ (let ((combobox (make-instance 'qt:text-edit))
+ (set-font (qt:make-signal)))
+ (qt:connect set-font
+ (qt:get-slot combobox "setCurrentFont(QFont)"))
+ (5am:is (cxx:operator== (cxx:current-font combobox)
+ (make-instance 'qt:font)))
+ (funcall set-font "Times")
+ (5am:is (cxx:operator== (cxx:current-font combobox)
+ "Times")))))
diff -rN -u old-qt.tests/src/undo.lisp new-qt.tests/src/undo.lisp
--- old-qt.tests/src/undo.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/undo.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -4,10 +4,9 @@
(defclass reversible-incf (qt:undo-command)
((place :accessor place
- :initarg :place))
+ :initarg :place))
(:metaclass cxx:class))
-
(defmethod cxx:redo ((incf reversible-incf))
(incf (symbol-value (place incf))))
@@ -15,20 +14,20 @@
(decf (symbol-value (place incf))))
(5am:test undo-stack
- "Test ownership transfer of a undo-command to the undo-stack."
- (let ((undo-stack (make-instance 'qt:undo-stack))
- (iterations 10)
- (counter 0))
- (declare (special counter))
- (dotimes (i iterations)
- (cxx:push undo-stack
- (make-instance 'reversible-incf :place 'counter))
- (gc :full t)) ;; Test for faulty ownership transfer
- (5am:is (eq t (cxx:can-undo undo-stack)))
- (5am:is (= iterations counter))
-
- (dotimes (i iterations)
- (cxx:undo undo-stack))
- (5am:is (eq nil (cxx:can-undo undo-stack)))
- (5am:is (= 0 counter))))
+ "Test ownership transfer of a undo-command to the undo-stack."
+ (let ((undo-stack (make-instance 'qt:undo-stack))
+ (iterations 10)
+ (counter 0))
+ (declare (special counter))
+ (dotimes (i iterations)
+ (cxx:push undo-stack
+ (make-instance 'reversible-incf :place 'counter))
+ (gc :full t)) ;; Test for faulty ownership transfer
+ (5am:is (eq t (cxx:can-undo undo-stack)))
+ (5am:is (= iterations counter))
+
+ (dotimes (i iterations)
+ (cxx:undo undo-stack))
+ (5am:is (eq nil (cxx:can-undo undo-stack)))
+ (5am:is (= 0 counter))))
diff -rN -u old-qt.tests/src/variant.lisp new-qt.tests/src/variant.lisp
--- old-qt.tests/src/variant.lisp 2014-10-30 07:02:50.000000000 +0100
+++ new-qt.tests/src/variant.lisp 2014-10-30 07:02:50.000000000 +0100
@@ -4,9 +4,9 @@
(5am:test (variant-string :depends-on qstring)
"Test qt:variant <-> string conversion."
-; (5am:for-all ((string (5am:gen-string)))
+ ;; (5am:for-all ((string (5am:gen-string)))
(5am:for-all ((string (5am:gen-one-element "foo"
- "Foo Bar")))
+ "Foo Bar")))
(5am:is (eq t (cxx:= string (qt:make-variant string))))
(5am:is (string= string (qt:value (qt:make-variant string))))))