コード例 #1
0
 public void SegNSlots_OnTestSeg_ReturnsExpectedNumberOfSlots()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         Assert.AreEqual(11, Graphite2Api.SegNSlots(seg.Seg));
     }
 }
コード例 #2
0
 public void FaceNGlyphs_PaduakFace_ReturnsExpectedNumber()
 {
     using (var face = new PaduakDisposableFace())
     {
         Assert.AreEqual(445, Graphite2Api.FaceNGlyphs(face.Face));
     }
 }
コード例 #3
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");
 }
コード例 #4
0
 public void FaceNLanguages_Paduak_ReturnsExpectedNumberOfLanguages()
 {
     using (var face = new PaduakDisposableFace())
     {
         Assert.AreEqual(3, Graphite2Api.FaceNLanguages(face.Face));
     }
 }
コード例 #5
0
 public void SegAdvanceY_OnTestSeg_ReturnsExpectedAdvance()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         Assert.AreEqual(0.0f, Graphite2Api.SegAdvanceY(seg.Seg));
     }
 }
コード例 #6
0
        public void StartLogging_PaduakFace_LogFileIsCreated()
        {
            int major, minor, bugfix;

            Graphite2Api.EngineVersion(out major, out minor, out bugfix);

            if (major <= 1 && minor < 2)
            {
                using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
                {
                    Assert.Throws <NotSupportedException>(() => face.StartLogging(String.Empty));
                    Assert.Throws <NotSupportedException>(() => face.StopLogging());
                }
                return;
            }

            using (var face = new Face(TestConstants.PaduakFontLocation, FaceOptions.face_default))
            {
                string filename = Path.GetTempPath() + Guid.NewGuid().ToString();
                Assert.IsTrue(face.StartLogging(filename));
                Assert.IsTrue(File.Exists(filename));
                face.StopLogging();
                File.Delete(filename);
            }
        }
コード例 #7
0
 public void FrefValue_FirstPaduakFeatureSettingOne_ReturnsOne()
 {
     using (var feature = new PaduakFeatureVal())
     {
         UInt16 val = Graphite2Api.FrefValue(feature.FeatureRef, 1);
         Assert.AreEqual(1, val);
     }
 }
コード例 #8
0
 public void FrefNValues_FirstPaduakFeature_ReturnsTwo()
 {
     using (var feature = new PaduakFeatureVal())
     {
         int numval = Graphite2Api.FrefNValues(feature.FeatureRef);
         Assert.AreEqual(2, numval);
     }
 }
コード例 #9
0
        public void MakeFileFaceWithSegCache_UsingPadaukFont_NonNullFaceIsReturned()
        {
            IntPtr gr_face = Graphite2Api.MakeFileFaceWithSegCache(PaduakFontLocation, 100, 0);

            Assert.AreNotEqual(IntPtr.Zero, gr_face);

            Graphite2Api.FaceDestroy(gr_face);
        }
コード例 #10
0
 public void FaceLangByIndex_IndexZero_ReturnsNonZeroLangId()
 {
     using (var face = new PaduakDisposableFace())
     {
         uint langId = Graphite2Api.FaceLangByIndex(face.Face, 0);
         Assert.AreNotEqual(0, langId);
     }
 }
コード例 #11
0
 public void FaceFindFref_FindFreatureForkdotString_ReturnsNonNullFeatureRef()
 {
     using (var face = new PaduakDisposableFace())
     {
         IntPtr gr_feature_ref = Graphite2Api.FaceFindFref(face.Face, 1801744244);
         Assert.AreNotEqual(IntPtr.Zero, gr_feature_ref);
     }
 }
コード例 #12
0
 public void SlotOriginY_TestSegFirstSlot_ReturnsExpectedOffset()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         Assert.AreEqual(0, Graphite2Api.SlotOriginY(firstSlot));
     }
 }
コード例 #13
0
 public void SegJustify_OnATestSegment_DoesNotThrowException()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr slot = Graphite2Api.SegFirstSlot(seg.Seg);
         Graphite2Api.SegJustify(seg.Seg, slot, seg.Font, 100, 0, IntPtr.Zero, IntPtr.Zero);
     }
 }
コード例 #14
0
 public void SlotIndex_OnTestSlot_ReturnsExpectedIndex()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         Assert.AreEqual(0, (uint)Graphite2Api.SlotIndex(firstSlot));
     }
 }
コード例 #15
0
 public void SlotAttr_OnTestSegLastSlot_ReturnsExpectedAttributeValue()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg);
         Assert.AreEqual(526, Graphite2Api.SlotAttr(firstSlot, seg.Seg, 0, 0));
     }
 }
コード例 #16
0
 public void SlotNextInSegment_OnFirstSlotInPaduakTestSegment_ReturnsNonNullSlot()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr slot = Graphite2Api.SegFirstSlot(seg.Seg);
         Assert.AreNotEqual(IntPtr.Zero, Graphite2Api.SlotNextInSegment(slot));
     }
 }
コード例 #17
0
 public void SlotOriginal_OnTestSegLastSlot_ReturnsExpectedCharInfoValue()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg);
         Assert.AreEqual(10, Graphite2Api.SlotOriginal(firstSlot));
     }
 }
