From 6dd3d36c4552565756dcedab2ddd44e90a553252 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 19 Jun 2008 02:06:10 +0000 Subject: [FIX] Validation works in Pokémodr [FIX] Macros moved to their own file [FIX] Macros for subclasses added [FIX] Key shortcuts added to context menu items [FIX] Rules had a redundant field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@212 6ecfd1a5-f3ed-3746-8530-beee90d26b22 --- pokemod/CoinList.cpp | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) (limited to 'pokemod/CoinList.cpp') diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index 336b2126..04ae14b9 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "CoinListObject.h" +#include "Macros.h" #include "Pokemod.h" // Qt includes @@ -57,6 +58,7 @@ Pokemod::CoinList::~CoinList() void Pokemod::CoinList::validate() { + TEST_BEGIN(); if (m_name.isEmpty()) emit(error("Name is empty")); if (!objectCount()) @@ -64,25 +66,37 @@ void Pokemod::CoinList::validate() QSet idChecker; QSet itemChecker; QSet speciesChecker; - foreach (CoinListObject* object, m_objects) - { - object->validate(); - if (idChecker.contains(object->id())) - emit(error(subclass("object", object->id()))); - idChecker.insert(object->id()); + TEST_SUB_BEGIN(CoinListObject, objects); + TEST_SUB("object", id); if (object->type() == CoinListObject::Item) { - if (itemChecker.contains(object->object())) - emit(error(subclass("object item", object->id()))); - itemChecker.insert(object->object()); + TEST_SUB_RAW(item, "object item", object); } else if (object->type() == CoinListObject::Species) { - if (speciesChecker.contains(object->object())) - emit(error(subclass("object species", object->id()))); - speciesChecker.insert(object->object()); + TEST_SUB_RAW(species, "object species", object); } - } + TEST_SUB_END(); +// foreach (CoinListObject* object, m_objects) +// { +// object->validate(); +// if (idChecker.contains(object->id())) +// emit(error(subclass("object", object->id()))); +// idChecker.insert(object->id()); +// if (object->type() == CoinListObject::Item) +// { +// if (itemChecker.contains(object->object())) +// emit(error(subclass("object item", object->id()))); +// itemChecker.insert(object->object()); +// } +// else if (object->type() == CoinListObject::Species) +// { +// if (speciesChecker.contains(object->object())) +// emit(error(subclass("object species", object->id()))); +// speciesChecker.insert(object->object()); +// } +// } + TEST_END(); } void Pokemod::CoinList::load(const QDomElement& xml, int id) -- cgit