/ src /
/src/application.lisp
1 (in-package :qt.tests)
2
3 (5am:in-suite :qt.suite)
4
5 (5am:test with-app
6 "Tests qt:with-app and qt:with-core-app"
7 (let ((nested (qt:app-p)))
8 (5am:for-all ((core-p (5am:gen-one-element nil t)))
9 (unless nested
10 (5am:is (eql nil (qt:app-p))))
11 (if core-p
12 (qt:with-core-app ()
13 (5am:is (eql t (qt:app-p)))
14 (5am:is (string= "QCoreApplication"
15 (cxx:class-name (cxx:meta-object (qt:app)))))
16 (setf (cxx:object-name (qt:app)) "core-app")) ;; test for memfault
17 (qt:with-app ()
18 (5am:is (eql t (qt:app-p)))
19 (5am:is (string= "QApplication"
20 (cxx:class-name (cxx:meta-object (qt:app)))))
21 (setf (cxx:object-name (qt:app)) "app")))
22 (unless nested
23 (5am:is (eql nil (qt:app-p)))))))
24
25 (5am:test application-nest
26 "Test qt:with-core-app nesting."
27 (qt:with-core-app ()
28 (5am:is (eql (qt:app) (qt:core-application.instance)))
29 (qt:with-core-app ()
30 (5am:is (eql (qt:app) (qt:core-application.instance))))
31 (5am:is (eql (qt:app) (qt:core-application.instance)))))
32
33 (5am:test application-widgetlist
34 "Test cxx:all-widgets"
35 (qt:with-app ()
36 (5am:is (= 0 (length (cxx:all-widgets (qt:app)))))
37 (let ((w (make-instance 'qt:widget)))
38 (5am:is (find w (cxx:all-widgets (qt:app)))))))