public void Warning(T eTestName, W eStringName, OTTag tag, string stringDetails) { Warning(ToTestName(eTestName), eStringName.ToString(), tag, stringDetails); }
public void OTTagOperator_EqualityTest2d() { OTTag lhs = new OTTag(new byte[4] { 1, 3, 5, 7 }); byte[] rhs = new byte[3] { 1, 3, 5 }; bool expected = false; bool actual; actual = (lhs == rhs); Assert.AreEqual(expected, actual, "Unexpected result from OTTag == byte[]"); }
public void OTTagEqualsTest3b() { OTTag target = new OTTag(new byte[4] { 1, 3, 5, 7 }); OTTag tag = new OTTag(new byte[4] { 1, 3, 5, 9 }); bool expected = false; bool actual; actual = target.Equals(tag); Assert.AreEqual(expected, actual, "Unexpected result from OTTag.Equals(OTTag); hash = " + target.GetHashCode()); }
public void OTTagEqualsTest4e() { OTTag target = new OTTag(new byte[4] { 97, 98, 99, 100 }); string tag = null; bool expected = false; bool actual; actual = target.Equals(tag); Assert.AreEqual(expected, actual, "Unexpected result from OTTag.Equals(OTTag); hash = " + target.GetHashCode()); }
public void OTTagEqualsTest2e() { OTTag target = new OTTag(new byte[4] { 1, 3, 5, 7 }); byte[] tagBuffer = new byte[5] { 1, 3, 5, 7, 9 }; bool expected = false; bool actual; actual = target.Equals(tagBuffer); Assert.AreEqual(expected, actual, "Unexpected result from OTTag.Equals(byte[]); hash = " + target.GetHashCode()); }
/// <summary>The main method for adding an Info message.</summary> private void Info(string sTestName, string stringName, OTTag tag, string sDetails) { if (this.dia != null) { ValidationInfo vi = new ValidationInfo( ValidationInfo.ValInfoType.Info, stringName, tag, sDetails, sTestName); SendInfo(vi); } }
public void OTTagEqualsTest1d() { OTTag target = new OTTag(new byte[4] { 1, 3, 5, 7 }); object obj = new object(); bool expected = false; bool actual; actual = target.Equals(obj); Assert.AreEqual(expected, actual, "Unexpected result from OTTag.Equals(object); hash = " + target.GetHashCode()); }
public void OTTagOperator_EqualityTest1e() { OTTag lhs = null; OTTag rhs = null; bool expected = true; bool actual; actual = (lhs == rhs); Assert.AreEqual(expected, actual, "Unexpected result from OTTag == OTTag"); }
public void OTTagOperator_EqualityTest1c() { OTTag lhs = new OTTag(new byte[4] { 1, 3, 5, 7 }); OTTag rhs = null; bool expected = false; bool actual; actual = (lhs == rhs); Assert.AreEqual(expected, actual, "Unexpected result from OTTag == OTTag; hash = " + lhs.GetHashCode()); }
public void OTTagEqualsTest5b() { OTTag target = new OTTag(new byte[4] { 1, 3, 5, 7 }); uint tagValue = 0x01030509; bool expected = false; bool actual; actual = target.Equals(tagValue); Assert.AreEqual(expected, actual, "OTTag not as expected: hash = " + target.GetHashCode()); }
public void OTTagGetHashCodeTest() { OTTag target = new OTTag(new byte[4] { 0xff, 0xfe, 0xfd, 0xfc }); // Object.GetHashCode returns int (signed). Can't cast 0xFF00_0000 directly to int. int expected = 0xfefdfc + (int)(0xff << 24); int actual; actual = target.GetHashCode(); Assert.AreEqual(expected, actual, "Error: unexpected result from OTTag.GetHashCode()"); }
/* * CONSTRUCTORS */ /* * public ValidationInfo(ValInfoType VIType, string StringName, OTTag tag, string stringTestName): * base(VIType, StringName, null, "OTFontFile.ValStrings", "OTFontFile", tag, stringTestName) * { * } */ /// <summary>Hardwires <c>OTFontFileVal.ValStrings</c> as /// the <c>nameFileErrs</c> and <c>OTFontFileVal</c> as /// the <c>nameAsmFileErrs</c> in the underlying /// <c>ValInfoBasic</c>. /// </summary> public ValidationInfo(ValInfoType VIType, string StringName, OTTag tag, string StringDetails, string stringTestName) : base(VIType, StringName, StringDetails, "OTFontFileVal.ValStrings", "OTFontFileVal", tag, stringTestName) { }
public void Pass(T eTestName, P eStringName, OTTag tag, string stringDetails) { Pass(ToTestName(eTestName), eStringName.ToString(), tag, stringDetails); }
/// <summary>Does not appear to be called.</summary> public ValidationInfo(ValInfoType type, string stringName, string stringValueUser, string nameFileErrs, string nameAsmFileErrs, OTTag tagPrincipal, string stringTestName) : base(type, stringName, stringValueUser, nameFileErrs, nameAsmFileErrs, tagPrincipal, stringTestName) { }
//protected OTTag m_OTTagRelated; // constructors public ValInfoBasic() { this.m_Type = ValInfoType.Info; this.m_StringName = null; this.m_StringValueName = null; this.m_StringValueUser = null; this.m_NameFileErrs = null; this.m_NameAsmFileErrs = null; this.m_OTTagPrincipal = null; this.m_StringTestName = null; //this.m_OTTagRelated=null; }
/// <summary>Called when there is a caught exception.</summary> private void ApplicationError(string sTestName, string stringName, OTTag tag, string stringDetails) { if (this.dia != null) { ValidationInfo vi = new ValidationInfo( ValidationInfo.ValInfoType.AppError, stringName, tag, stringDetails, sTestName); SendInfo(vi); } }
public ValInfoBasic(ValInfoBasic viBasic) { Debug.Assert(viBasic != null); this.m_Type = viBasic.TypeBasic; this.m_StringName = viBasic.Name; this.m_StringValueName = null; this.m_StringValueUser = viBasic.ValueUser; this.m_NameFileErrs = viBasic.NameFileErrs; this.m_NameAsmFileErrs = viBasic.NameAsmFileErrs; this.m_OTTagPrincipal = viBasic.TagPrincipal; this.m_StringTestName = viBasic.m_StringTestName; //this.m_OTTagRelated=viBasic.TagRelated; }
public void OTTagToStringTest() { OTTag target = new OTTag(new byte[4] { 97, 98, 99, 100 }); string expected = "abcd"; string actual; actual = target.ToString(); Assert.AreEqual(expected, actual, "Error: unexpected value"); target = new OTTag(new byte[4] { 97, 98, 99, 255 }); expected = "abcÿ"; actual = target.ToString(); Assert.AreEqual(expected, actual, "Error: unexpected value"); }
public void OTTagConstructorTest2d() { byte[] tagBuffer = null; bool caughtExpectedException = false; try { OTTag target = new OTTag(tagBuffer); } catch (ArgumentNullException) { caughtExpectedException = true; } Assert.IsTrue(caughtExpectedException); }
public void OTTagOpConvExplicitTest2c() { string tag = "abcde"; bool caughtExpectedException = false; try { OTTag actual = ((OTTag)(tag)); } catch (InvalidCastException) { caughtExpectedException = true; } Assert.IsTrue(caughtExpectedException); }
public void OTTagConstructorTest6e() { string tag = null; bool caughtExpectedException = false; try { OTTag target = new OTTag(tag); } catch (ArgumentNullException) { caughtExpectedException = true; } Assert.IsTrue(caughtExpectedException); }
public void OTFileIsSupportedSfntVersionTest() { OTTag target = new OTTag(0x00010000); Assert.IsTrue(OTFile.IsSupportedSfntVersion(target), "Error: valid tag not recognized"); target = new OTTag("OTTO"); Assert.IsTrue(OTFile.IsSupportedSfntVersion(target), "Error: valid tag not recognized"); target = new OTTag("ttcf"); Assert.IsTrue(OTFile.IsSupportedSfntVersion(target), "Error: valid tag not recognized"); target = new OTTag("true"); Assert.IsTrue(OTFile.IsSupportedSfntVersion(target), "Error: invalid tag recognized"); target = new OTTag("typ1"); Assert.IsFalse(OTFile.IsSupportedSfntVersion(target), "Error: invalid tag recognized"); target = new OTTag("xxxx"); Assert.IsFalse(OTFile.IsSupportedSfntVersion(target), "Error: invalid tag recognized"); }
public new OTTable GetTable(OTTag tag) { OTTable table = null; // find the directory entry in this font that matches the tag DirectoryEntry de = GetDirectoryEntry(tag); if (de != null) { // get the table from the table manager table = GetFile().GetTableManager().GetTable(this, de); } return(table); }
/// <summary>Return <c>true</c> iff table has not been deselected /// and user has not cancelled. /// </summary> public bool TestTable(OTTag tagTable) { bool bTest = true; // if the table hasn't been deselected, then it will default to getting tested if (m_hashTestsToPerform.ContainsKey((string)tagTable)) { bTest = (bool)m_hashTestsToPerform[(string)tagTable]; } if (CancelFlag) { bTest = false; } return(bTest); }
public void OTTagReadTagTest2() { byte[] b = new byte[5] { 0, 1, 0, 0, 1 }; MemoryStream ms = new MemoryStream(new byte[4] { 0, 1, 0, 0 }); OTTag expected = new OTTag(b); OTTag actual = null; try { actual = OTTag.ReadTag(ms); } catch (Exception) { // unexpected exception } Assert.IsTrue(ArraysMatch(expected.GetBytes(), actual.GetBytes()), "Error: unexpected result from OTTag.ReadTag()"); }
public bool Validate(Validator v, string sIdentity, OTTable table) { bool bRet = true; bRet &= ((val_BASE)table).ValidateNoOverlap(m_offsetBaseTagListTable, CalcLength(), v, sIdentity, table.GetTag()); bool bTagsValid = true; for (uint i = 0; i < BaseTagCount; i++) { OTTag BaselineTag = GetBaselineTag(i); if (!BaselineTag.IsValid()) { v.Error(T.T_NULL, E.BASE_E_BaseTagList_TagValid, table.m_tag, sIdentity + ", tag = 0x" + ((uint)BaselineTag).ToString("x8")); bTagsValid = false; bRet = false; } } if (bTagsValid) { v.Pass(T.T_NULL, P.BASE_P_BaseTagList_TagValid, table.m_tag, sIdentity); } bool bOrderOk = true; if (BaseTagCount > 1) { for (uint i = 0; i < BaseTagCount - 1; i++) { OTTag ThisTag = GetBaselineTag(i); OTTag NextTag = GetBaselineTag(i + 1); if (ThisTag >= NextTag) { v.Error(T.T_NULL, E.BASE_E_BaseTagList_TagOrder, table.m_tag, sIdentity); bOrderOk = false; bRet = false; break; } } } if (bOrderOk) { v.Pass(T.T_NULL, P.BASE_P_BaseTagList_TagOrder, table.m_tag, sIdentity); } return(bRet); }
public ValInfoBasic(ValInfoType type, string stringName, string stringValueUser, string nameFileErrs, string nameAsmFileErrs, OTTag tagPrincipal, string stringTestName) { this.m_Type = type; this.m_StringName = stringName; this.m_StringValueName = null; this.m_StringValueUser = stringValueUser; this.m_NameFileErrs = nameFileErrs; this.m_NameAsmFileErrs = nameAsmFileErrs; this.m_OTTagPrincipal = tagPrincipal; this.m_StringTestName = stringTestName; //this.m_OTTagRelated=tagRelated; }
public void OTTagConstructorTest6f() { //test with U+00FF -- no exception expected string tag = "abcÿ"; OTTag target = new OTTag(tag); // now with U+0100 tag = "abcĀ"; bool caughtExpectedException = false; try { target = new OTTag(tag); } catch (ArgumentException) { caughtExpectedException = true; } Assert.IsTrue(caughtExpectedException); }
public void OTTagReadTagTest1() { bool caughtExpectedException = false; // will set to true if expected exception is caught OTTag tag; byte[] b = new byte[3] { 0, 1, 0 }; MemoryStream ms = new MemoryStream(b); try { tag = OTTag.ReadTag(ms); } catch (OTDataIncompleteReadException) { caughtExpectedException = true; // caught expected argument: test passes } catch (Exception) { // unexpected exception } Assert.IsTrue(caughtExpectedException, "Error: expected exception not caught"); }
public bool ValidateNoOverlap(uint offset, uint length, Validator v, string sIdentity, OTTag tag) { bool bValid = m_DataOverlapDetector.CheckForNoOverlap(offset, length); if (!bValid) { v.Error(T.T_NULL, E._Table_E_DataOverlap, tag, sIdentity + ", offset = " + offset + ", length = " + length); } return(bValid); }
/************************ * constructor */ public LookupTable(ushort offset, MBOBuffer bufTable, OTTag tag) { m_offsetLookupTable = offset; m_bufTable = bufTable; m_tag = tag; }