@@ -95,6 +95,15 @@ class XmlGeneratorTest: public testing::Test
95
95
static csVector3 worldVelocity;
96
96
static float ang_velocity;
97
97
98
+ // combat message
99
+ static int combatEventType;
100
+ static EID attacker;
101
+ static EID target;
8000
code>
102
+ static int targetLocation;
103
+ static float damage;
104
+ static int attackAnimation;
105
+ static int defenseAnimation;
106
+
98
107
protected:
99
108
// no set up yet
100
109
@@ -358,6 +367,23 @@ class XmlGeneratorTest: public testing::Test
358
367
359
368
xml.append (getCloseTag (PsaiXmlConstants::TYPE_DR_MESSAGE));
360
369
xml.append (getXmlStringMessageEnd ());
370
+
371
+ return xml;
372
+ }
373
+
374
+ String getExpectedXmlForCombatEventMessage ()
375
+ {
376
+ String xml = getXmlStringStartForMessageType (PsaiXmlConstants::MSGTYPE_COMBATEVENT);
377
+ xml.append (getOpenTag (PsaiXmlConstants::TYPE_COMBAT_MESSAGE));
378
+ xml.append (getTextTag (PsaiXmlConstants::ELEMENT_COMBAT_ATTACKER_ID, attacker.Unbox ()));
379
+ xml.append (getTextTag (PsaiXmlConstants::ELEMENT_COMBAT_DAMAGE, damage));
380
+ xml.append (getTextTag (PsaiXmlConstants::ELEMENT_COMBAT_TARGET_ID, target.Unbox ()));
381
+ xml.append (getTextTag (PsaiXmlConstants::ELEMENT_COMBAT_TARGET_LOCATION, targetLocation));
382
+ xml.append (getTextTag (PsaiXmlConstants::ELEMENT_CLIENT_NUM, getStringUtils ().convertToString (defaultClientNum)));
383
+ xml.append (getCloseTag (PsaiXmlConstants::TYPE_COMBAT_MESSAGE));
384
+ xml.append (getXmlStringMessageEnd ());
385
+
386
+ return xml;
361
387
}
362
388
};
363
389
@@ -416,6 +442,15 @@ csVector3 XmlGeneratorTest::velocity(45.0, 92.0, 0.0);
416
442
csVector3 XmlGeneratorTest::worldVelocity (1.0 , 1.0 , 1.0 );
417
443
float XmlGeneratorTest::ang_velocity = 78.3 ;
418
444
445
+ // Combat message
446
+ int XmlGeneratorTest::combatEventType = 10 ;
447
+ EID XmlGeneratorTest::attacker (15 );
448
+ EID XmlGeneratorTest::target (20 );
449
+ int XmlGeneratorTest::targetLocation = 5 ;
450
+ float XmlGeneratorTest::damage = 34.5 ;
451
+ int XmlGeneratorTest::attackAnimation = 6 ;
452
+ int XmlGeneratorTest::defenseAnimation = 7 ;
453
+
419
454
// Test Fixtures
420
455
TEST_F (XmlGeneratorTest, testChatMessageToXml)
421
456
{
@@ -544,133 +579,145 @@ TEST_F(XmlGeneratorTest, DISABLED_testDeadReckoningMessageToXml)
544
579
ASSERT_STREQ (getExpectedXmlForDeadReckoningMessage ().c_str (), msgXml.c_str ());
545
580
}
546
581
547
- TEST_F (XmlGeneratorTest, testStatDeadReckoningMessageToXml)
582
+ // DR messages all seem to have problems being created without the required setup. Is there a C++ mock library?
583
+ TEST_F (XmlGeneratorTest, DISABLED_testStatDeadReckoningMessageToXml)
548
584
{
549
- FAIL () << " Not Implemented Yet" ;
585
+ FAIL () << " Not Implemented Yet" ;
550
586
}
551
587
552
588
TEST_F (XmlGeneratorTest, testCombatEventMessageToXml)
553
589
{
554
- FAIL () << " Not Implemented Yet" ;
590
+
591
+ psCombatEventMessage msg (defaultClientNum, combatEventType, attacker, target, targetLocation, damage, attackAnimation, defenseAnimation);
592
+ msg.attack_anim = attackAnimation;
593
+ msg.attacker_id = attacker;
594
+ msg.damage = damage;
595
+ msg.defense_anim = defenseAnimation;
596
+ msg.target_id = target;
597
+ msg.target_location = targetLocation;
598
+
599
+ String xmlString = getGenerator ().toXml (msg);
600
+ ASSERT_STREQ (getExpectedXmlForCombatEventMessage ().c_str (), xmlString.c_str ());
601
+
555
602
}
556
603
557
604
TEST_F (XmlGeneratorTest, testModeMessageToXml)
558
605
{
559
- FAIL () << " Not Implemented Yet" ;
606
+ FAIL () << " Not Implemented Yet" ;
560
607
}
561
608
562
609
TEST_F (XmlGeneratorTest, testMoveLockMessageToXml)
563
610
{
564
- FAIL () << " Not Implemented Yet" ;
611
+ FAIL () << " Not Implemented Yet" ;
565
612
}
566
613
567
614
TEST_F (XmlGeneratorTest, testNewSectorMessageToXml)
568
615
{
569
- FAIL () << " Not Implemented Yet" ;
616
+ FAIL () << " Not Implemented Yet" ;
570
617
}
571
618
572
619
TEST_F (XmlGeneratorTest, testEffectMessageToXml)
573
620
{
574
- FAIL () << " Not Implemented Yet" ;
621
+ FAIL () << " Not Implemented Yet" ;
575
622
}
576
623
577
624
TEST_F (XmlGeneratorTest, testStopEffectMessageToXml)
578
625
{
579
- FAIL () << " Not Implemented Yet" ;
626
+ FAIL () << " Not Implemented Yet" ;
580
627
}
581
628
582
629
TEST_F (XmlGeneratorTest, testSpellCastMessageToXml)
583
630
{
584
- FAIL () << " Not Implemented Yet" ;
631
+ FAIL () << " Not Implemented Yet" ;
585
632
}
586
633
587
634
TEST_F (XmlGeneratorTest, testSpellCancelMessageToXml)
588
635
{
589
- FAIL () << " Not Implemented Yet" ;
636
+ FAIL () << " Not Implemented Yet" ;
590
637
}
591
638
592
639
TEST_F (XmlGeneratorTest, testStatsMessageToXml)
593
640
{
594
- FAIL () << " Not Implemented Yet" ;
641
+ FAIL () << " Not Implemented Yet" ;
595
642
}
596
643
597
644
TEST_F (XmlGeneratorTest, testSystemMessageToXml)
598
645
{
599
- FAIL () << " Not Implemented Yet" ;
646
+ FAIL () << " Not Implemented Yet" ;
600
647
}
601
648
602
649
TEST_F (XmlGeneratorTest, testWeatherMessageToXml)
603
650
{
604
- FAIL () << " Not Implemented Yet" ;
651
+ FAIL () << " Not Implemented Yet" ;
605
652
}
606
653
607
654
TEST_F (XmlGeneratorTest, testCharacterDetailMessageToXml)
608
655
{
609
- FAIL () << " Not Implemented Yet" ;
656
+ FAIL () << " Not Implemented Yet" ;
610
657
}
611
658
612
659
TEST_F (XmlGeneratorTest, testGuiInventoryMessageToXml)
613
660
{
614
- FAIL () << " Not Implemented Yet" ;
661
+ FAIL () << " Not Implemented Yet" ;
615
662
}
616
663
617
664
TEST_F (XmlGeneratorTest, testGuiActiveMagicMessageToXml)
618
665
{
619
- FAIL () << " Not Implemented Yet" ;
666
+ FAIL () << " Not Implemented Yet" ;
620
667
}
621
668
622
669
TEST_F (XmlGeneratorTest, testGuiInteractMessageToXml)
623
670
{
624
- FAIL () << " Not Implemented Yet" ;
671
+ FAIL () << " Not Implemented Yet" ;
625
672
}
626
673
627
674
TEST_F (XmlGeneratorTest, testGuiMerchantMessageToXml)
628
675
{
629
- FAIL () << " Not Implemented Yet" ;
676
+ FAIL () << " Not Implemented Yet" ;
630
677
}
631
678
632
679
TEST_F (XmlGeneratorTest, testGuiSkillMessageToXml)
633
680
{
634
- FAIL () << " Not Implemented Yet" ;
681
+ FAIL () << " Not Implemented Yet" ;
635
682
}
636
683
637
684
TEST_F (XmlGeneratorTest, testGuiTargetUpdateMessageToXml)
638
685
{
639
- FAIL () << " Not Implemented Yet" ;
686
+ FAIL () << " Not Implemented Yet" ;
640
687
}
641
688
642
689
TEST_F (XmlGeneratorTest, testLootMessageToXml)
643
690
{
644
- FAIL () << " Not Implemented Yet" ;
691
+ FAIL () << " Not Implemented Yet" ;
645
692
}
646
693
647
694
TEST_F (XmlGeneratorTest, testQuestListMessageToXml)
648
695
{
649
- FAIL () << " Not Implemented Yet" ;
696
+ FAIL () << " Not Implemented Yet" ;
650
697
}
651
698
652
699
TEST_F (XmlGeneratorTest, testQuestRewardMessageToXml)
653
700
{
654
- FAIL () << " Not Implemented Yet" ;
701
+ FAIL () << " Not Implemented Yet" ;
655
702
}
656
703
657
704
TEST_F (XmlGeneratorTest, testUpdateObjectNameMessageToXml)
658
705
{
659
- FAIL () << " Not Implemented Yet" ;
706
+ FAIL () << " Not Implemented Yet" ;
660
707
}
661
708
662
709
TEST_F (XmlGeneratorTest, testViewItemDescriptionMessageToXml)
663
710
{
664
- FAIL () << " Not Implemented Yet" ;
711
+ FAIL () << " Not Implemented Yet" ;
665
712
}
666
713
667
714
TEST_F (XmlGeneratorTest, testViewItemUpdateMessageToXml)
668
715
{
669
- FAIL () << " Not Implemented Yet" ;
716
+ FAIL () << " Not Implemented Yet" ;
670
717
}
671
718
672
719
TEST_F (XmlGeneratorTest, testEquipmentMessageToXml)
673
720
{
674
- FAIL () << " Not Implemented Yet" ;
721
+ FAIL () << " Not Implemented Yet" ;
675
722
}
676
723
0 commit comments