Class: Modsvaskr::TestsSuites::Npc
- Inherits:
-
Modsvaskr::TestsSuite
- Object
- Modsvaskr::TestsSuite
- Modsvaskr::TestsSuites::Npc
- Includes:
- InGameTestsSuite
- Defined in:
- lib/modsvaskr/tests_suites/npc.rb
Overview
Test NPCs by taking screenshots
Direct Known Subclasses
Instance Method Summary collapse
-
#discover_tests ⇒ Object
Discover the list of tests information that could be run.
-
#in_game_tests_suite ⇒ Object
Return the in-game tests suite to which we forward the tests to be run.
Methods included from InGameTestsSuite
#in_game_tests_for, #parse_auto_tests_statuses_for
Methods inherited from Modsvaskr::TestsSuite
#clear_tests, #initialize, #statuses, #statuses=
Methods included from Logger
#log, #out, #wait_for_user_enter
Methods included from RunCmd
Constructor Details
This class inherits a constructor from Modsvaskr::TestsSuite
Instance Method Details
#discover_tests ⇒ Object
Discover the list of tests information that could be run.
- API
-
This method is mandatory
-
- Result
-
Hash< String, Hash<Symbol,Object> >: Ordered hash of test information, per test name
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/modsvaskr/tests_suites/npc.rb', line 25 def discover_tests tests = {} @game.xedit.run_script('DumpInfo', only_once: true) # Keep track of masters, per plugin # Hash<String, Array<String> > masters = {} # Keep track of NPCs # Array< [String, Integer, String] > # Array< [Plugin, FormID, NPC ] > npcs = [] @game.xedit.parse_csv('Modsvaskr_ExportedDumpInfo') do |row| case row[1].downcase when 'npc_' npcs << [row[0].downcase, row[2].to_i(16), row[3]] when 'tes4' masters[row[0].downcase] = row[3..].map(&:downcase) end end npcs.each do |(esp, form_id, npc_name)| raise "Esp #{esp} declares NPC FormID #{form_id} (#{npc_name}) but its masters could not be parsed" unless masters.key?(esp) # Know from which mod this ID comes from mod_idx = form_id / 16_777_216 raise "NPC FormID #{form_id} (#{npc_name}) from #{esp} references an unknown master (known masters: #{masters[esp].join(', ')})" if mod_idx > masters[esp].size test_name = "#{mod_idx == masters[esp].size ? esp : masters[esp][mod_idx]}/#{form_id % 16_777_216}" if tests.key?(test_name) # Add the name of the mod to the description, so that we know which mod modifies which NPC. tests[test_name][:name] << "/#{esp}" else tests[test_name] = { name: "Take screenshot of #{npc_name} - #{esp}" } end end tests end |
#in_game_tests_suite ⇒ Object
Return the in-game tests suite to which we forward the tests to be run
- Result
-
Symbol: In-game tests suite
16 17 18 |
# File 'lib/modsvaskr/tests_suites/npc.rb', line 16 def in_game_tests_suite :npcs end |