github.com/unidoc/unidoc@v2.2.0+incompatible/pdf/contentstream/contentstream_test.go (about)

     1  package contentstream
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestOperandTJSpacing(t *testing.T) {
     8  
     9  	content := `BT
    10  	[(are)-328(h)5(ypothesized)-328(to)-327(in\003uence)-328(the)-328(stability)-328(of)-328(the)-328(upstream)-327(glaciers,)-328(and)-328(thus)-328(of)-328(the)-328(entire)-327(ice)-328(sheet)]TJ
    11  	ET`
    12  	referenceText := "are hypothesized to in\003uence the stability of the upstream glaciers, and thus of the entire ice sheet"
    13  
    14  	cStreamParser := NewContentStreamParser(content)
    15  
    16  	text, err := cStreamParser.ExtractText()
    17  	if err != nil {
    18  		t.Error()
    19  	}
    20  
    21  	if text != referenceText {
    22  		t.Fail()
    23  	}
    24  
    25  }