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
537fc79e
Commit
537fc79e
authored
Aug 20, 2015
by
Gertjan van Heertum
Browse files
Created a test-suite for the multithreaded problems
parent
77384831
Changes
5
Show whitespace changes
Inline
Side-by-side
Source/Svg.csproj
View file @
537fc79e
...
...
@@ -353,6 +353,7 @@
</ItemGroup>
<ItemGroup>
<None
Include=
"Basic Shapes\DOM.cd"
/>
<None
Include=
"Svg.nuspec"
/>
<None
Include=
"svgkey.snk"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildBinPath)\Microsoft.CSharp.targets"
/>
...
...
Source/Svg.nuspec
0 → 100644
View file @
537fc79e
<?xml version="1.0"?>
<package
>
<metadata>
<id>
$id$
</id>
<version>
$version$
</version>
<title>
$title$
</title>
<authors>
$author$
</authors>
<owners>
$author$
</owners>
<description>
TaxModel/PAW altered implementation of the Svg library
</description>
</metadata>
</package>
\ No newline at end of file
Tests/Svg.UnitTests/CssQueryTest.cs
View file @
537fc79e
...
...
@@ -5,8 +5,6 @@ using ExCSS;
namespace
Svg.UnitTests
{
/// <summary>
///This is a test class for CssQueryTest and is intended
///to contain all CssQueryTest Unit Tests
...
...
Tests/Svg.UnitTests/MultiThreadingTest.cs
0 → 100644
View file @
537fc79e
using
System
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Threading.Tasks
;
using
System.Xml
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
namespace
Svg.UnitTests
{
[
TestClass
()]
public
class
MultiThreadingTest
{
private
const
string
TestFile
=
@"d:\temp\test.svg"
;
private
const
int
ExpectedSize
=
600000
;
private
XmlDocument
GetXMLDoc
()
{
var
xmlDoc
=
new
XmlDocument
();
if
(!
System
.
IO
.
File
.
Exists
(
TestFile
))
{
Assert
.
Inconclusive
(
"Test file missing"
);
}
xmlDoc
.
LoadXml
(
System
.
IO
.
File
.
ReadAllText
(
TestFile
));
return
xmlDoc
;
}
[
TestMethod
]
public
void
TestSingleThread
()
{
LoadFile
();
}
[
TestMethod
]
public
void
TestMultiThread
()
{
bool
valid
=
true
;
Parallel
.
For
(
0
,
10
,
(
x
)
=>
{
try
{
LoadFile
();
}
catch
(
Exception
e
)
{
Trace
.
WriteLine
(
"Run error in parallel: "
+
e
.
Message
);
valid
=
false
;
}
});
Assert
.
IsTrue
(
valid
,
"One or more of the runs was invalid"
);
Trace
.
WriteLine
(
"Done"
);
}
private
void
LoadFile
()
{
var
xml
=
GetXMLDoc
();
Trace
.
WriteLine
(
"Reading and drawing file"
);
SvgDocument
d
=
SvgDocument
.
Open
(
xml
);
var
b
=
d
.
Draw
();
Trace
.
WriteLine
(
"Done reading file"
);
using
(
var
ms
=
new
MemoryStream
())
{
b
.
Save
(
ms
,
ImageFormat
.
Png
);
ms
.
Flush
();
Assert
.
IsTrue
(
ms
.
Length
>=
ExpectedSize
,
"File does not match expected minimum size"
);
}
}
}
}
\ No newline at end of file
Tests/Svg.UnitTests/Svg.UnitTests.csproj
View file @
537fc79e
...
...
@@ -49,6 +49,7 @@
</ItemGroup>
<ItemGroup>
<Compile
Include=
"CssQueryTest.cs"
/>
<Compile
Include=
"MultiThreadingTest.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
...
...
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