AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AuraScriptProcTestFixture Class Reference

Base fixture for AuraScript proc testing. More...

#include "AuraScriptTestFramework.h"

Inheritance diagram for AuraScriptProcTestFixture:
ArcanePotencyProcTest SpellProcIntegrationTest SpellProcSpellTypeMaskTest

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
ProcTestContextContext ()
 
SpellInfoCreateSpellInfo (uint32_t id, uint32_t familyName=0, uint32_t familyFlags0=0, uint32_t familyFlags1=0, uint32_t familyFlags2=0)
 
SpellProcEntry CreateProcEntry ()
 
ProcEventInfo CreateEventInfo (uint32_t typeMask, uint32_t hitMask, uint32_t spellTypeMask=PROC_SPELL_TYPE_MASK_ALL, uint32_t spellPhaseMask=PROC_SPELL_PHASE_HIT)
 
bool TestCanProc (SpellProcEntry const &procEntry, uint32_t typeMask, uint32_t hitMask, SpellInfo const *triggerSpell=nullptr)
 
bool TestSpellFamilyMatch (uint32_t procFamilyName, flag96 const &procFamilyMask, SpellInfo const *triggerSpell)
 

Private Attributes

std::unique_ptr< ProcTestContext_context
 
std::vector< SpellInfo * > _spellInfos
 

Detailed Description

Base fixture for AuraScript proc testing.

This provides infrastructure for testing proc behavior at the unit level without requiring full game objects.

Member Function Documentation

◆ Context()

ProcTestContext & AuraScriptProcTestFixture::Context ( )
inlineprotected
161{ return *_context; }
std::unique_ptr< ProcTestContext > _context
Definition AuraScriptTestFramework.h:241

References _context.

◆ CreateEventInfo()

ProcEventInfo AuraScriptProcTestFixture::CreateEventInfo ( uint32_t  typeMask,
uint32_t  hitMask,
uint32_t  spellTypeMask = PROC_SPELL_TYPE_MASK_ALL,
uint32_t  spellPhaseMask = PROC_SPELL_PHASE_HIT 
)
inlineprotected
187 {
188 return ProcEventInfoBuilder()
189 .WithTypeMask(typeMask)
190 .WithHitMask(hitMask)
192 .WithSpellPhaseMask(spellPhaseMask)
193 .Build();
194 }
static uint32 spellTypeMask[TOTAL_AURAS]
Definition SpellMgr.cpp:1819
Builder class for creating ProcEventInfo test instances.
Definition ProcEventInfoHelper.h:31
ProcEventInfoBuilder & WithSpellPhaseMask(uint32 spellPhaseMask)
Definition ProcEventInfoHelper.h:69
ProcEventInfoBuilder & WithTypeMask(uint32 typeMask)
Definition ProcEventInfoHelper.h:57
ProcEventInfoBuilder & WithHitMask(uint32 hitMask)
Definition ProcEventInfoHelper.h:75
ProcEventInfo Build()
Definition ProcEventInfoHelper.h:111
ProcEventInfoBuilder & WithSpellTypeMask(uint32 spellTypeMask)
Definition ProcEventInfoHelper.h:63

References ProcEventInfoBuilder::Build(), spellTypeMask, ProcEventInfoBuilder::WithHitMask(), ProcEventInfoBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ CreateProcEntry()

SpellProcEntry AuraScriptProcTestFixture::CreateProcEntry ( )
inlineprotected
179 {
180 return SpellProcEntryBuilder().Build();
181 }
Builder class for creating SpellProcEntry test instances.
Definition ProcEventInfoHelper.h:141
SpellProcEntry Build() const
Definition ProcEventInfoHelper.h:226

References SpellProcEntryBuilder::Build().

◆ CreateSpellInfo()

