@@ -3,6 +3,67 @@ describe("TestImportReimport", function()
33 newBuild ()
44 end )
55
6+ local function reimportSingleSocketedGem (itemTypeLine , inventoryId , gemName )
7+ build .importTab .controls .charImportItemsClearSkills .state = true
8+ build .importTab .controls .charImportItemsClearItems .state = false
9+ build .importTab :ImportItemsAndSkills (string.format ([=[
10+ {
11+ "character": {
12+ "level": 12
13+ },
14+ "items": [
15+ {
16+ "id": "item-1",
17+ "frameType": 0,
18+ "name": "",
19+ "typeLine": "%s",
20+ "inventoryId": "%s",
21+ "ilvl": 10,
22+ "properties": [],
23+ "sockets": [
24+ { "group": 0, "sColour": "R" }
25+ ],
26+ "socketedItems": [
27+ {
28+ "socket": 0,
29+ "support": false,
30+ "typeLine": "%s",
31+ "properties": [
32+ { "name": "Level", "values": [["20", 0]] },
33+ { "name": "Quality", "values": [["+0%%", 0]] }
34+ ]
35+ }
36+ ]
37+ }
38+ ]
39+ }
40+ ]=] , itemTypeLine , inventoryId , gemName ))
41+ runCallback (" OnFrame" )
42+ end
43+
44+ local function assertReimportPreservesSkillSubstate (slotName , itemTypeLine , inventoryId , gemName , fieldName , fieldValue )
45+ build .skillsTab :PasteSocketGroup (string.format ([[
46+ Slot: %s
47+ %s 20/0 Default 1
48+ ]] , slotName , gemName ))
49+ runCallback (" OnFrame" )
50+
51+ local socketGroup = build .skillsTab .socketGroupList [1 ]
52+ local srcInstance = socketGroup .displaySkillList [1 ].activeEffect .srcInstance
53+ srcInstance [fieldName ] = fieldValue
54+ srcInstance [fieldName .. " Calcs" ] = fieldValue
55+ build .modFlag = true
56+ build .buildFlag = true
57+ runCallback (" OnFrame" )
58+
59+ reimportSingleSocketedGem (itemTypeLine , inventoryId , gemName )
60+
61+ socketGroup = build .skillsTab .socketGroupList [1 ]
62+ srcInstance = socketGroup .displaySkillList [1 ].activeEffect .srcInstance
63+ assert .are .equal (fieldValue , srcInstance [fieldName ])
64+ assert .are .equal (fieldValue , srcInstance [fieldName .. " Calcs" ])
65+ end
66+
667 it (" preserves full DPS state and manually disabled gems when reimporting items and skills" , function ()
768 build .skillsTab :PasteSocketGroup ([[
869Slot: Helmet
@@ -80,4 +141,16 @@ Added Fire Damage 1/0 Default DISABLED 1
80141 assert .are .equal (2 , socketGroup .gemList [3 ].level )
81142 assert .is_false (socketGroup .gemList [3 ].enabled )
82143 end )
144+
145+ it (" preserves skill part selection when reimporting items and skills" , function ()
146+ assertReimportPreservesSkillSubstate (" Helmet" , " Iron Hat" , " Helm" , " Blight" , " skillPart" , 2 )
147+ end )
148+
149+ it (" preserves stage count when reimporting items and skills" , function ()
150+ assertReimportPreservesSkillSubstate (" Weapon 1" , " Driftwood Wand" , " Weapon" , " Scorching Ray" , " skillStageCount" , 8 )
151+ end )
152+
153+ it (" preserves mine count when reimporting items and skills" , function ()
154+ assertReimportPreservesSkillSubstate (" Gloves" , " Rawhide Gloves" , " Gloves" , " Pyroclast Mine" , " skillMineCount" , 12 )
155+ end )
83156end )
0 commit comments