func TestIssue0209SplitLinesEqualMultiCell(t *testing.T) {
	var pdf *gofpdf.Fpdf

	pdf = gofpdf.New("P", "mm", "A4", "")
	pdf.AddPage()
	pdf.SetFont("Arial", "", 8)
	// this sentence should not be splited
	str := "Guochin Amandine"
	lines := pdf.SplitLines([]byte(str), 26)
	_, FontSize := pdf.GetFontSize()
	y_start := pdf.GetY()
	pdf.MultiCell(26, FontSize, str, "", "L", false)
	y_end := pdf.GetY()

	if len(lines) != 1 {
		t.Fatalf("expect SplitLines split in one line")
	}
	if int(y_end-y_start) != int(FontSize) {
		t.Fatalf("expect MultiCell split in one line %.2f != %.2f", y_end-y_start, FontSize)
	}

	// this sentence should be splited in two lines
	str = "Guiochini Amandine"
	lines = pdf.SplitLines([]byte(str), 26)
	y_start = pdf.GetY()
	pdf.MultiCell(26, FontSize, str, "", "L", false)
	y_end = pdf.GetY()

	if len(lines) != 2 {
		t.Fatalf("expect SplitLines split in two lines")
	}
	if int(y_end-y_start) != int(FontSize*2) {
		t.Fatalf("expect MultiCell split in two lines %.2f != %.2f", y_end-y_start, FontSize*2)
	}
}
// TestIssue0209SplitLinesEqualMultiCell addresses issue 209
// make SplitLines and MultiCell split at the same place
TestIssue0209SplitLinesEqualMultiCell addresses issue 209
make SplitLines and MultiCell split at the same place
// TestIssue0209SplitLinesEqualMultiCell addresses issue 209 // make SplitLines and MultiCell split at the same place
func TestIssue0209SplitLinesEqualMultiCell(t *testing.T) {
	var pdf *gofpdf.Fpdf
	pdf = gofpdf.New("P", "mm", "A4", "")
	pdf.AddPage()
	pdf.SetFont("Arial", "", 8)
	str := "Guochin Amandine"
	lines := pdf.SplitLines([]byte(str), 26)
	_, FontSize := pdf.GetFontSize()
	y_start := pdf.GetY()
	pdf.MultiCell(26, FontSize, str, "", "L", false)
	y_end := pdf.GetY()
	if len(lines) != 1 {
		t.Fatalf("expect SplitLines split in one line")
	}
	if int(y_end-y_start) != int(FontSize) {
		t.Fatalf("expect MultiCell split in one line %.2f != %.2f", y_end-y_start, FontSize)
	}
	str = "Guiochini Amandine"
	lines = pdf.SplitLines([]byte(str), 26)
	y_start = pdf.GetY()
	pdf.MultiCell(26, FontSize, str, "", "L", false)
	y_end = pdf.GetY()
	if len(lines) != 2 {
		t.Fatalf("expect SplitLines split in two lines")
	}
	if int(y_end-y_start) != int(FontSize*2) {
		t.Fatalf("expect MultiCell split in two lines %.2f != %.2f", y_end-y_start, FontSize*2)
	}
}
func TestIssue0209SplitLinesEqualMultiCell ( t * testing . T ) { var pdf * gofpdf . Fpdf pdf = gofpdf . New ( " " , " " , " " , " " ) pdf . AddPage ( ) pdf . SetFont ( " " , " " , 8 ) str := " " lines := pdf . SplitLines ( [ ] byte ( str ) , 26 ) _ , FontSize := pdf . GetFontSize ( ) y_start := pdf . GetY ( ) pdf . MultiCell ( 26 , FontSize , str , " " , " " , false ) y_end := pdf . GetY ( ) if len ( lines ) != 1 { t . Fatalf ( " " ) } if int ( y_end - y_start ) != int ( FontSize ) { t . Fatalf ( " " , y_end - y_start , FontSize ) } str = " " lines = pdf . SplitLines ( [ ] byte ( str ) , 26 ) y_start = pdf . GetY ( ) pdf . MultiCell ( 26 , FontSize , str , " " , " " , false ) y_end = pdf . GetY ( ) if len ( lines ) != 2 { t . Fatalf ( " " ) } if int ( y_end - y_start ) != int ( FontSize * 2 ) { t . Fatalf ( " " , y_end - y_start , FontSize * 2 ) } }
TestIssue0209SplitLinesEqualMultiCell addresses issue 209
make SplitLines and MultiCell split at the same place
TestIssue0209SplitLinesEqualMultiCell addresses issue 209 make SplitLines and MultiCell split at the same place
// this sentence should not be splited // this sentence should be splited in two lines