Mercurial > gemma
comparison pkg/geoserver/templates_test.go @ 3854:3fcc4e11fc00
Validate the config values of the morpho classes when saving. Also don't trigger the expensive re-calculation of the contour lines if only the colors changed.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 09 Jul 2019 11:31:49 +0200 |
parents | cbced21c6d94 |
children |
comparison
equal
deleted
inserted
replaced
3853:abc15a3182c7 | 3854:3fcc4e11fc00 |
---|---|
16 import ( | 16 import ( |
17 "strings" | 17 "strings" |
18 "testing" | 18 "testing" |
19 "text/template" | 19 "text/template" |
20 | 20 |
21 "gemma.intevation.de/gemma/pkg/models" | |
21 "github.com/sergi/go-diff/diffmatchpatch" | 22 "github.com/sergi/go-diff/diffmatchpatch" |
22 ) | 23 ) |
23 | 24 |
24 const sldTmplTxt = `<?xml version="1.0" encoding="UTF-8"?> | 25 const sldTmplTxt = `<?xml version="1.0" encoding="UTF-8"?> |
25 <StyledLayerDescriptor | 26 <StyledLayerDescriptor |
879 `4:#8ad51a,4.5,5,5.5,6,6.5,` + | 880 `4:#8ad51a,4.5,5,5.5,6,6.5,` + |
880 `7:#1414ff` | 881 `7:#1414ff` |
881 | 882 |
882 func TestTemplate(t *testing.T) { | 883 func TestTemplate(t *testing.T) { |
883 | 884 |
884 ccs, err := parseColorClasses(classBreaksConfig) | 885 ccs, err := models.ParseColorValues(classBreaksConfig) |
885 if err != nil { | 886 if err != nil { |
886 t.Fatalf("parsing color config failed: %v", err) | 887 t.Fatalf("parsing color config failed: %v", err) |
887 } | 888 } |
888 | 889 |
889 cbs := ccs.toClassBreaks() | 890 cbs := ccs.ClassBreaks() |
890 | 891 |
891 tmpl, err := template.New("test").Parse(sldTmplTxt) | 892 tmpl, err := template.New("test").Parse(sldTmplTxt) |
892 if err != nil { | 893 if err != nil { |
893 t.Fatalf("parsing template failed: %v", err) | 894 t.Fatalf("parsing template failed: %v", err) |
894 } | 895 } |