summaryrefslogtreecommitdiffstats
path: root/pokemod/Time.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/Time.cpp')
-rw-r--r--pokemod/Time.cpp40
1 files changed, 16 insertions, 24 deletions
diff --git a/pokemod/Time.cpp b/pokemod/Time.cpp
index 50754361..e04b69f8 100644
--- a/pokemod/Time.cpp
+++ b/pokemod/Time.cpp
@@ -47,27 +47,13 @@ Time::Time(const QDomElement& xml, const Object* parent, const int id) :
load(xml, id);
}
-bool Time::validate() const
+void Time::validate(QTextStream& stream)
{
- // TODO: validate
-// bool valid = true;
-// static_cast<const Pokemod*>(pokemod())->validationMsg(QString("---Time \"%1\" with id %2---").arg(m_name).arg(id()), Pokemod::V_Msg);
-// if (m_name == "")
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Name not defined");
-// valid = false;
-// }
-// if (23 < m_hour)
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid starting hour");
-// valid = false;
-// }
-// if (59 < m_minute)
-// {
-// static_cast<const Pokemod*>(pokemod())->validationMsg("Invalid start minute");
-// valid = false;
-// }
-// return valid;
+ TEST_SETUP();
+ if (m_name.isEmpty())
+ error(stream, "Name is empty");
+ TEST(setHour, hour);
+ TEST(setMinute, minute);
}
void Time::load(const QDomElement& xml, int id)
@@ -92,17 +78,23 @@ void Time::setName(const QString& name)
m_name = name;
}
-void Time::setHour(const int hour) throw(BoundsException)
+void Time::setHour(const int hour)
{
if (24 <= hour)
- error<BoundsException>("hour");
+ {
+ boundsError("hour");
+ return;
+ }
m_hour = hour;
}
-void Time::setMinute(const int minute) throw(BoundsException)
+void Time::setMinute(const int minute)
{
if (60 <= minute)
- error<BoundsException>("minute");
+ {
+ boundsError("minute");
+ return;
+ }
m_minute = minute;
}