Example #1
0
 public void StrToTag_VariousValues_ReturnsExpectedResults()
 {
     Assert.AreEqual(1181049204, Graphite2Api.StrToTag("Feat"), "Feat");
     Assert.AreEqual(0, Graphite2Api.StrToTag(String.Empty), "Empty String");
     // more the 4 chars should be ignored.
     Assert.AreEqual(1181049204, Graphite2Api.StrToTag("FeatOverflow"), "FeatOverflow");
 }
Example #2
0
        public void FaceFeaturevalForLang_PaduakFontWithEnLang_NonNullFeatureValReturned()
        {
            using (var face = new PaduakDisposableFace())
            {
                uint   lang           = Graphite2Api.StrToTag("en");
                IntPtr gr_feature_val = Graphite2Api.FaceFeaturevalForLang(face.Face, lang);
                Assert.AreNotEqual(IntPtr.Zero, gr_feature_val);

                Graphite2Api.FeatureValDestroy(gr_feature_val);
            }
        }
Example #3
0
        public void FrefValueLabel_FirstPaduakFeature_ReturnsFalseString()
        {
            using (var feature = new PaduakFeatureVal())
            {
                uint   length;
                ushort lang     = (ushort)Graphite2Api.StrToTag("en");
                IntPtr labelPtr = Graphite2Api.FrefValueLabel(feature.FeatureRef, 0, ref lang, Encform.Utf8, out length);
                Assert.AreEqual("False", Marshal.PtrToStringAnsi(labelPtr));
                Assert.AreEqual(5, length);

                Graphite2Api.LabelDestroy(labelPtr);
            }
        }
Example #4
0
        public void FrefSetFeatureValue_SettingsThekdotFeature_FailsWithZeroReturnCode()
        {
            using (var face = new PaduakDisposableFace())
            {
                uint   lang           = Graphite2Api.StrToTag("en");
                IntPtr gr_feature_val = Graphite2Api.FaceFeaturevalForLang(face.Face, lang);
                IntPtr gr_feature_ref = Graphite2Api.FaceFindFref(face.Face, 1801744244);
                int    ret            = Graphite2Api.FrefSetFeatureValue(gr_feature_ref, 12, gr_feature_val);
                Assert.AreEqual(0, ret);

                Graphite2Api.FeatureValDestroy(gr_feature_val);
            }
        }
Example #5
0
        public void FrefFeatureValue_FirstPaduakFeature_ReturnsZero()
        {
            using (var feature = new PaduakFeatureVal())
            {
                uint   lang           = Graphite2Api.StrToTag("en");
                IntPtr gr_feature_val = Graphite2Api.FaceFeaturevalForLang(feature.Face, lang);

                UInt16 val = Graphite2Api.FrefFeatureValue(feature.FeatureRef, gr_feature_val);
                Assert.AreEqual(0, val);

                Graphite2Api.FeatureValDestroy(gr_feature_val);
            }
        }
Example #6
0
        public void FrefLabel_FirstPaduakFeature_ReturnsExpectedString()
        {
            using (var feature = new PaduakFeatureVal())
            {
                ushort lang = (ushort)Graphite2Api.StrToTag("en");
                UInt32 length;

                IntPtr labelPtr = Graphite2Api.FrefLabel(feature.FeatureRef, ref lang, Encform.Utf8, out length);
                string label    = Marshal.PtrToStringAnsi(labelPtr);
                Assert.AreEqual("Khamti style dots", label);

                Graphite2Api.LabelDestroy(labelPtr);
            }
        }
Example #7
0
        public void FeaturevalClone_CloneAFeature_ReturnADifferentInstance()
        {
            using (var face = new PaduakDisposableFace())
            {
                uint   lang = Graphite2Api.StrToTag("en");
                IntPtr one  = Graphite2Api.FaceFeaturevalForLang(face.Face, lang);
                IntPtr two  = Graphite2Api.FeaturevalClone(one);
                Assert.NotNull(one, "one");
                Assert.NotNull(two, "two");
                Assert.AreNotEqual(one, two);

                Graphite2Api.FeatureValDestroy(one);
                Graphite2Api.FeatureValDestroy(two);
            }
        }