/// Tests the SetFontSetting Function /// @return True if all tests were executed, false if not bool FontSettingTestSuite::TestCaseSetFontSetting() { //------Last Checked------// // - Dec 6, 2004 FontSetting fontSetting; TEST(wxT("SetFontSetting - NULL facename"), !fontSetting.SetFontSetting(NULL, 12, FontSetting::weightBold, true, true, true, wxColor(255,0,0))); TEST(wxT("SetFontSetting - invalid point size"), !fontSetting.SetFontSetting(wxT("Arial"), 0, FontSetting::weightBold, true, true, true, wxColor(255,0,0))); TEST(wxT("SetFontSetting - invalid weight"), !fontSetting.SetFontSetting(wxT("Arial"), 12, 139, true, true, true, wxColor(255,0,0))); TEST(wxT("SetFontSetting - valid"), fontSetting.SetFontSetting(wxT("Arial"), 12, FontSetting::weightBold, true, true, true, wxColor(255,0,0)) && (fontSetting.GetFaceName() == wxT("Arial")) && (fontSetting.GetPointSize() == 12) && (fontSetting.GetWeight() == FontSetting::weightBold) && (fontSetting.IsItalic()) && (fontSetting.IsUnderline()) && (fontSetting.IsStrikeOut()) && (fontSetting.GetColor() == wxColor(255,0,0)) ); return (true); }
/// Tests the StrikeOut Functions /// @return True if all tests were executed, false if not bool FontSettingTestSuite::TestCaseStrikeOut() { //------Last Checked------// // - Dec 6, 2004 FontSetting fontSetting; fontSetting.SetStrikeOut(); TEST(wxT("SetStrikeOut"), (fontSetting.IsStrikeOut())); return (true); }
// Test Case Functions /// Tests the Constructors /// @return True if all tests were executed, false if not bool FontSettingTestSuite::TestCaseConstructor() { //------Last Checked------// // - Dec 6, 2004 // TEST CASE: Default constructor { FontSetting fontSetting; TEST(wxT("Default Constructor"), (fontSetting.GetFaceName() == FontSetting::DEFAULT_FACENAME) && (fontSetting.GetPointSize() == FontSetting::DEFAULT_POINTSIZE) && (fontSetting.GetWeight() == FontSetting::DEFAULT_WEIGHT) && (fontSetting.IsItalic() == FontSetting::DEFAULT_ITALIC) && (fontSetting.IsUnderline() == FontSetting::DEFAULT_UNDERLINE) && (fontSetting.IsStrikeOut() == FontSetting::DEFAULT_STRIKEOUT) && (fontSetting.GetColor() == FontSetting::DEFAULT_COLOR) ); } // TEST CASE: Primary constructor { FontSetting fontSetting(wxT("Arial"), 12, FontSetting::weightBold, true, true, true, wxColor(255,0,0)); TEST(wxT("Primary Constructor"), (fontSetting.GetFaceName() == wxT("Arial")) && (fontSetting.GetPointSize() == 12) && (fontSetting.GetWeight() == FontSetting::weightBold) && (fontSetting.IsItalic()) && (fontSetting.IsUnderline()) && (fontSetting.IsStrikeOut()) && (fontSetting.GetColor() == wxColor(255,0,0)) ); } // TEST CASE: Copy constructor { FontSetting fontSetting(wxT("Arial"), 12, FontSetting::weightBold, true, true, true, wxColor(255,0,0)); FontSetting fontSetting2(fontSetting); TEST(wxT("Copy Constructor"), (fontSetting2.GetFaceName() == wxT("Arial")) && (fontSetting2.GetPointSize() == 12) && (fontSetting2.GetWeight() == FontSetting::weightBold) && (fontSetting2.IsItalic()) && (fontSetting2.IsUnderline()) && (fontSetting2.IsStrikeOut()) && (fontSetting2.GetColor() == wxColor(255,0,0)) ); } return (true); }
/// Tests the SetFontSettingFromString Function /// @return True if all tests were executed, false if not bool FontSettingTestSuite::TestCaseSetFontSettingFromString() { //------Last Checked------// // - Dec 6, 2004 FontSetting fontSetting; TEST(wxT("SetFontSettingFromString - NULL string"), !fontSetting.SetFontSettingFromString(NULL)); // String format = comma delimited: FaceName,PointSize,Weight,Italic(T/F), // Underline(T/F),StrikeOut(T/F),Color TEST(wxT("SetFontSettingFromString - valid string"), fontSetting.SetFontSettingFromString(wxT("Arial,12,700,T,T,F,255")) && (fontSetting.GetFaceName() == wxT("Arial")) && (fontSetting.GetPointSize() == 12) && (fontSetting.GetWeight() == FontSetting::weightBold) && (fontSetting.IsItalic()) && (fontSetting.IsUnderline()) && (!fontSetting.IsStrikeOut()) && (fontSetting.GetColor() == wxColor(255,0,0)) ); return (true); }