Originally committed to SVN as r2442.

This commit is contained in:
Rodrigo Braz Monteiro 2008-11-10 01:23:45 +00:00
parent 33583d3aaa
commit 0788a45b3e
4 changed files with 61 additions and 29 deletions

View File

@ -67,14 +67,14 @@ void ASSDrawSettingsDialog::Init()
#define APPENDCOLOURPROP(pgid, label, color) pgid = propgrid->Append( wxColourProperty(label, wxPG_LABEL, color) );
#define APPENDUINTPROP(pgid, label, uint) \
pgid = propgrid->Append( wxUIntProperty(label, wxPG_LABEL, uint) ); \
pgid = propgrid->Append(wxUIntProperty(label, wxPG_LABEL, uint) ); \
propgrid->SetPropertyValidator( pgid, validator );
#define APPENDBOOLPROP(pgid, label, boolvar) \
pgid = propgrid->Append( wxBoolProperty (label, wxPG_LABEL, boolvar ) ); \
pgid = propgrid->Append(wxBoolProperty (label, wxPG_LABEL, boolvar ) ); \
propgrid->SetPropertyAttribute( pgid, wxPG_BOOL_USE_CHECKBOX, (long)1 );
wxLongPropertyValidator validator(0x0,0xFF);
propgrid->Append( wxPropertyCategory(_T("Appearance"),wxPG_LABEL) );
propgrid->Append(wxPropertyCategory(_T("Appearance"),wxPG_LABEL) );
APPENDCOLOURPROP(colors_canvas_bg_pgid, _T("Canvas"), m_frame->colors.canvas_bg)
APPENDCOLOURPROP(colors_canvas_shape_normal_pgid, _T("Drawing"), m_frame->colors.canvas_shape_normal)
APPENDUINTPROP(alphas_canvas_shape_normal_pgid, _T("Drawing @"), m_frame->alphas.canvas_shape_normal)
@ -97,7 +97,7 @@ void ASSDrawSettingsDialog::Init()
APPENDCOLOURPROP(colors_ruler_h_pgid, _T("H ruler"), m_frame->colors.ruler_h)
APPENDCOLOURPROP(colors_ruler_v_pgid, _T("V ruler"), m_frame->colors.ruler_v)
propgrid->Append( wxPropertyCategory(_T("Behaviors"),wxPG_LABEL) );
propgrid->Append(wxPropertyCategory(_T("Behaviors"),wxPG_LABEL) );
APPENDBOOLPROP(behaviors_capitalizecmds_pgid, _T("Capitalize commands"), m_frame->behaviors.capitalizecmds);
APPENDBOOLPROP(behaviors_autoaskimgopac_pgid, _T("Ask for image opacity"), m_frame->behaviors.autoaskimgopac);
APPENDBOOLPROP(behaviors_parse_spc_pgid, _T("Parse S/P/C"), m_frame->behaviors.parse_spc);

View File

@ -33,10 +33,12 @@
// Contact: mailto:zeratul@cellosoft.com
//
#include "../suites.h"
#if ATHENASUB_TEST == 1
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include "../../../aegilib/include/athenasub/athenasub.h"
#include "../suites.h"
#include "../../../athenasub/include/athenasub/athenasub.h"
using namespace Athenasub;
@ -44,51 +46,66 @@ class AthenasubTimeTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(AthenasubTimeTest);
CPPUNIT_TEST(testBounds);
CPPUNIT_TEST(testComparison);
CPPUNIT_TEST(testOperators);
CPPUNIT_TEST(testSetGet);
CPPUNIT_TEST_SUITE_END();
private:
Time a;
Time *b;
Time *c;
Time *d;
Time e;
public:
void setUp()
{
a;
b = new Time(0);
c = new Time(5000);
d = new Time(-500);
e.SetMS(-1000);
}
void tearDown()
{
delete b;
delete c;
}
void testComparison()
{
Time a;
Time b(0);
Time c(5000);
Time d(-500);
CPPUNIT_ASSERT(a == a);
CPPUNIT_ASSERT(a <= a);
CPPUNIT_ASSERT(a >= a);
CPPUNIT_ASSERT(a == *b);
CPPUNIT_ASSERT(a == *d);
CPPUNIT_ASSERT(a != *c);
CPPUNIT_ASSERT(*b != *c);
CPPUNIT_ASSERT(a < *c);
CPPUNIT_ASSERT(a <= *c);
CPPUNIT_ASSERT(*c > *b);
CPPUNIT_ASSERT(*c >= *b);
CPPUNIT_ASSERT(a == b);
CPPUNIT_ASSERT(a == d);
CPPUNIT_ASSERT(a != c);
CPPUNIT_ASSERT(b != c);
CPPUNIT_ASSERT(a < c);
CPPUNIT_ASSERT(a <= c);
CPPUNIT_ASSERT(c > b);
CPPUNIT_ASSERT(c >= b);
}
void testBounds()
{
CPPUNIT_ASSERT(d->GetMS() >= 0);
CPPUNIT_ASSERT(e.GetMS() >= 0);
Time a(-500);
CPPUNIT_ASSERT(a.GetMS() >= 0);
}
void testSetGet()
{
Time a;
CPPUNIT_ASSERT(a.GetMS() == 0);
a.SetMS(5000);
CPPUNIT_ASSERT(a.GetMS() == 5000);
a.SetMS(-5000);
CPPUNIT_ASSERT(a.GetMS() == 0);
}
void testOperators()
{
Time a(500);
CPPUNIT_ASSERT(a + 300 == Time(800));
CPPUNIT_ASSERT(a - 300 == Time(200));
CPPUNIT_ASSERT(a - 600 == Time(0));
}
};
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(AthenasubTimeTest,AegisubSuites::athenasub());
#endif

View File

@ -48,7 +48,9 @@ int main()
{
CppUnit::TextUi::TestRunner runner;
#if ATHENASUB_TEST == 1
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(AegisubSuites::athenasub()).makeTest());
#endif
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
bool result = runner.run("",false);

View File

@ -33,6 +33,19 @@
// Contact: mailto:zeratul@cellosoft.com
//
#include <string>
//////////////////////////////
// Enable/disable test suites
#define ATHENASUB_TEST 1
///////////////////////
// Name of test suites
namespace AegisubSuites {
static std::string athenasub() { return "athenasub"; }
#if ATHENASUB_TEST == 1
inline std::string athenasub() { return "athenasub"; }
#endif
};