private bool PureHtmlCompare(string html1, string html2) { string filteredHtml1 = SUIUtil.convertHtml(html1); string filterenHtml2 = SUIUtil.convertHtml(html2); return(filteredHtml1.Equals(filterenHtml2)); }
private bool HtmlImgCompare(string html, string imgPath) { string temphtmlPath = SpecialDirectories.Temp + "\\SUITemp.html"; if (File.Exists(imgPath)) { SUIBitmap standardImg = SUIBitmap.LoadSUIBitmap(imgPath); if (standardImg == null) { throw (new SUIHtmlCompareException()); } try { SUIUtil.OutputFileFromString(html, temphtmlPath); SUIIE ie = SUIIE.CreateIEWithURL(temphtmlPath); SUIBitmap tempImg = ie.GetClientArea(); // Fix a bug: we need to assign image path to the captured temp SUIBitmap object. tempImg.Path = imgPath; //SUIIE.CleanIEProcess(); SUIImageComparer Comparer = new SUIImageComparer(); return(Comparer.Compare(standardImg, tempImg)); }catch (SUIException e) { throw(new SUIHtmlCompareException(e)); } } else { try { SUIUtil.OutputFileFromString(html, temphtmlPath); SUIIE ie = SUIIE.CreateIEWithURL(temphtmlPath); SUIBitmap tempImg = ie.GetClientArea(); //SUIIE.CleanIEProcess(); tempImg.Path = imgPath; tempImg.Save(); return(true); } catch (SUIException e) { throw (new SUIHtmlCompareException(e)); } } }
private bool HtmlCompareFile(string html1, string filePath) { string html2 = SUIUtil.getStringFromTxtWithSave(filePath, html1); return(PureHtmlCompare(html1, html2)); }