/// Tests the Weight Functions /// @return True if all tests were executed, false if not bool FontSettingTestSuite::TestCaseWeight() { //------Last Checked------// // - Dec 6, 2004 const int testValueCount = 17; wxInt32 testValues[testValueCount]; testValues[0] = FontSetting::weightDontCare; testValues[1] = FontSetting::weightThin; testValues[2] = FontSetting::weightExtraLight; testValues[3] = FontSetting::weightUltraLight; testValues[4] = FontSetting::weightLight; testValues[5] = FontSetting::weightNormal; testValues[6] = FontSetting::weightRegular; testValues[7] = FontSetting::weightMedium; testValues[8] = FontSetting::weightSemiBold; testValues[9] = FontSetting::weightDemiBold; testValues[10] = FontSetting::weightBold; testValues[11] = FontSetting::weightExtraBold; testValues[12] = FontSetting::weightUltraBold; testValues[13] = FontSetting::weightBlack; testValues[14] = FontSetting::weightHeavy; testValues[15] = -1; testValues[16] = 139; bool expectedResults[testValueCount]; expectedResults[0] = true; expectedResults[1] = true; expectedResults[2] = true; expectedResults[3] = true; expectedResults[4] = true; expectedResults[5] = true; expectedResults[6] = true; expectedResults[7] = true; expectedResults[8] = true; expectedResults[9] = true; expectedResults[10] = true; expectedResults[11] = true; expectedResults[12] = true; expectedResults[13] = true; expectedResults[14] = true; expectedResults[15] = false; expectedResults[16] = false; int i = 0; for (; i < testValueCount; i++) { TEST(wxString::Format(wxT("IsValidWeight - %d"), testValues[i]), (FontSetting::IsValidWeight(testValues[i]) == expectedResults[i])); FontSetting fontSetting; TEST(wxString::Format(wxT("SetWeight - %d"), testValues[i]), (fontSetting.SetWeight(testValues[i]) == expectedResults[i]) && ((!expectedResults[i]) ? 1 : (fontSetting.GetWeight() == testValues[i])) ); } return (true); }