From 3bc1f9e62976e758624ac793dd3c9cb18f77d383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20A=2E=20Gomes?= Date: Tue, 20 Dec 2022 22:17:41 +0200 Subject: [PATCH] tests/offline/start: Add tests. --- nyxt.asd | 1 + tests/offline/start.lisp | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/offline/start.lisp diff --git a/nyxt.asd b/nyxt.asd index ceae8b35dc3..acdfc34eda0 100644 --- a/nyxt.asd +++ b/nyxt.asd @@ -297,6 +297,7 @@ The renderer is configured from NYXT_RENDERER or `*nyxt-renderer*'.")) :targets (:package :nyxt/tests) :serial t :components ((:file "tests/package") + (:file "tests/offline/start") (:file "tests/offline/define-configuration") (:file "tests/offline/global-history") (:file "tests/offline/user-script-parsing") diff --git a/tests/offline/start.lisp b/tests/offline/start.lisp new file mode 100644 index 00000000000..4c0da5306c7 --- /dev/null +++ b/tests/offline/start.lisp @@ -0,0 +1,35 @@ +;;;; SPDX-FileCopyrightText: Atlas Engineer LLC +;;;; SPDX-License-Identifier: BSD-3-Clause + +(in-package :nyxt/tests) + +(define-class dummy-renderer (renderer) + ((name "Dummy renderer")) + (:export-class-name-p t) + (:export-accessor-names-p t) + (:accessor-name-transformer (class*:make-name-transformer name))) + +(defmethod install ((_ dummy-renderer)) t) + +(defmethod uninstall ((_ dummy-renderer)) t) + +(setf nyxt::*renderer* (make-instance 'dummy-renderer)) + +(define-test null-quit () + (assert-false (nyxt:quit))) + +(define-test start-quit () + (assert-false (progn (nyxt:start) (nyxt:quit)))) + +(define-test stateless-headless-argument () + (nyxt:start :headless t :failsafe t) + (ffi-within-renderer-thread + nyxt:*browser* + (lambda () (assert-true nyxt::*headless-p*))) + (nyxt:quit) + + (nyxt:start :failsafe t) + (ffi-within-renderer-thread + nyxt:*browser* + (lambda () (assert-false nyxt::*headless-p*))) + (nyxt:quit))