summaryrefslogtreecommitdiff
path: root/drawing_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-03-05 14:48:34 +0800
committerxuri <xuri.me@gmail.com>2022-03-05 14:48:34 +0800
commitf0cb29cf6668ab96992b1e48278d9f5b1f9e4976 (patch)
tree3bcc69e973d070edf0d3a0f7764bb7e91d7774ca /drawing_test.go
parent129052ae7db0fd2c59b1ea9158df0e75450cad42 (diff)
This closes #1162, improve the compatibility with alternate content
Preserve alternate content in the workbook, worksheet, and drawingML
Diffstat (limited to 'drawing_test.go')
-rw-r--r--drawing_test.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/drawing_test.go b/drawing_test.go
index d33977f..e37b771 100644
--- a/drawing_test.go
+++ b/drawing_test.go
@@ -12,6 +12,7 @@
package excelize
import (
+ "encoding/xml"
"sync"
"testing"
)
@@ -22,9 +23,13 @@ func TestDrawingParser(t *testing.T) {
Pkg: sync.Map{},
}
f.Pkg.Store("charset", MacintoshCyrillicCharset)
- f.Pkg.Store("wsDr", []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"><xdr:oneCellAnchor><xdr:graphicFrame/></xdr:oneCellAnchor></xdr:wsDr>`))
+ f.Pkg.Store("wsDr", []byte(xml.Header+`<xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"><xdr:oneCellAnchor><xdr:graphicFrame/></xdr:oneCellAnchor></xdr:wsDr>`))
// Test with one cell anchor
f.drawingParser("wsDr")
// Test with unsupported charset
f.drawingParser("charset")
+ // Test with alternate content
+ f.Drawings = sync.Map{}
+ f.Pkg.Store("wsDr", []byte(xml.Header+`<xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" Requires="a14"><xdr:twoCellAnchor editAs="oneCell"></xdr:twoCellAnchor></mc:Choice><mc:Fallback/></mc:AlternateContent></xdr:wsDr>`))
+ f.drawingParser("wsDr")
}