From 8073c598986b5d589aa7693623d3a4bb19e22214 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Thu, 14 Aug 2025 14:19:20 +0200 Subject: [PATCH] Add integration tests --- .../data/integration_tests/test_lua_api/global.lua | 1 + scripts/data/morrowind_tests/global.lua | 1 + scripts/data/morrowind_tests/global_regions.lua | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 scripts/data/morrowind_tests/global_regions.lua diff --git a/scripts/data/integration_tests/test_lua_api/global.lua b/scripts/data/integration_tests/test_lua_api/global.lua index 2bdf765c91..e231e009e9 100644 --- a/scripts/data/integration_tests/test_lua_api/global.lua +++ b/scripts/data/integration_tests/test_lua_api/global.lua @@ -137,6 +137,7 @@ testing.registerGlobalTest('record stores', function() testRecordStore(core.sound, "sound") testRecordStore(core.factions, "factions") + testRecordStore(core.regions, "regions") testRecordStore(core.dialogue.greeting, "dialogue greeting") testRecordStore(core.dialogue.topic, "dialogue topic") testRecordStore(core.dialogue.journal, "dialogue journal") diff --git a/scripts/data/morrowind_tests/global.lua b/scripts/data/morrowind_tests/global.lua index f17e72cda9..4e4974c727 100644 --- a/scripts/data/morrowind_tests/global.lua +++ b/scripts/data/morrowind_tests/global.lua @@ -11,6 +11,7 @@ end require('global_issues') require('global_dialogues') require('global_mwscript') +require('global_regions') return { engineHandlers = { diff --git a/scripts/data/morrowind_tests/global_regions.lua b/scripts/data/morrowind_tests/global_regions.lua new file mode 100644 index 0000000000..970fdd0253 --- /dev/null +++ b/scripts/data/morrowind_tests/global_regions.lua @@ -0,0 +1,13 @@ +local testing = require('testing_util') +local core = require('openmw.core') +local util = require('openmw.util') + +testing.registerGlobalTest('[regions] Should expose Bitter Coast', function() + local record = core.regions.records['bitter coast region'] + testing.expect(record ~= nil, 'Bitter Coast Region to exist') + testing.expectEqual(record.mapColor, util.color.hex('2227FF')) + for id, probability in pairs(record.weatherProbabilities) do + testing.expect(core.weather.records[id] ~= nil, 'weather ' .. id .. 'to exist') + end + testing.expectEqual(record.weatherProbabilities.cloudy, 60, 'cloudy weather to occur 60% of the time') +end)