void DVControllerTests::TestKillWordInstanceStartedBySaveComparison() { AFX_MANAGE_STATE(AfxGetAppModuleState()); CStdString sSaveFilters; int iFormatCount=0; CMDIFrameWnd* pMainFrame = DYNAMIC_DOWNCAST(CMDIFrameWnd, AfxGetMainWnd()); CChildFrame *pFrame = DYNAMIC_DOWNCAST( CChildFrame, pMainFrame->MDIGetActive() ); assertTest( pFrame ); CUIntArray aFormats; LONG lFormatIndex = 1; LONG lCurrentSaveFormatID = 0; LONG lSaveFormatIDDefault = GetApp()->GetDVController(pFrame)->GetComparisonDocController().GetSaveFormatAsDVCode(); //for rtf LONG lFlags = 6; //rtf if (lSaveFormatIDDefault !=6) { lSaveFormatIDDefault=6; //for test rtf } bool bOriginalAllowFormatSetting = Workshare::OptionApi::GetBool(L"AllowFileFormatChange"); Workshare::OptionApi::SetBool(L"AllowFileFormatChange", false); //This creates a WinWord sSaveFilters = GetApp()->GetDVController(pFrame)->GetComparisonDocController().InitialiseSaveAsDlgData(aFormats, lFormatIndex, lCurrentSaveFormatID, lSaveFormatIDDefault, lFlags, docNew); assertImplementation(TestWordConnection(),_T("Should have Created a Word Instance after InitialiseSaveAsDlgData"),__LINE__,_T(__FILE__)); assertImplementation(GetApp()->GetDVController(pFrame)->GetComparisonDocController().KillWordInstanceStartedBySaveComparison(),_T("Should kill the word instance stated by SaveComparison"),__LINE__,_T(__FILE__)); }
void TestPDFDocumentTagger::SetPdfRestrictionLevelHelper(const CStdString& fileName, const CStdString& restrictionLevel, const TCHAR* const function, long lineNum) { CStdString resultFileName = CreateTestResultDocument(fileName, function); CStdString sExpectedRestriction; if (c_sFullRestriction == restrictionLevel) sExpectedRestriction = _T("fully restricted"); else if (c_sInternalOnly == restrictionLevel) sExpectedRestriction = _T("internal only"); else sExpectedRestriction = _T("unrestricted"); CStdString sErr; sErr.Format(_T("Expected PDF document not to have restriction level, [%s]"), sExpectedRestriction.c_str()); assertImplementation(restrictionLevel != GetPdfRestrictionLevel(resultFileName), sErr.c_str(), lineNum, function); PDFDocumentTagger tagger; tagger.OpenDocument(resultFileName); tagger.SetPdfRestrictionLevel(restrictionLevel); tagger.CloseDocument(); sErr.Format(_T("Expected PDF document to have restriction level, [%s]"), sExpectedRestriction.c_str()); assertImplementation(restrictionLevel == GetPdfRestrictionLevel(resultFileName), sErr.c_str(), lineNum, function); }
// Check for a failed equality assertion void TestCase::assertEquals (long expected, long actual, long lineNumber, std::string fileName) { if (expected != actual) assertImplementation (false, notEqualsMessage(expected, actual), lineNumber, fileName); }
// Check for a failed equality assertion void TestCase::assertEquals (double expected, double actual, double delta, long lineNumber, std::string fileName) { if (fabs (expected - actual) > delta) assertImplementation (false, notEqualsMessage(expected, actual), lineNumber, fileName); }
// Check for a failed equality assertion void TestCase::assertEquals(const void* expected, const void* actual, long lineNumber, const std::string& fileName) { if (expected != actual) assertImplementation(false, notEqualsMessage(expected, actual), lineNumber, fileName); }