Skip to content

Commit 313c4a7

Browse files
committed
remove test dependencies from the core agl
Signed-off-by: Lev Nachmanson <[email protected]>
1 parent 5324ff9 commit 313c4a7

File tree

8 files changed

+614
-14
lines changed

8 files changed

+614
-14
lines changed

GraphLayout/GraphLayout.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawingFromGeometryWithGtk"
110110
EndProject
111111
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdgeDirectionTest", "Samples\EdgeDirectionTest\EdgeDirectionTest.csproj", "{02EAF869-FB5A-40BD-AD78-92E193946B5D}"
112112
EndProject
113+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBB}") = "FormForGViewer", "tools\FormForGViewer\FormForGViewer.csproj", "{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}"
114+
EndProject
113115
Global
114116
GlobalSection(SolutionConfigurationPlatforms) = preSolution
115117
Debug|Any CPU = Debug|Any CPU
@@ -1044,6 +1046,26 @@ Global
10441046
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x64.Build.0 = Release|Any CPU
10451047
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.ActiveCfg = Release|Any CPU
10461048
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.Build.0 = Release|Any CPU
1049+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1050+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|Any CPU.Build.0 = Debug|Any CPU
1051+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM.ActiveCfg = Debug|Any CPU
1052+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM.Build.0 = Debug|Any CPU
1053+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM64.ActiveCfg = Debug|Any CPU
1054+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM64.Build.0 = Debug|Any CPU
1055+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x64.ActiveCfg = Debug|x64
1056+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x64.Build.0 = Debug|x64
1057+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x86.ActiveCfg = Debug|x86
1058+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x86.Build.0 = Debug|x86
1059+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|Any CPU.ActiveCfg = Release|Any CPU
1060+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|Any CPU.Build.0 = Release|Any CPU
1061+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM.ActiveCfg = Release|Any CPU
1062+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM.Build.0 = Release|Any CPU
1063+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM64.ActiveCfg = Release|Any CPU
1064+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM64.Build.0 = Release|Any CPU
1065+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x64.ActiveCfg = Release|x64
1066+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x64.Build.0 = Release|x64
1067+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x86.ActiveCfg = Release|x86
1068+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x86.Build.0 = Release|x86
10471069
EndGlobalSection
10481070
GlobalSection(SolutionProperties) = preSolution
10491071
HideSolutionNode = FALSE
@@ -1093,6 +1115,7 @@ Global
10931115
{02053710-70B8-4CEB-80DB-DC55BEDAA2C0} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
10941116
{AA8D2135-1BD2-47DD-9DC9-2FC266711536} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
10951117
{02EAF869-FB5A-40BD-AD78-92E193946B5D} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
1118+
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07} = {9E51C177-3DF6-474E-AC7A-ED036ED32F05}
10961119
EndGlobalSection
10971120
GlobalSection(ExtensibilityGlobals) = postSolution
10981121
SolutionGuid = {0D81D757-911D-4F8B-A4B3-4C4F1CBD5B60}

