コード例 #1
0
 public void Warning(T eTestName,
                     W eStringName,
                     OTTag tag,
                     string stringDetails)
 {
     Warning(ToTestName(eTestName),
             eStringName.ToString(),
             tag, stringDetails);
 }
コード例 #2
0
 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[]");
 }
コード例 #3
0
 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());
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 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());
 }
コード例 #6
0
 /// <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);
     }
 }
コード例 #7
0
 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());
 }
コード例 #8
0
 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");
 }
コード例 #9
0
 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());
 }
コード例 #10
0
 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());
 }
コード例 #11
0
 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()");
 }
コード例 #12
0
        /*
         *        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)
        {
        }
コード例 #13
0
 public void Pass(T eTestName,
                  P eStringName,
                  OTTag tag,
                  string stringDetails)
 {
     Pass(ToTestName(eTestName),
          eStringName.ToString(),
          tag,
          stringDetails);
 }
コード例 #14
0
 /// <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)
 {
 }
コード例 #15
0
ファイル: ValInfoBasic.cs プロジェクト: sjvudp/Font-Validator
        //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;
        }
コード例 #16
0
 /// <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);
     }
 }
コード例 #17
0
ファイル: ValInfoBasic.cs プロジェクト: sjvudp/Font-Validator
 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;
 }
コード例 #18
0
        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");
        }
コード例 #19
0
 public void OTTagConstructorTest2d()
 {
     byte[] tagBuffer = null;
     bool caughtExpectedException = false;
     try
     {
         OTTag target = new OTTag(tagBuffer);
     }
     catch (ArgumentNullException)
     {
         caughtExpectedException = true;
     }
     Assert.IsTrue(caughtExpectedException);
 }
コード例 #20
0
 public void OTTagOpConvExplicitTest2c()
 {
     string tag = "abcde";
     bool caughtExpectedException = false;
     try
     {
         OTTag actual = ((OTTag)(tag));
     }
     catch (InvalidCastException)
     {
         caughtExpectedException = true;
     }
     Assert.IsTrue(caughtExpectedException);
 }
コード例 #21
0
 public void OTTagConstructorTest6e()
 {
     string tag = null;
     bool caughtExpectedException = false;
     try
     {
         OTTag target = new OTTag(tag);
     }
     catch (ArgumentNullException)
     {
         caughtExpectedException = true;
     }
     Assert.IsTrue(caughtExpectedException);
 }
コード例 #22
0
ファイル: OTFileTests.cs プロジェクト: PeterConstable/OTCodec
 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");
 }
コード例 #23
0
        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);
        }
コード例 #24
0
        /// <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);
        }
コード例 #25
0
 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()");
 }
コード例 #26
0
            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);
            }
コード例 #27
0
ファイル: ValInfoBasic.cs プロジェクト: sjvudp/Font-Validator
 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;
 }
コード例 #28
0
        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);
        }
コード例 #29
0
        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");
        }
コード例 #30
0
        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);
        }
コード例 #31
0
ファイル: OTL.cs プロジェクト: bitforks/Font-Validator
        /************************
         * constructor
         */

        public LookupTable(ushort offset, MBOBuffer bufTable, OTTag tag)
        {
            m_offsetLookupTable = offset;
            m_bufTable = bufTable;
            m_tag = tag;
        }