コード例 #18
0
 public void SlotLinebreakBefore_OnATestSlot_DoesNotThrowException()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg);
         Graphite2Api.SlotLinebreakBefore(firstSlot);
     }
 }
コード例 #19
0
 public void FaceNFref_PaduakFace_ReturnNineOrMoreFeatures()
 {
     using (var face = new PaduakDisposableFace())
     {
         int num = Graphite2Api.FaceNFref(face.Face);
         Assert.GreaterOrEqual(num, 9);
     }
 }
コード例 #20
0
 public void SlotCanInsertBefore_OnTestSegLastSlot_ReturnsTrue()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg);
         Assert.AreEqual(1, Graphite2Api.SlotCanInsertBefore(firstSlot));
     }
 }
コード例 #21
0
 public void SlotAdvanceY_OnTestSeg_ReturnsExpecedAdvance()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr slot = Graphite2Api.SegFirstSlot(seg.Seg);
         Assert.AreEqual(0.0f, Graphite2Api.SlotAdvanceY(slot, seg.Face, seg.Font));
     }
 }
コード例 #22
0
 public void CinfoBase_OnTestCinfo_ReturnsExpectedIndex()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         IntPtr char_info = Graphite2Api.SegCinfo(seg.Seg, (uint)Graphite2Api.SlotBefore(firstSlot));
         Assert.AreEqual(0, Graphite2Api.CinfoBase(char_info));
     }
 }
コード例 #23
0
 public void SlotNextSiblingAttachment_TestSegFirstSlot_ReturnsNonNullSlotPtr()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         IntPtr slot      = Graphite2Api.SlotNextSiblingAttachment(firstSlot);
         Assert.AreNotEqual(IntPtr.Zero, slot);
     }
 }
コード例 #24
0
 public void SlotAttachedTo_TestSegFirstSlot_ReturnsNullSlotPtr()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot  = Graphite2Api.SegFirstSlot(seg.Seg);
         IntPtr parentSlot = Graphite2Api.SlotAttachedTo(firstSlot);
         Assert.AreEqual(IntPtr.Zero, parentSlot);
     }
 }
コード例 #25
0
        public void CountUnicodeCharacters_TestString_ReturnsExpectedNumberOfChars()
        {
            IntPtr str           = Marshal.StringToCoTaskMemAnsi("hello world");
            IntPtr error         = new IntPtr(0);
            int    numCodePoints = Graphite2Api.CountUnicodeCharacters(Encform.Utf8, str, IntPtr.Zero, ref error);

            Assert.AreEqual(11, numCodePoints);
            Marshal.FreeCoTaskMem(str);
        }
コード例 #26
0
 public void SegCinfo_OnATestSegAndSlot_ReturnsNonNullCharInfoPtr()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         IntPtr char_info = Graphite2Api.SegCinfo(seg.Seg, (uint)Graphite2Api.SlotBefore(firstSlot));
         Assert.AreNotEqual(IntPtr.Zero, char_info);
     }
 }
コード例 #27
0
            public PaduakDisposableTestSegment(string testData)
            {
                _font     = new PaduakDisposableFont();
                _testData = Marshal.StringToCoTaskMemAnsi(testData);
                IntPtr error         = new IntPtr(0);
                int    numCodePoints = Graphite2Api.CountUnicodeCharacters(Encform.Utf8, _testData, IntPtr.Zero, ref error);

                Seg = Graphite2Api.MakeSeg(_font.Font, _font.Face, 0, IntPtr.Zero, Encform.Utf8, _testData, numCodePoints, 0);
            }
コード例 #28
0
 public void CinfoBreakWeight_OnTestCharInfo_ReturnsExpectedBreakWeight()
 {
     using (var seg = new PaduakDisposableTestSegment("hello world"))
     {
         IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg);
         IntPtr char_info = Graphite2Api.SegCinfo(seg.Seg, (uint)Graphite2Api.SlotBefore(firstSlot));
         int    bw        = Graphite2Api.CinfoBreakWeight(char_info);
         Assert.AreEqual(-30, bw);
     }
 }
コード例 #29
0
        public void MakeFont_UsingPadaukFont_NonNullFontIsReturned()
        {
            IntPtr gr_face = Graphite2Api.MakeFileFace(PaduakFontLocation, 0);
            IntPtr gr_font = Graphite2Api.MakeFont(20, gr_face);

            Assert.AreNotEqual(IntPtr.Zero, gr_font);

            Graphite2Api.FontDestroy(gr_font);
            Graphite2Api.FaceDestroy(gr_face);
        }
コード例 #30
0
        public void TagToStr_PassFeatEncodedAsId_ReturnsPtrToFeatString()
        {
            IntPtr ptr = Marshal.StringToCoTaskMemAnsi("    ");

            Graphite2Api.TagToStr(1181049204, ptr);
            var str = Marshal.PtrToStringAnsi(ptr);

            Assert.AreEqual("Feat", str);
            Marshal.FreeCoTaskMem(ptr);
        }