repos
/
qt.tests
/ annotate_shade
summary
|
shortlog
|
log
|
tree
|
commit
|
commitdiff
|
headdiff
|
annotate
|
headblob
|
headfilediff
|
filehistory
normal
|
plain
|
shade
|
zebra
Test Lisp to QList<QVariant> and test user conversion sequence for return values.
Annotate for file /src/overload.lisp
2009-04-02 tobias
1
(in-package :qt.tests)
22:17:02 '
2
'
3
(5am:in-suite :qt.suite)
'
4
'
5
(defclass my-object (qt:object)
'
6
((counter :accessor counter :initform 0))
2009-05-31 tobias
7
(:metaclass cxx:class))
2009-04-02 tobias
8
2009-05-31 tobias
9
(defmethod cxx:timer-event ((object my-object) event)
22:56:59 '
10
(incf (counter object))
'
11
(cxx:quit (qt:app)))
2009-04-02 tobias
12
2009-05-31 tobias
13
(5am:test timer
2009-04-02 tobias
14
(let ((object (make-instance 'my-object)))
2009-07-01 tobias
15
(qt:with-core-app ()
2009-05-31 tobias
16
(5am:is (= 0 (counter object)))
22:56:59 '
17
(cxx:start-timer object 0)
'
18
(with-timeout (5)
'
19
(qt:exec))
'
20
(5am:is (= 1 (counter object))))))
2009-05-31 tobias
21
(defclass my-list-model (qt:abstract-list-model)
17:37:47 '
22
((counter :accessor counter :initform 0))
'
23
(:metaclass cxx:class))
'
24
'
25
(defmethod cxx:data ((list my-list-model) index role)
'
26
(incf (counter list))
'
27
(if (< (cxx:row index) 2)
2009-09-02 tobias
28
(cxx:row index) ;; cl-smoke converts to the required qt:variant
2009-05-31 tobias
29
(qt:make-variant)))
17:37:47 '
30
'
31
(defmethod cxx:row-count ((list my-list-model) parent)
'
32
2)
'
33
'
34
(5am:test return-on-stack
'
35
"Test virtual method return value on stack."
'
36
(let ((list (make-instance 'my-list-model))
'
37
(proxy (make-instance 'qt:sort-filter-proxy-model)))
'
38
(5am:is (= 0 (counter list)))
'
39
(setf (cxx:source-model proxy) list)
'
40
(dotimes (i 10) ;; test for faulty ownership transfer
'
41
(cxx:sort proxy 0)
'
42
(gc :full t))
'
43
(5am:is (< 0 (counter list)))))
'
44
'
45
(5am:test return-on-stack-c++
'
46
(let ((list (make-instance
'
47
'qt:string-list-model :args (list #("foo" "bar"))))
'
48
(proxy (make-instance 'qt:sort-filter-proxy-model)))
'
49
(setf (cxx:source-model proxy) list)
'
50
(dotimes (i 10) ;; test for faulty ownership transfer
'
51
(cxx:sort proxy 0)
'
52
(gc :full t))
'
53
(5am:is (= 2 (cxx:row-count list)))))
'
54