unioffice/document/settings_test.go
Todd 09825ac816 schema: rework schema namespaces to work around Windows issues
The go command on Windows doesn't like long path name. To
work around this, this is the first in a series of changes to
shorten the schema disk path structure in a few places.

Fixes #89
2017-09-23 10:01:17 -04:00

34 lines
766 B
Go

package document
import (
"bytes"
"encoding/xml"
"fmt"
"os"
"testing"
wml "baliance.com/gooxml/schema/soo/wordprocessingml"
"baliance.com/gooxml/testhelper"
"baliance.com/gooxml/zippkg"
)
func TestSettingsUnmarshal(t *testing.T) {
f, err := os.Open("testdata/settings.xml")
if err != nil {
t.Fatalf("error reading settings file")
}
dec := xml.NewDecoder(f)
stng := wml.NewSettings()
if err := dec.Decode(stng); err != nil {
t.Errorf("error decoding settings: %s", err)
}
got := &bytes.Buffer{}
fmt.Fprintf(got, zippkg.XMLHeader)
enc := xml.NewEncoder(zippkg.SelfClosingWriter{W: got})
if err := enc.Encode(stng); err != nil {
t.Errorf("error encoding settings: %s", err)
}
testhelper.CompareGoldenXML(t, "settings.xml", got.Bytes())
}