public void SegNSlots_OnTestSeg_ReturnsExpectedNumberOfSlots() { using (var seg = new PaduakDisposableTestSegment("hello world")) { Assert.AreEqual(11, Graphite2Api.SegNSlots(seg.Seg)); } }
public void FaceNGlyphs_PaduakFace_ReturnsExpectedNumber() { using (var face = new PaduakDisposableFace()) { Assert.AreEqual(445, Graphite2Api.FaceNGlyphs(face.Face)); } }
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"); }
public void FaceNLanguages_Paduak_ReturnsExpectedNumberOfLanguages() { using (var face = new PaduakDisposableFace()) { Assert.AreEqual(3, Graphite2Api.FaceNLanguages(face.Face)); } }
public void SegAdvanceY_OnTestSeg_ReturnsExpectedAdvance() { using (var seg = new PaduakDisposableTestSegment("hello world")) { Assert.AreEqual(0.0f, Graphite2Api.SegAdvanceY(seg.Seg)); } }
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); } }
public void FrefValue_FirstPaduakFeatureSettingOne_ReturnsOne() { using (var feature = new PaduakFeatureVal()) { UInt16 val = Graphite2Api.FrefValue(feature.FeatureRef, 1); Assert.AreEqual(1, val); } }
public void FrefNValues_FirstPaduakFeature_ReturnsTwo() { using (var feature = new PaduakFeatureVal()) { int numval = Graphite2Api.FrefNValues(feature.FeatureRef); Assert.AreEqual(2, numval); } }
public void MakeFileFaceWithSegCache_UsingPadaukFont_NonNullFaceIsReturned() { IntPtr gr_face = Graphite2Api.MakeFileFaceWithSegCache(PaduakFontLocation, 100, 0); Assert.AreNotEqual(IntPtr.Zero, gr_face); Graphite2Api.FaceDestroy(gr_face); }
public void FaceLangByIndex_IndexZero_ReturnsNonZeroLangId() { using (var face = new PaduakDisposableFace()) { uint langId = Graphite2Api.FaceLangByIndex(face.Face, 0); Assert.AreNotEqual(0, langId); } }
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); } }
public void SlotOriginY_TestSegFirstSlot_ReturnsExpectedOffset() { using (var seg = new PaduakDisposableTestSegment("hello world")) { IntPtr firstSlot = Graphite2Api.SegFirstSlot(seg.Seg); Assert.AreEqual(0, Graphite2Api.SlotOriginY(firstSlot)); } }
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); } }
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)); } }
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)); } }
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)); } }
public void SlotOriginal_OnTestSegLastSlot_ReturnsExpectedCharInfoValue() { using (var seg = new PaduakDisposableTestSegment("hello world")) { IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg); Assert.AreEqual(10, Graphite2Api.SlotOriginal(firstSlot)); } }
public void SlotLinebreakBefore_OnATestSlot_DoesNotThrowException() { using (var seg = new PaduakDisposableTestSegment("hello world")) { IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg); Graphite2Api.SlotLinebreakBefore(firstSlot); } }
public void FaceNFref_PaduakFace_ReturnNineOrMoreFeatures() { using (var face = new PaduakDisposableFace()) { int num = Graphite2Api.FaceNFref(face.Face); Assert.GreaterOrEqual(num, 9); } }
public void SlotCanInsertBefore_OnTestSegLastSlot_ReturnsTrue() { using (var seg = new PaduakDisposableTestSegment("hello world")) { IntPtr firstSlot = Graphite2Api.SegLastSlot(seg.Seg); Assert.AreEqual(1, Graphite2Api.SlotCanInsertBefore(firstSlot)); } }
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)); } }
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)); } }
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); } }
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); } }
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); }
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); } }
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); }
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); } }
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); }
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); }