SpellInfo * AuraScriptProcTestFixture::CreateSpellInfo ( uint32_t  id,
uint32_t  familyName = 0,
uint32_t  familyFlags0 = 0,
uint32_t  familyFlags1 = 0,
uint32_t  familyFlags2 = 0 
)
inlineprotected
167 {
168 auto* spellInfo = SpellInfoBuilder()
169 .WithId(id)
170 .WithSpellFamilyName(familyName)
171 .WithSpellFamilyFlags(familyFlags0, familyFlags1, familyFlags2)
172 .Build();
173 _spellInfos.push_back(spellInfo);
174 return spellInfo;
175 }
std::vector< SpellInfo * > _spellInfos
Definition AuraScriptTestFramework.h:242
Builder class for creating SpellInfo test instances.
Definition SpellInfoTestHelper.h:160
SpellInfoBuilder & WithId(uint32 id)
Definition SpellInfoTestHelper.h:164
SpellInfoBuilder & WithSpellFamilyFlags(uint32 flag0, uint32 flag1=0, uint32 flag2=0)
Definition SpellInfoTestHelper.h:176
SpellInfo * Build()
Definition SpellInfoTestHelper.h:250
SpellInfoBuilder & WithSpellFamilyName(uint32 familyName)
Definition SpellInfoTestHelper.h:170

References _spellInfos, SpellInfoBuilder::Build(), SpellInfoBuilder::WithId(), SpellInfoBuilder::WithSpellFamilyFlags(), and SpellInfoBuilder::WithSpellFamilyName().

◆ SetUp()

void AuraScriptProcTestFixture::SetUp ( )
inlineoverrideprotected
146 {
147 _context = std::make_unique<ProcTestContext>();
148 _spellInfos.clear();
149 }

References _context, and _spellInfos.

Referenced by ArcanePotencyProcTest::SetUp(), SpellProcIntegrationTest::SetUp(), and SpellProcSpellTypeMaskTest::SetUp().

◆ TearDown()

void AuraScriptProcTestFixture::TearDown ( )
inlineoverrideprotected
152 {
153 for (auto* spellInfo : _spellInfos)
154 {
155 delete spellInfo;
156 }
157 _spellInfos.clear();
158 }

References _spellInfos.

◆ TestCanProc()

bool AuraScriptProcTestFixture::TestCanProc ( SpellProcEntry const &  procEntry,
uint32_t  typeMask,
uint32_t  hitMask,
SpellInfo const *  triggerSpell = nullptr 
)
inlineprotected
199 {
200 DamageInfo* damageInfoPtr = nullptr;
201 HealInfo* healInfoPtr = nullptr;
202
203 // Create real DamageInfo/HealInfo if we have a trigger spell
204 // Note: This requires the actual game classes, which may need adjustment
205 // For now, we use the stub approach
206
207 auto eventInfo = ProcEventInfoBuilder()
208 .WithTypeMask(typeMask)
209 .WithHitMask(hitMask)
212 .Build();
213
214 return sSpellMgr->CanSpellTriggerProcOnEvent(procEntry, eventInfo);
215 }
#define sSpellMgr
Definition SpellMgr.h:836
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:242
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:249
Definition Unit.h:336
Definition Unit.h:383

References ProcEventInfoBuilder::Build(), PROC_SPELL_PHASE_HIT, PROC_SPELL_TYPE_MASK_ALL, sSpellMgr, ProcEventInfoBuilder::WithHitMask(), ProcEventInfoBuilder::WithSpellPhaseMask(), ProcEventInfoBuilder::WithSpellTypeMask(), and ProcEventInfoBuilder::WithTypeMask().

◆ TestSpellFamilyMatch()

bool AuraScriptProcTestFixture::TestSpellFamilyMatch ( uint32_t  procFamilyName,
flag96 const &  procFamilyMask,
SpellInfo const *  triggerSpell 
)
inlineprotected
220 {
221 if (procFamilyName && triggerSpell)
222 {
223 if (procFamilyName != triggerSpell->SpellFamilyName)
224 return false;
225
226 if (procFamilyMask)
227 {
228 flag96 triggerMask;
229 triggerMask[0] = triggerSpell->SpellFamilyFlags[0];
230 triggerMask[1] = triggerSpell->SpellFamilyFlags[1];
231 triggerMask[2] = triggerSpell->SpellFamilyFlags[2];
232
233 if (!(triggerMask & procFamilyMask))
234 return false;
235 }
236 }
237 return true;
238 }
Definition Util.h:442

References SpellInfo::SpellFamilyFlags, and SpellInfo::SpellFamilyName.

Member Data Documentation

◆ _context

std::unique_ptr<ProcTestContext> AuraScriptProcTestFixture::_context
private

Referenced by Context(), and SetUp().

◆ _spellInfos

std::vector<SpellInfo*> AuraScriptProcTestFixture::_spellInfos
private

Referenced by CreateSpellInfo(), SetUp(), and TearDown().


The documentation for this class was generated from the following file: