Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ImportedProjects
SVG
Commits
b86dfd73
Commit
b86dfd73
authored
Oct 06, 2014
by
tebjan
Browse files
improved w3c tester, shows image difference of svg and png now, separate try/catch blocks
parent
16f03c34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Tests/SvgW3CTestRunner/View.Designer.cs
View file @
b86dfd73
...
...
@@ -32,7 +32,7 @@
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
splitContainer1
=
new
System
.
Windows
.
Forms
.
SplitContainer
();
this
.
tableLayoutPanel2
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
pic
Load
Save
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
picSave
Load
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
picSvg
=
new
System
.
Windows
.
Forms
.
PictureBox
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
...
...
@@ -46,7 +46,7 @@
this
.
splitContainer1
.
Panel2
.
SuspendLayout
();
this
.
splitContainer1
.
SuspendLayout
();
this
.
tableLayoutPanel2
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pic
Load
Save
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
picSave
Load
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
picSvg
)).
BeginInit
();
this
.
tableLayoutPanel3
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
picSVGPNG
)).
BeginInit
();
...
...
@@ -59,7 +59,7 @@
this
.
lstFiles
.
FormattingEnabled
=
true
;
this
.
lstFiles
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
lstFiles
.
Name
=
"lstFiles"
;
this
.
lstFiles
.
Size
=
new
System
.
Drawing
.
Size
(
174
,
670
);
this
.
lstFiles
.
Size
=
new
System
.
Drawing
.
Size
(
174
,
768
);
this
.
lstFiles
.
TabIndex
=
0
;
this
.
lstFiles
.
SelectedIndexChanged
+=
new
System
.
EventHandler
(
this
.
lstFiles_SelectedIndexChanged
);
//
...
...
@@ -75,7 +75,7 @@
this
.
tableLayoutPanel1
.
Name
=
"tableLayoutPanel1"
;
this
.
tableLayoutPanel1
.
RowCount
=
1
;
this
.
tableLayoutPanel1
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
12
35
,
676
);
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
12
49
,
774
);
this
.
tableLayoutPanel1
.
TabIndex
=
1
;
//
// splitContainer1
...
...
@@ -91,15 +91,15 @@
// splitContainer1.Panel2
//
this
.
splitContainer1
.
Panel2
.
Controls
.
Add
(
this
.
tableLayoutPanel3
);
this
.
splitContainer1
.
Size
=
new
System
.
Drawing
.
Size
(
10
49
,
670
);
this
.
splitContainer1
.
SplitterDistance
=
54
1
;
this
.
splitContainer1
.
Size
=
new
System
.
Drawing
.
Size
(
10
63
,
768
);
this
.
splitContainer1
.
SplitterDistance
=
54
8
;
this
.
splitContainer1
.
TabIndex
=
0
;
//
// tableLayoutPanel2
//
this
.
tableLayoutPanel2
.
ColumnCount
=
1
;
this
.
tableLayoutPanel2
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
100F
));
this
.
tableLayoutPanel2
.
Controls
.
Add
(
this
.
pic
Load
Save
,
0
,
3
);
this
.
tableLayoutPanel2
.
Controls
.
Add
(
this
.
picSave
Load
,
0
,
3
);
this
.
tableLayoutPanel2
.
Controls
.
Add
(
this
.
label1
,
0
,
0
);
this
.
tableLayoutPanel2
.
Controls
.
Add
(
this
.
picSvg
,
0
,
1
);
this
.
tableLayoutPanel2
.
Controls
.
Add
(
this
.
label3
,
0
,
2
);
...
...
@@ -111,19 +111,19 @@
this
.
tableLayoutPanel2
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tableLayoutPanel2
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tableLayoutPanel2
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tableLayoutPanel2
.
Size
=
new
System
.
Drawing
.
Size
(
54
1
,
670
);
this
.
tableLayoutPanel2
.
Size
=
new
System
.
Drawing
.
Size
(
54
8
,
768
);
this
.
tableLayoutPanel2
.
TabIndex
=
0
;
//
// pic
Load
Save
// picSave
Load
//
this
.
pic
Load
Save
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
pic
Load
Save
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
pic
Load
Save
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
3
48
);
this
.
pic
Load
Save
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
pic
Load
Save
.
Name
=
"pic
Load
Save"
;
this
.
pic
Load
Save
.
Size
=
new
System
.
Drawing
.
Size
(
54
1
,
3
22
);
this
.
pic
Load
Save
.
TabIndex
=
2
;
this
.
pic
Load
Save
.
TabStop
=
false
;
this
.
picSave
Load
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
picSave
Load
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
picSave
Load
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
3
97
);
this
.
picSave
Load
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
picSave
Load
.
Name
=
"picSave
Load
"
;
this
.
picSave
Load
.
Size
=
new
System
.
Drawing
.
Size
(
54
8
,
3
71
);
this
.
picSave
Load
.
TabIndex
=
2
;
this
.
picSave
Load
.
TabStop
=
false
;
//
// label1
//
...
...
@@ -141,14 +141,14 @@
this
.
picSvg
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
13
);
this
.
picSvg
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
picSvg
.
Name
=
"picSvg"
;
this
.
picSvg
.
Size
=
new
System
.
Drawing
.
Size
(
54
1
,
3
22
);
this
.
picSvg
.
Size
=
new
System
.
Drawing
.
Size
(
54
8
,
3
71
);
this
.
picSvg
.
TabIndex
=
1
;
this
.
picSvg
.
TabStop
=
false
;
//
// label3
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
35
);
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
84
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
80
,
13
);
this
.
label3
.
TabIndex
=
3
;
...
...
@@ -170,17 +170,17 @@
this
.
tableLayoutPanel3
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tableLayoutPanel3
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tableLayoutPanel3
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tableLayoutPanel3
.
Size
=
new
System
.
Drawing
.
Size
(
5
04
,
670
);
this
.
tableLayoutPanel3
.
Size
=
new
System
.
Drawing
.
Size
(
5
11
,
768
);
this
.
tableLayoutPanel3
.
TabIndex
=
0
;
//
// picSVGPNG
//
this
.
picSVGPNG
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
picSVGPNG
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
picSVGPNG
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
3
48
);
this
.
picSVGPNG
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
3
97
);
this
.
picSVGPNG
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
picSVGPNG
.
Name
=
"picSVGPNG"
;
this
.
picSVGPNG
.
Size
=
new
System
.
Drawing
.
Size
(
5
04
,
3
22
);
this
.
picSVGPNG
.
Size
=
new
System
.
Drawing
.
Size
(
5
11
,
3
71
);
this
.
picSVGPNG
.
TabIndex
=
3
;
this
.
picSVGPNG
.
TabStop
=
false
;
//
...
...
@@ -191,7 +191,7 @@
this
.
picPng
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
13
);
this
.
picPng
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
picPng
.
Name
=
"picPng"
;
this
.
picPng
.
Size
=
new
System
.
Drawing
.
Size
(
5
04
,
3
22
);
this
.
picPng
.
Size
=
new
System
.
Drawing
.
Size
(
5
11
,
3
71
);
this
.
picPng
.
TabIndex
=
2
;
this
.
picPng
.
TabStop
=
false
;
//
...
...
@@ -207,7 +207,7 @@
// label4
//
this
.
label4
.
AutoSize
=
true
;
this
.
label4
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
35
);
this
.
label4
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
84
);
this
.
label4
.
Name
=
"label4"
;
this
.
label4
.
Size
=
new
System
.
Drawing
.
Size
(
69
,
13
);
this
.
label4
.
TabIndex
=
4
;
...
...
@@ -217,7 +217,7 @@
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
13F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
12
35
,
676
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
12
49
,
774
);
this
.
Controls
.
Add
(
this
.
tableLayoutPanel1
);
this
.
Name
=
"View"
;
this
.
Text
=
"Form1"
;
...
...
@@ -227,7 +227,7 @@
this
.
splitContainer1
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel2
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel2
.
PerformLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
pic
Load
Save
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
picSave
Load
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
picSvg
)).
EndInit
();
this
.
tableLayoutPanel3
.
ResumeLayout
(
false
);
this
.
tableLayoutPanel3
.
PerformLayout
();
...
...
@@ -249,7 +249,7 @@
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel3
;
private
System
.
Windows
.
Forms
.
PictureBox
picPng
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
PictureBox
pic
Load
Save
;
private
System
.
Windows
.
Forms
.
PictureBox
picSave
Load
;
private
System
.
Windows
.
Forms
.
PictureBox
picSVGPNG
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Label
label4
;
...
...
Tests/SvgW3CTestRunner/View.cs
View file @
b86dfd73
...
...
@@ -35,13 +35,19 @@ namespace SvgW3CTestRunner
private
void
lstFiles_SelectedIndexChanged
(
object
sender
,
EventArgs
e
)
{
//render svg
var
fileName
=
lstFiles
.
SelectedItem
.
ToString
();
if
(
fileName
.
StartsWith
(
"#"
))
return
;
//display png
var
png
=
Image
.
FromFile
(
_pngBasePath
+
Path
.
GetFileNameWithoutExtension
(
fileName
)
+
".png"
);
picPng
.
Image
=
png
;
var
doc
=
new
SvgDocument
();
try
{
Debug
.
Print
(
fileName
);
var
doc
=
SvgDocument
.
Open
(
_svgBasePath
+
fileName
);
doc
=
SvgDocument
.
Open
(
_svgBasePath
+
fileName
);
if
(
fileName
.
StartsWith
(
"__"
))
{
picSvg
.
Image
=
doc
.
Draw
();
...
...
@@ -53,7 +59,16 @@ namespace SvgW3CTestRunner
picSvg
.
Image
=
img
;
}
//save load
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
ex
.
ToString
(),
"SVG Rendering"
);
picSvg
.
Image
=
null
;
}
//save load
try
{
using
(
var
memStream
=
new
MemoryStream
())
{
doc
.
Write
(
memStream
);
...
...
@@ -62,25 +77,34 @@ namespace SvgW3CTestRunner
if
(
fileName
.
StartsWith
(
"__"
))
{
picS
vg
.
Image
=
doc
.
Draw
();
picS
aveLoad
.
Image
=
doc
.
Draw
();
}
else
{
var
img
=
new
Bitmap
(
480
,
360
);
doc
.
Draw
(
img
);
picS
vg
.
Image
=
img
;
picS
aveLoad
.
Image
=
img
;
}
}
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
ex
.
ToString
(),
"SVG Serialization"
);
picSaveLoad
.
Image
=
null
;
}
//compare svg to png
try
{
picSVGPNG
.
Image
=
PixelDiff
((
Bitmap
)
picSvg
.
Image
,
(
Bitmap
)
picPng
.
Image
);
}
catch
(
Exception
ex
)
{
MessageBox
.
Show
(
ex
.
ToString
());
picS
vg
.
Image
=
null
;
MessageBox
.
Show
(
ex
.
ToString
()
,
"SVG Comparison"
);
picS
VGPNG
.
Image
=
null
;
}
var
png
=
Image
.
FromFile
(
_pngBasePath
+
Path
.
GetFileNameWithoutExtension
(
fileName
)
+
".png"
);
picPng
.
Image
=
png
;
}
unsafe
Bitmap
PixelDiff
(
Bitmap
a
,
Bitmap
b
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment