| 1 | |
| 2 | // SPDX-FileCopyrightText: (C) 2020 James Turner |
| 3 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | |
| 5 | #include "testGC.hxx" |
| 6 | |
| 7 | #include "test_suite/FGTestApi/testGlobals.hxx" |
| 8 | |
| 9 | #include <Main/globals.hxx> |
| 10 | #include <Main/util.hxx> |
| 11 | #include <Scripting/NasalSys.hxx> |
| 12 | |
| 13 | #include <Main/FGInterpolator.hxx> |
| 14 | |
| 15 | extern bool global_nasalMinimalInit; |
| 16 | |
| 17 | // Set up function for each test. |
| 18 | void NasalGCTests::setUp() |
| 19 | { |
| 20 | FGTestApi::setUp::initTestGlobals("NasalGC"); |
| 21 | |
| 22 | fgInitAllowedPaths(); |
| 23 | auto nasalNode = globals->get_props()->getNode("nasal", true); |
| 24 | |
| 25 | globals->get_subsystem_mgr()->add<FGInterpolator>(); |
| 26 | |
| 27 | globals->get_subsystem_mgr()->bind(); |
| 28 | globals->get_subsystem_mgr()->init(); |
| 29 | |
| 30 | global_nasalMinimalInit = true; |
| 31 | globals->get_subsystem_mgr()->add<FGNasalSys>(); |
| 32 | |
| 33 | globals->get_subsystem_mgr()->postinit(); |
| 34 | } |
| 35 | |
| 36 | |
| 37 | // Clean up after each test. |
| 38 | void NasalGCTests::tearDown() |
| 39 | { |
| 40 | global_nasalMinimalInit = false; |
| 41 | FGTestApi::tearDown::shutdownTestGlobals(); |
| 42 | } |
| 43 | |
| 44 | |
| 45 | // Test test |
| 46 | void NasalGCTests::testDummy() |
| 47 | { |
| 48 | bool ok = FGTestApi::executeNasal(R"( |
| 49 | var foo = { |
| 50 | "name": "PFD-Test", |
| 51 | "size": [512, 512], |
| 52 | "view": [768, 1024], |
| 53 | "mipmapping": 1 |
| 54 | }; |
| 55 | |
| 56 | globals.foo1 = foo; |
| 57 | )"); |
| 58 | CPPUNIT_ASSERT(ok); |
| 59 | } |