Skip to content

Commit

Permalink
remove test dependencies from the core agl
Browse files Browse the repository at this point in the history
Signed-off-by: Lev Nachmanson <[email protected]>
  • Loading branch information
levnach committed Jan 28, 2022
1 parent 5324ff9 commit 313c4a7
Show file tree
Hide file tree
Showing 8 changed files with 614 additions and 14 deletions.
23 changes: 23 additions & 0 deletions GraphLayout/GraphLayout.sln
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawingFromGeometryWithGtk"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdgeDirectionTest", "Samples\EdgeDirectionTest\EdgeDirectionTest.csproj", "{02EAF869-FB5A-40BD-AD78-92E193946B5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBB}") = "FormForGViewer", "tools\FormForGViewer\FormForGViewer.csproj", "{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1044,6 +1046,26 @@ Global
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x64.Build.0 = Release|Any CPU
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.ActiveCfg = Release|Any CPU
{02EAF869-FB5A-40BD-AD78-92E193946B5D}.Release|x86.Build.0 = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM.ActiveCfg = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM.Build.0 = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|ARM64.Build.0 = Debug|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x64.ActiveCfg = Debug|x64
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x64.Build.0 = Debug|x64
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x86.ActiveCfg = Debug|x86
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Debug|x86.Build.0 = Debug|x86
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|Any CPU.Build.0 = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM.ActiveCfg = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM.Build.0 = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM64.ActiveCfg = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|ARM64.Build.0 = Release|Any CPU
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x64.ActiveCfg = Release|x64
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x64.Build.0 = Release|x64
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x86.ActiveCfg = Release|x86
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1093,6 +1115,7 @@ Global
{02053710-70B8-4CEB-80DB-DC55BEDAA2C0} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
{AA8D2135-1BD2-47DD-9DC9-2FC266711536} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
{02EAF869-FB5A-40BD-AD78-92E193946B5D} = {CAAD5476-353C-41F5-A6E7-88BA0C97C2C9}
{AF9121C3-E4B7-464F-8EBB-96C9CF627C07} = {9E51C177-3DF6-474E-AC7A-ED036ED32F05}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0D81D757-911D-4F8B-A4B3-4C4F1CBD5B60}
Expand Down
3 changes: 0 additions & 3 deletions GraphLayout/MSAGL/AutomaticGraphLayout.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@
<ItemGroup>
<None Remove="AutomaticGraphLayout.nuspec" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.5" />
</ItemGroup>
</Project>
110 changes: 110 additions & 0 deletions GraphLayout/tools/FormForGViewer/FormForGViewer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AF9121C3-E4B7-464F-8EBB-96C9CF627C07}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FormForGViewer</RootNamespace>
<AssemblyName>FormForGViewer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FormStuff.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Drawing\AutomaticGraphLayout.Drawing.csproj">
<Project>{B76F8F71-4B00-4242-BE36-C9F0732511F7}</Project>
<Name>AutomaticGraphLayout.Drawing</Name>
</ProjectReference>
<ProjectReference Include="..\..\tools\GraphViewerGDI\GraphViewerGDI.csproj">
<Project>{725CD2CB-CF37-414E-A5A6-F1D87D4D6EDE}</Project>
<Name>GraphViewerGDI</Name>
</ProjectReference>
<ProjectReference Include="..\..\MSAGL\AutomaticGraphLayout.csproj">
<Project>{415D3E3F-7105-46C1-84D2-7ECB34213D92}</Project>
<Name>AutomaticGraphLayout</Name>
</ProjectReference>
<ProjectReference Include="..\..\tools\Dot2Graph\Dot2Graph.csproj">
<Project>{ba8fed53-458e-4cb3-8eb3-cbfcadd87e5d}</Project>
<Name>Dot2Graph</Name>
</ProjectReference>
<ProjectReference Include="..\..\tools\QUT.ShiftReduceParser\QUT.ShiftReduceParser.csproj">
<Project>{ef5cf15e-5645-433b-8a23-af93e3f2682f}</Project>
<Name>QUT.ShiftReduceParser</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
159 changes: 159 additions & 0 deletions GraphLayout/tools/FormForGViewer/FormStuff.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
Microsoft Automatic Graph Layout,MSAGL
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
""Software""), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using Dot2Graph;
using Microsoft.Msagl.Drawing;
using Microsoft.Msagl.GraphViewerGdi;