GraphLayout/MSAGL/AutomaticGraphLayout.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,4 @@
1414
<ItemGroup>
1515
<None Remove="AutomaticGraphLayout.nuspec" />
1616
</ItemGroup>
17-
<ItemGroup>
18-
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
19-
</ItemGroup>
2017
</Project>
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>FormForGViewer</RootNamespace>
12+
<AssemblyName>FormForGViewer</AssemblyName>
13+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
14+
<FileAlignment>512</FileAlignment>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>bin\Debug\</OutputPath>
21+
<DefineConstants>DEBUG;TRACE</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
34+
<DebugSymbols>true</DebugSymbols>
35+
<OutputPath>bin\x86\Debug\</OutputPath>
36+
<DefineConstants>DEBUG;TRACE</DefineConstants>
37+
<DebugType>full</DebugType>
38+
<PlatformTarget>x86</PlatformTarget>
39+
<ErrorReport>prompt</ErrorReport>
40+
</PropertyGroup>
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
42+
<OutputPath>bin\x86\Release\</OutputPath>
43+
<DefineConstants>TRACE</DefineConstants>
44+
<Optimize>true</Optimize>
45+
<DebugType>pdbonly</DebugType>
46+
<PlatformTarget>x86</PlatformTarget>
47+
<ErrorReport>prompt</ErrorReport>
48+
</PropertyGroup>
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
50+
<DebugSymbols>true</DebugSymbols>
51+
<OutputPath>bin\x64\Debug\</OutputPath>
52+
<DefineConstants>DEBUG;TRACE</DefineConstants>
53+
<DebugType>full</DebugType>
54+
<PlatformTarget>x64</PlatformTarget>
55+
<ErrorReport>prompt</ErrorReport>
56+
</PropertyGroup>
57+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
58+
<OutputPath>bin\x64\Release\</OutputPath>
59+
<DefineConstants>TRACE</DefineConstants>
60+
<Optimize>true</Optimize>
61+
<DebugType>pdbonly</DebugType>
62+
<PlatformTarget>x64</PlatformTarget>
63+
<ErrorReport>prompt</ErrorReport>
64+
</PropertyGroup>
65+
<ItemGroup>
66+
<Reference Include="System" />
67+
<Reference Include="System.Core" />
68+
<Reference Include="System.Drawing" />
69+
<Reference Include="System.Windows.Forms" />
70+
<Reference Include="System.Xml.Linq" />
71+
<Reference Include="System.Data.DataSetExtensions" />
72+
<Reference Include="Microsoft.CSharp" />
73+
<Reference Include="System.Data" />
74+
<Reference Include="System.Xml" />
75+
</ItemGroup>
76+
<ItemGroup>
77+
<Compile Include="FormStuff.cs" />
78+
<Compile Include="Properties\AssemblyInfo.cs" />
79+
</ItemGroup>
80+
<ItemGroup>
81+
<ProjectReference Include="..\..\Drawing\AutomaticGraphLayout.Drawing.csproj">
82+
<Project>{B76F8F71-4B00-4242-BE36-C9F0732511F7}</Project>
83+
<Name>AutomaticGraphLayout.Drawing</Name>
84+
</ProjectReference>
85+
<ProjectReference Include="..\..\tools\GraphViewerGDI\GraphViewerGDI.csproj">
86+
<Project>{725CD2CB-CF37-414E-A5A6-F1D87D4D6EDE}</Project>
87+
<Name>GraphViewerGDI</Name>
88+
</ProjectReference>
89+
<ProjectReference Include="..\..\MSAGL\AutomaticGraphLayout.csproj">
90+
<Project>{415D3E3F-7105-46C1-84D2-7ECB34213D92}</Project>
91+
<Name>AutomaticGraphLayout</Name>
92+
</ProjectReference>
93+
<ProjectReference Include="..\..\tools\Dot2Graph\Dot2Graph.csproj">
94+
<Project>{ba8fed53-458e-4cb3-8eb3-cbfcadd87e5d}</Project>
95+
<Name>Dot2Graph</Name>
96+
</ProjectReference>
97+
<ProjectReference Include="..\..\tools\QUT.ShiftReduceParser\QUT.ShiftReduceParser.csproj">
98+
<Project>{ef5cf15e-5645-433b-8a23-af93e3f2682f}</Project>
99+
<Name>QUT.ShiftReduceParser</Name>
100+
</ProjectReference>
101+
</ItemGroup>
102+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
103+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
104+
Other similar extension points exist, see Microsoft.Common.targets.
105+
<Target Name="BeforeBuild">
106+
</Target>
107+
<Target Name="AfterBuild">
108+
</Target>
109+
-->
110+
</Project>
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
/*
2+
Microsoft Automatic Graph Layout,MSAGL
3+
4+
Copyright (c) Microsoft Corporation
5+
6+
All rights reserved.
7+
8+
MIT License
9+
10+
Permission is hereby granted, free of charge, to any person obtaining
11+
a copy of this software and associated documentation files (the
12+
""Software""), to deal in the Software without restriction, including
13+
without limitation the rights to use, copy, modify, merge, publish,
14+
distribute, sublicense, and/or sell copies of the Software, and to
15+
permit persons to whom the Software is furnished to do so, subject to
16+
the following conditions:
17+
18+
The above copyright notice and this permission notice shall be
19+
included in all copies or substantial portions of the Software.
20+
21+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND,
22+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28+
*/
29+
using System;
30+
using System.Diagnostics;
31+
using System.IO;
32+
using System.Windows.Forms;
33+
using Dot2Graph;
34+
using Microsoft.Msagl.Drawing;
35+
using Microsoft.Msagl.GraphViewerGdi;
36+
37+
namespace FormForGViewer {
38+
public class FormStuff {
39+
public static bool initialLayout;
40+
static string lastFileName;
41+
public static GViewer GViewer;
42+
43+
public static Form CreateOrAttachForm(GViewer gviewer, Form form) {
44+
GViewer=gviewer;
45+
if (form == null)
46+
form = new Form();
47+
form.SuspendLayout();
48+
form.Controls.Add(gviewer);
49+
gviewer.Dock = DockStyle.Fill;
50+
gviewer.SendToBack();
51+
form.StartPosition = FormStartPosition.CenterScreen;
52+
form.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width,
53+
Screen.PrimaryScreen.WorkingArea.Height);
54+
form.MainMenuStrip = GetMainMenuStrip();
55+
form.Controls.Add(form.MainMenuStrip);
56+
form.ResumeLayout();
57+
form.Load += form_Load;
58+
return form;
59+
}
60+
61+
static void form_Load(object sender,EventArgs e) {
62+
((Form) sender).Focus();
63+
}
64+
65+
66+
static MenuStrip GetMainMenuStrip() {
67+
var menu=new MenuStrip();
68+
menu.Items.Add(FileStripItem());
69+
70+
return menu;
71+
72+
}
73+
74+
static ToolStripItem FileStripItem() {
75+
var item = new ToolStripMenuItem("File");
76+
item.DropDownItems.Add((ToolStripItem) OpenDotFileItem());
77+
item.DropDownItems.Add(ReloadDotFileItem());
78+
return item;
79+
}
80+
81+
static ToolStripItem ReloadDotFileItem() {
82+
var item = new ToolStripMenuItem("Reload file");
83+
item.ShortcutKeys = Keys.F5;
84+
item.Click += ReloadFileClick;
85+
return item;
86+
}
87+
88+
static void ReloadFileClick(object sender, EventArgs e) {
89+
if(lastFileName!=null)
90+
ReadGraphFromFile(lastFileName, GViewer, false);
91+
}
92+
93+
static ToolStripItem OpenDotFileItem() {
94+
var item = new ToolStripMenuItem("Open file");
95+
item.ShortcutKeys = Keys.Control | Keys.O;
96+
item.Click += OpenFileClick;
97+
return item;
98+
}
99+
100+
static void OpenFileClick(object sender, EventArgs e) {
101+
102+
var openFileDialog = new OpenFileDialog {
103+
RestoreDirectory = true,
104+
Filter = " dot files (*.dot)|*.dot|All files (*.*)|*.*"
105+
};
106+
107+
if (openFileDialog.ShowDialog() == DialogResult.OK)
108+
ReadGraphFromFile(openFileDialog.FileName, GViewer, false);
109+
}
110+
111+
internal static Graph CreateDrawingGraphFromFile(string fileName, out int line, out int column, out bool msaglFile) {
112+
string msg;
113+
var graph = Parser.Parse(fileName, out line, out column, out msg);
114+
if (graph != null) {
115+
msaglFile = false;
116+
return graph;
117+
}
118+
119+
try {
120+
graph = Graph.Read(fileName);
121+
msaglFile = true;
122+
return graph;
123+
} catch (Exception) {
124+
System.Diagnostics.Debug.WriteLine("cannot read " + fileName);
125+
}
126+
msaglFile = false;
127+
return null;
128+
}
129+
130+
131+
public static void ReadGraphFromFile(string fileName, GViewer gViewer, bool verbose) {
132+
int eLine, eColumn;
133+
bool msaglFile;
134+
Graph graph = CreateDrawingGraphFromFile(fileName, out eLine, out eColumn, out msaglFile);
135+
lastFileName = fileName;
136+
if (graph == null)
137+
MessageBox.Show(String.Format("{0}({1},{2}): cannot process the file", fileName, eLine, eColumn));
138+
139+
else {
140+
141+
#if TEST_MSAGL
142+
graph.LayoutAlgorithmSettings.Reporting = Test.verbose;
143+
#endif
144+
gViewer.FileName = fileName;
145+
Stopwatch sw = null;
146+
if (verbose) {
147+
gViewer.AsyncLayout = false;
148+
sw = new Stopwatch();
149+
sw.Start();
150+
}
151+
gViewer.Graph = graph;
152+
if (sw != null) {
153+
sw.Stop();
154+
System.Diagnostics.Debug.WriteLine("layout done for {0} ms", (double)sw.ElapsedMilliseconds / 1000);
155+
}
156+
}
157+
}
158+
}
159+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
Microsoft Automatic Graph Layout,MSAGL
3+
4+
Copyright (c) Microsoft Corporation
5+
6+
All rights reserved.
7+
8+
MIT License
9+
10+
Permission is hereby granted, free of charge, to any person obtaining
11+
a copy of this software and associated documentation files (the
12+
""Software""), to deal in the Software without restriction, including
13+
without limitation the rights to use, copy, modify, merge, publish,
14+
distribute, sublicense, and/or sell copies of the Software, and to
15+
permit persons to whom the Software is furnished to do so, subject to
16+
the following conditions:
17+
18+
The above copyright notice and this permission notice shall be
19+
included in all copies or substantial portions of the Software.
20+
21+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND,
22+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28+
*/
29+
using System.Reflection;
30+
using System.Runtime.CompilerServices;
31+
using System.Runtime.InteropServices;
32+
33+
// General Information about an assembly is controlled through the following
34+
// set of attributes. Change these attribute values to modify the information
35+
// associated with an assembly.
36+
[assembly: AssemblyTitle("FormForGV")]
37+
[assembly: AssemblyDescription("")]
38+
[assembly: AssemblyConfiguration("")]
39+
[assembly: AssemblyCompany("Microsoft")]
40+
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
41+
[assembly: AssemblyTrademark("")]
42+
[assembly: AssemblyCulture("")]
43+
44+
// Setting ComVisible to false makes the types in this assembly not visible
45+
// to COM components. If you need to access a type in this assembly from
46+
// COM, set the ComVisible attribute to true on that type.
47+
[assembly: ComVisible(false)]
48+
49+
50+
// Version information for an assembly consists of the following four values:
51+
//
52+
// Major Version
53+
// Minor Version
54+
// Build Number
55+
// Revision
56+
//
57+
// You can specify all the values or you can default the Build and Revision Numbers
58+
// by using the '*' as shown below:
59+
// [assembly: AssemblyVersion("1.0.*")]
60+
[assembly: AssemblyVersion("1.0.0.0")]
61+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)