namespace FormForGViewer {
public class FormStuff {
public static bool initialLayout;
static string lastFileName;
public static GViewer GViewer;

public static Form CreateOrAttachForm(GViewer gviewer, Form form) {
GViewer=gviewer;
if (form == null)
form = new Form();
form.SuspendLayout();
form.Controls.Add(gviewer);
gviewer.Dock = DockStyle.Fill;
gviewer.SendToBack();
form.StartPosition = FormStartPosition.CenterScreen;
form.Size = new System.Drawing.Size(Screen.PrimaryScreen.WorkingArea.Width,
Screen.PrimaryScreen.WorkingArea.Height);
form.MainMenuStrip = GetMainMenuStrip();
form.Controls.Add(form.MainMenuStrip);
form.ResumeLayout();
form.Load += form_Load;
return form;
}

static void form_Load(object sender,EventArgs e) {
((Form) sender).Focus();
}


static MenuStrip GetMainMenuStrip() {
var menu=new MenuStrip();
menu.Items.Add(FileStripItem());

return menu;

}

static ToolStripItem FileStripItem() {
var item = new ToolStripMenuItem("File");
item.DropDownItems.Add((ToolStripItem) OpenDotFileItem());
item.DropDownItems.Add(ReloadDotFileItem());
return item;
}

static ToolStripItem ReloadDotFileItem() {
var item = new ToolStripMenuItem("Reload file");
item.ShortcutKeys = Keys.F5;
item.Click += ReloadFileClick;
return item;
}

static void ReloadFileClick(object sender, EventArgs e) {
if(lastFileName!=null)
ReadGraphFromFile(lastFileName, GViewer, false);
}

static ToolStripItem OpenDotFileItem() {
var item = new ToolStripMenuItem("Open file");
item.ShortcutKeys = Keys.Control | Keys.O;
item.Click += OpenFileClick;
return item;
}

static void OpenFileClick(object sender, EventArgs e) {

var openFileDialog = new OpenFileDialog {
RestoreDirectory = true,
Filter = " dot files (*.dot)|*.dot|All files (*.*)|*.*"
};

if (openFileDialog.ShowDialog() == DialogResult.OK)
ReadGraphFromFile(openFileDialog.FileName, GViewer, false);
}

internal static Graph CreateDrawingGraphFromFile(string fileName, out int line, out int column, out bool msaglFile) {
string msg;
var graph = Parser.Parse(fileName, out line, out column, out msg);
if (graph != null) {
msaglFile = false;
return graph;
}

try {
graph = Graph.Read(fileName);
msaglFile = true;
return graph;
} catch (Exception) {
System.Diagnostics.Debug.WriteLine("cannot read " + fileName);
}
msaglFile = false;
return null;
}


public static void ReadGraphFromFile(string fileName, GViewer gViewer, bool verbose) {
int eLine, eColumn;
bool msaglFile;
Graph graph = CreateDrawingGraphFromFile(fileName, out eLine, out eColumn, out msaglFile);
lastFileName = fileName;
if (graph == null)
MessageBox.Show(String.Format("{0}({1},{2}): cannot process the file", fileName, eLine, eColumn));

else {

#if TEST_MSAGL
graph.LayoutAlgorithmSettings.Reporting = Test.verbose;
#endif
gViewer.FileName = fileName;
Stopwatch sw = null;
if (verbose) {
gViewer.AsyncLayout = false;
sw = new Stopwatch();
sw.Start();
}
gViewer.Graph = graph;
if (sw != null) {
sw.Stop();
System.Diagnostics.Debug.WriteLine("layout done for {0} ms", (double)sw.ElapsedMilliseconds / 1000);
}
}
}
}
}
61 changes: 61 additions & 0 deletions GraphLayout/tools/FormForGViewer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Microsoft Automatic Graph Layout,MSAGL
Copyright (c) Microsoft Corporation
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
""Software""), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FormForGV")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]


// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit 313c4a7

Please sign in to comment.