diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..a087785bcf --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +root = true +[*] +indent_style = tab \ No newline at end of file diff --git a/.gitignore b/.gitignore index bd3b475b46..d65d9d2e06 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,11 @@ bin/ /src/AddIns/Misc/PackageManagement/Packages/AvalonEdit/lib /packages/ +/src/Tools/ResGet/*.log + + +*.ide/ +*.sdsettings +*.DotSettings.user +*.suo +.DS_Store \ No newline at end of file diff --git a/SharpDevelop.Tests.sln b/SharpDevelop.Tests.sln index 6a3094b7fe..5f0aa86876 100644 --- a/SharpDevelop.Tests.sln +++ b/SharpDevelop.Tests.sln @@ -290,10 +290,10 @@ Global {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU {D68133BD-1E63-496E-9EDE-4FBDBF77B486}.Release|Any CPU.Build.0 = net_4_0_Release|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.Build.0 = Release|Any CPU + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6222A3A1-83CE-47A3-A4E4-A018F82D44D8}.Release|Any CPU.Build.0 = Release|WithNRefactory {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = net_4_5_Debug|Any CPU {3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = net_4_5_Release|Any CPU @@ -322,10 +322,10 @@ Global {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|WithNRefactory {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.Build.0 = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SharpDevelop.sln b/SharpDevelop.sln index 681b50ed21..64f2392bbf 100644 --- a/SharpDevelop.sln +++ b/SharpDevelop.sln @@ -1,10 +1,10 @@  -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -# SharpDevelop 5.0 -VisualStudioVersion = 12.0.20827.3 -MinimumVisualStudioVersion = 10.0.40219.1 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 4.3 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}" EndProject @@ -25,6 +25,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker120", "src\Main\ICSharpCode.SharpDevelop.BuildWorker120\ICSharpCode.SharpDevelop.BuildWorker120.csproj", "{6F273DA5-E10C-45A6-9071-7313ECD98C90}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}" EndProject @@ -54,14 +56,20 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Decompiler", "src\Libraries\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj", "{984CC812-9470-4A13-AFF9-CC44068D666C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{39327899-ED91-4F7F-988C-4FE4E17C014D}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Version Control", "Version Control", "{F208FF4F-E5D8-41D5-A7C7-B463976F156E}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitAddIn", "src\AddIns\VersionControl\GitAddIn\GitAddIn.csproj", "{83F15BA7-8478-4664-81BB-A82F146D88B3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\VersionControl\SubversionAddIn\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}" EndProject @@ -80,6 +88,8 @@ EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBBinding", "src\AddIns\BackendBindings\VBBinding\Project\VBBinding.vbproj", "{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SearchAndReplace", "src\AddIns\Misc\SearchAndReplace\Project\SearchAndReplace.csproj", "{9196DD8A-B4D4-4780-8742-C5762E547FC2}" EndProject @@ -88,6 +98,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddinScout", "src\AddIns\Misc\AddinScout\Project\AddinScout.csproj", "{4B8F0F98-8BE1-402B-AA8B-C8D548577B38}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{59A30AA6-D600-41AB-B7A1-9543469DBE36}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageDataCollector", "src\AddIns\Misc\UsageDataCollector\UsageDataCollector\UsageDataCollector.csproj", "{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}" EndProject @@ -102,6 +114,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTemplating", "src\AddIns\Misc\TextTemplating\Project\TextTemplating.csproj", "{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManagement", "PackageManagement", "{87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement", "src\AddIns\Misc\PackageManagement\Project\PackageManagement.csproj", "{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1}" EndProject @@ -114,12 +128,16 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2", "src\AddIns\Misc\AddInManager2\Project\AddInManager2.csproj", "{60480C2F-F228-4D86-B98F-AF75A7DCEC34}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reports", "Reports", "{4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting\ICSharpCode.Reporting.csproj", "{40CA84D4-ACFC-4646-9CDD-B87262D34093}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reporting.Addin", "src\AddIns\Misc\Reporting\ICSharpCode.Reporting.Addin\ICSharpCode.Reporting.Addin.csproj", "{0502FCF7-72F4-4587-936B-D0238CD0E072}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}" EndProject @@ -134,6 +152,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingsEditor", "src\AddIns\DisplayBindings\SettingsEditor\Project\SettingsEditor.csproj", "{85226AFB-CE71-4851-9A75-7EEC663A8E8A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{5FB020B2-B64B-4016-999A-CB8FD9274D72}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Addin", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Addin\ICSharpCode.Data.Addin.csproj", "{A9F12710-24E4-46D4-832C-6ECB395B9EAD}" EndProject @@ -148,6 +168,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.SQLServer\ICSharpCode.Data.SQLServer.csproj", "{AFE34868-AFA1-4E1C-9450-47AB4BE329D5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{D54BEB89-8CBE-475C-8BB9-836D2FD71260}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" EndProject @@ -162,6 +184,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResourceEditor", "src\AddIns\DisplayBindings\ResourceEditor\Project\ResourceEditor.csproj", "{CBC6C247-747B-4908-B09A-4D2E0F640B6B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{7019F43E-DFD7-4D1C-8C96-E75D55646DE7}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" EndProject @@ -176,6 +200,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQuality", "src\AddIns\Analysis\CodeQuality\CodeQuality.csproj", "{3C532D80-32B4-40E5-B5FE-BC6BAE1A00E7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Profiler", "Profiler", "{E9BF2761-031F-4CDC-A7E6-F66F3B347311}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Controller", "src\AddIns\Analysis\Profiler\Controller\Profiler.Controller.csproj", "{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}" EndProject @@ -186,6 +212,8 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Controls", "src\AddIns\Analysis\Profiler\Frontend\Controls\Profiler.Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E}" + ProjectSection(SolutionItems) = postProject + EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}" EndProject @@ -263,10 +291,10 @@ Global {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.ActiveCfg = Release|Any CPU {2FF700C2-A38A-48BD-A637-8CAFD4FE6237}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|WithNRefactory + {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|WithNRefactory {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Debug|Any CPU.Build.0 = Debug|Any CPU {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -523,20 +551,24 @@ Global {6F273DA5-E10C-45A6-9071-7313ECD98C90} = {256F5C28-532C-44C0-8AB8-D8EC5E492E01} {D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} - {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} - {53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} - {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} - {2B8F4F83-C2B3-4E84-A27B-8DEE1BE0E006} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} - {2A705FC6-1A9E-4941-9E47-254D79F2D9D5} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} {2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} {984CC812-9470-4A13-AFF9-CC44068D666C} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C} + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} + {53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} + {DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} + {2B8F4F83-C2B3-4E84-A27B-8DEE1BE0E006} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} + {2A705FC6-1A9E-4941-9E47-254D79F2D9D5} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} {F208FF4F-E5D8-41D5-A7C7-B463976F156E} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} = {39327899-ED91-4F7F-988C-4FE4E17C014D} + {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {83F15BA7-8478-4664-81BB-A82F146D88B3} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E} {17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E} - {E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94} {E954F3CB-A446-492F-A664-2B376EBC86E8} = {E0646C25-36F2-4524-969F-FA621353AB94} {70966F84-74C9-4067-A379-0C674A929233} = {E0646C25-36F2-4524-969F-FA621353AB94} @@ -545,27 +577,25 @@ Global {E1B288A2-08EE-4318-8BBB-8AB72C69E33E} = {E0646C25-36F2-4524-969F-FA621353AB94} {7048AE18-EB93-4A84-82D0-DD60EB58ADBD} = {E0646C25-36F2-4524-969F-FA621353AB94} {6D209CBB-D8C1-478A-BC30-D3FC87B7858F} = {E0646C25-36F2-4524-969F-FA621353AB94} - {F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {4B8F0F98-8BE1-402B-AA8B-C8D548577B38} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {59A30AA6-D600-41AB-B7A1-9543469DBE36} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {59A30AA6-D600-41AB-B7A1-9543469DBE36} - {0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {59A30AA6-D600-41AB-B7A1-9543469DBE36} {D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {80F76D10-0B44-4D55-B4BD-DAEB5464090C} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {B5D8C3E6-42EC-4D4B-AD05-3644B32563EF} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} + {6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {59A30AA6-D600-41AB-B7A1-9543469DBE36} + {0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {59A30AA6-D600-41AB-B7A1-9543469DBE36} {AE4AB0FA-6087-4480-AF37-0FA1452B3DA1} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} {A406803B-C584-43A3-BCEE-A0BB3132CB5F} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} {1B753D7F-7C77-4D5E-B928-02982690879C} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} {E0A5E80A-003B-4335-A9DC-A76E2E46D38D} = {87D549AF-8FCD-4E84-9C33-3DB6E42FEF6D} - {60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} - {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} = {F3662720-9EA2-4591-BBC6-97361DCE50A9} {40CA84D4-ACFC-4646-9CDD-B87262D34093} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} {0502FCF7-72F4-4587-936B-D0238CD0E072} = {4ABB8D1E-3439-44C8-ACCE-1FA678ABBFB3} - {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} @@ -573,20 +603,19 @@ Global {8AA421C8-D7AF-4957-9F43-5135328ACB24} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {5FB020B2-B64B-4016-999A-CB8FD9274D72} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {D54BEB89-8CBE-475C-8BB9-836D2FD71260} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} + {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {A9F12710-24E4-46D4-832C-6ECB395B9EAD} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {B7823AE9-4B43-4859-8796-2EBDC116FBB8} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {BAD94D6E-4159-4CB6-B991-486F412D9BB6} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {EEF5E054-4192-4A57-8FBF-E860D808A51D} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} {AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {5FB020B2-B64B-4016-999A-CB8FD9274D72} - {D54BEB89-8CBE-475C-8BB9-836D2FD71260} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} {66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} {78CC29AC-CC79-4355-B1F2-97936DF198AC} = {D54BEB89-8CBE-475C-8BB9-836D2FD71260} - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {CBC6C247-747B-4908-B09A-4D2E0F640B6B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} - {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {1F261725-6318-4434-A1B1-6C70CE4CD324} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} {3EAA45A9-735C-4AC7-A799-947B93EA449D} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} {C16BEA37-FEE8-4792-B860-48F5BFBD39A9} = {7019F43E-DFD7-4D1C-8C96-E75D55646DE7} @@ -598,7 +627,6 @@ Global {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311} {FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311} {BDA49550-5ED1-4C6B-B648-657B2CACD8E0} = {E9BF2761-031F-4CDC-A7E6-F66F3B347311} - {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} = {39327899-ED91-4F7F-988C-4FE4E17C014D} {1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} {EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {49CE38B8-0460-46BF-9DFF-5B33A0F9EB5E} EndGlobalSection diff --git a/data/resources/StringResources.cz.resx b/data/resources/StringResources.cz.resx index 4ab1679543..6d188dad77 100644 --- a/data/resources/StringResources.cz.resx +++ b/data/resources/StringResources.cz.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Tento zdroj není používán. Jeho účelem je testování kvality překladu a konce řádku + O pluginu @@ -228,6 +231,171 @@ Neznámý formát souboru: + + Instalovat z archivu... + + + Depozitář: + + + Vyhledat: + + + Zobrazit předinstalované doplňky + + + Zobrazit předběžné vezre + + + AddInManager nelze odinstalovat - je ho třeba k opětovné instalaci doplňků! + + + Depozitář doplňků SharpDevelop + + + Vytvořil: + + + Závislosti: + + + Ke stažení: + + + Soubor: + + + Instalovaná verze: + + + Poslední změna: + + + Více informací + + + Nová verze: + + + Hodnocení: + + + Nahlásit zneužití + + + Verze: + + + Zobrazit licenční podmínky + + + Následující nainstalované doplňky závisí na "{0}": +{1} +Pokud doplněk deaktivujete, přestanou fungovat. Myslíte to vážně? + + + Balíček "{0}" potřebuje přinejmenším jeden další balíček, a to +{1} +Aplikace se vše potřebné také pokusí stáhnout a nainstalovat. Pokračovat? + + + Vybraný balíček neobsahuje platný doplněk SharpDevelop. + + + &Akceptuji + + + O&dmítám + + + Volbou "Akceptuji" vyjadřujete souhlas s licenčním ujednáním pro uvedený balíček. Pokud s licenčními podmínkami nesouhlasíte, zvolte "Odmítám". + + + Volbou "Akceptuji" vyjadřujete souhlas s licenčním ujednáním pro výše uvedený balíčky. Pokud s licenčními podmínkami nesouhlasíte, zvolte "Odmítám". + + + Následující balíček vyžaduje potvrdit licenční podmínky: + + + Následující balíčky vyžadují potvrdit licenční podmínky: + + + Licenční ujednání + + + Přidat + + + Automaticky vyhledávat aktualizace + + + Posunout dolů + + + Posunout nahoru + + + Jméno: + + + Odstranit + + + Zdroj: + + + Doplňky + + + Obecné + + + Depozitáře + + + Následující instalované doplňky závisí na "{0}": +{1} +Ty přestanou fungovat, pokud první doplněk odstraníte! Skutečně to chcete udělat? + + + Doplňky SharpDevelop |*.sdaddin;*.addin|Všechny soubory|*.* + + + Klikněte pro zobrazení aktualizací. + + + Jsou k dispozici aktualizace SharpDevelop + + + K dispozici + + + Nainstalováno + + + Aktualizace + + + Soubor obsahuje nekonzistentní znaky konce řádku. + + + Nekonzistentní odřádkování + + + Normalizovat + + + Chyba: + + + Najít další + + + Najít předchozí + + + Použít regulární výrazy + Ukázat diagram třídy @@ -240,6 +408,57 @@ Zobrazit Obsah + + Vyhledat + + + Knihovna nápovědy + + + Nastavit předvolby nápovědy + + + Nelze spustit Správce nápovědy, protože nebyl nainstalován nebo zvolen žadý katalog nápovědy. Zkontrolujte nastavení nápovědy (Nástroje > Volby > Nástroje > Microsoft Help Viewer). + + + Správce nápovědy nebyl nalezen. Chcete-li používat funkce nápovědy SharpDevelop, stáhněte si a nainstalujte MS Windows SDK 7.1. + + + Správce nápovědy (Help Library Manager) nebyl nalezen. Zkontrolujte, zda byl správně nainstalován. + + + Instalované katalogy nápovědy + + + Spustit správce nápovědy + + + Prohlížeč nápovědy Microsoft + + + Požadujete offline funkcionality v online módu. Aby byla použitelná, musíte změnit mód. + + + Vyhledat + + + Hledat: + + + Hledání + + + Ukázat nápovědu + + + Užívat externí prohlížeč nápovědy + + + Chci používat lokální nápovědu + + + Chci používat online nápovědu + Zpět @@ -270,6 +489,51 @@ Nadpis + + Výsledek + + + Zatříděné uzly + + + Všechny funkce pro {0} + + + Vybraná SharpDevelop profiling session byla vytvořena novější verzí SharpDevelopu, tudíž bohužel nejde otevřít. + + + Profilovací seance SharpDevelop + + + Projekt nemůže nastartovat, protože nebyl nalezen EXE. Zkontrolujte, zda projekt včetně všech závislostí byl korektně sestaven. + + + Žádný projekt schopný startu nebyl nalezen. Zazvonil zvonec... + + + Projekt nelze nastartovat. Chcete místo toho profilovat StartUp projekt celého řešení? + + + Příprava analýzy ... + + + Nelze zaregistrovat profiler v COM registry. Profilování nelze zahájit. + + + Profiler nelze odebrat z COM registry! + + + Volba EXE k profilování + + + Neplatné údaje. Zkuste to znovu a lépe! + + + Argumenty příkazového řádku: + + + Zvolte cestu k profilovanému EXE. Navíc můžete zvolit pracovní složku a parametry příkazového řádku. + Hledat... @@ -336,12 +600,24 @@ Upravit konflikty + + Chyba při mazání ${File} + Export + + Smazat natvrdo + Historie + + '{0}' odstraněn ze seznamu k ignoraci + + + Zámek pro get + Označit konflikty za vyřešené @@ -372,12 +648,18 @@ Odebrat ze seznamu ignorovaných + + Sobor sem byl právě přesunut, chcete ho vážně zase smazat? + Průzkumník repository Revert + + Soubor má lokálni změny. Skutečně ho chcete odstranit? + Graf revizí @@ -4995,9 +5277,6 @@ Soubory resources byly přejmenovány/přesunuty, aby tomu odpovídaly. Grafická jednotka - - Základní nastavení sestavy - Model sestavy @@ -5031,15 +5310,6 @@ Soubory resources byly přejmenovány/přesunuty, aby tomu odpovídaly. Dostupná pole - - Cesta ke XML schématu (.xsd) - - - Uložit výsledek (schéma a data) - - - Uložit výsledek (pouze schéma) - Zobrazit výsledky dotazu @@ -6155,7 +6425,4 @@ Došlo k chybě při spuštění: Odkomentovat oblast - - Tento zdroj není používán. Jeho účelem je testování kvality překladu a konce řádku - \ No newline at end of file diff --git a/data/resources/StringResources.de.resx b/data/resources/StringResources.de.resx index 7b472272c9..026bebfe3b 100644 --- a/data/resources/StringResources.de.resx +++ b/data/resources/StringResources.de.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 6e61ff43-0241-47da-95bd-2ab6cd6d60f7 + Über... @@ -291,7 +294,7 @@ Laden Sie ein AddIn aus dem Internet herunter, klicken Sie auf "AddIn installier {1} -Sie werden nicht mehr funktionieren nachdem dieses AddIn deaktiviert wurde! Sind Sie sicher, dass Sie fortfahren möchten? +Sie werden nicht mehr funktionieren, nachdem dieses AddIn deaktiviert wurde! Sind Sie sicher, dass Sie fortfahren möchten? Das Paket "{0}" benötigt noch mindestens ein zusätzliches Paket: @@ -329,6 +332,9 @@ Wenn Sie den Lizenzbedingungen nicht zustimmen, klicken Sie auf "Ablehnen". Hinzufügen + + Automatisch nach Updates suchen + Nach unten @@ -347,6 +353,9 @@ Wenn Sie den Lizenzbedingungen nicht zustimmen, klicken Sie auf "Ablehnen". AddIns + + Allgemein + Quellen @@ -399,6 +408,9 @@ Sie werden nicht mehr funktionieren, nachdem dieses AddIn entfernt wurde! Sind S Klassendiagramm anzeigen + + Verlauf löschen + TortoiseGit muss installiert sein, um diese Aktion auszuführen. @@ -1198,9 +1210,7 @@ Ein Ausführungskommando kann in den Projektoptionen eingestellt werden. Ink - Sie protokollieren keine Ereignisse. - -Wählen Sie ein Objekt oder ein Ereignis im Objekte-Panel und klicken Sie mit der rechten Maustaste oder benutzen Sie das "Aktion"-Menü um mit dem Protokollieren von Ereignissen zu beginnen. + Sie protokollieren keine Ereignisse. Wählen Sie ein Objekt oder ein Ereignis im Objekte-Panel und klicken Sie mit der rechten Maustaste oder benutzen Sie das "Aktion"-Menü um mit dem Protokollieren von Ereignissen zu beginnen. Parameter @@ -1531,6 +1541,30 @@ Um ActiveX/COM-Objekte zu generieren, ziehen sie eine Klasse aus einer Typbiblio Code-Qualitätsanalyse + + Code automatisch formatieren + + + (Standard) + + + (Global) + + + Keine Formatierungsvoreinstellung ausgewählt! + + + Sind Sie sicher, dass Sie alle Formatierungseinstellungen zurücksetzen wollen? + + + (Projekt) + + + Zurücksetzen auf: + + + (Projektmappe) + Füge Reference zu Methode ein; drücke Tab oder Enter zweimal, um eine neue Methode anzulegen. @@ -1540,6 +1574,9 @@ Um ActiveX/COM-Objekte zu generieren, ziehen sie eine Klasse aus einer Typbiblio Anonyme Methode mit Parametern einfügen. + + Spalten: + Über SharpDevelop @@ -1647,6 +1684,9 @@ Beispiele: "120", "MainClass", "Main.cs, 120". Kursiv + + Unterstrichen + Hervorhebungsfarben exportieren @@ -1951,6 +1991,12 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Cache leeren + + Den gewählten Code completion-Eintrag bei Eingabe der folgenden Zeichen einfügen: + + + Den gewählten Code completion-Eintrag nur bei <Tab> oder <Enter> einfügen. + Zeige Code Completion, wenn ein Buchstabe eingegeben wird @@ -1972,6 +2018,18 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Speichere + + Tooltip-Einstellungen + + + Links in Tooltips führen zur + + + Definition im Code + + + Dokumentation (falls verfügbar) + Häufig benutzte Einträge bevorzugt markieren @@ -2026,12 +2084,24 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Auf erster Anweisung des Programmes anhalten. + + Ausnahmen auswählen + Decompiler aktivieren Bearbeiten und Fortfahren (EnC) aktivieren + + Voller Name der Ausnahme + + + Unterbrechen bei + + + Wählen Sie Ausnahmen aus, bei denen der Debugger anhalten soll + Ausnahmen @@ -2344,6 +2414,9 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? &Passende Klammer markieren + + Aktuelle Zeile hervorheben + Symbole hervorheben @@ -2422,6 +2495,9 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Verzeichnis auswählen in dem die Assembly generiert wird. + + Service Referenzen + Hervorhebung @@ -2605,6 +2681,9 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Standardwerte für VB Optionen: + + Codeformatierung + Konfiguration @@ -2614,6 +2693,12 @@ Wollen Sie die neue Datei zum Projekt ${CurrentProjectName} hinzufügen? Ändern der Konfiguration will die aktuellen Werte speichern. Fortfahren? + + Dateinamen: + + + Beim Erstellen ausführen + Debuggen @@ -2791,6 +2876,9 @@ Sie können die Einstellungen auch in einer .user-Datei anstelle der Projektdate Bestehende Klasse verwenden: + + Probleme automatisch beheben, falls möglich + .NET Assemblybrowser @@ -3043,12 +3131,27 @@ Sie können die Einstellungen auch in einer .user-Datei anstelle der Projektdate Ersetzen + + Zurücksetzen + Wiederholen &Alle auswählen + + Alt + + + Strg + + + Umsch + + + Win + Kleine Icons @@ -3311,6 +3414,9 @@ Bitte einen anderen Dateinamen wählen. Nicht abgedeckter Code + + Code teilweise abgedeckt + Spalte @@ -3583,6 +3689,9 @@ Bitte stellen Sie den Pfad zur NAnt-Anwendung in den SharpDevelop-Optionen ein.< Konnte Typ '{0}' nicht finden. Fehlt eine Assembly-Referenz? + + Es konnte keine Typ- oder Member-Definition an der Cursor-Position gefunden werden. + Das gewählte Element ist keine Klasse oder überschreibbares Mitglied, daher können keine Symbole angezeigt werden. @@ -4302,6 +4411,9 @@ Grund: Der Wert zu dem zurückgesetzt werden soll ist ungültig weil sich eine a Die Projektmappe wurde extern geändert. + + Formatierungsoptionen der Projektmappe + Neue &Compilerversion: @@ -5023,6 +5135,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Assembly aus GAC öffnen... + + Im Klassenbrowser anzeigen + Suche nach Klassenname @@ -5041,6 +5156,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Zeilenumbruch aktivieren/deaktivieren + + Ausdruck zur Überwachung hinzufügen + Haltepunkte @@ -5143,6 +5261,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Unterbrechen + + Unterbrechen bei behandelter ${ExceptionName} + Fortsetzen @@ -5533,6 +5654,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Aufgaben + + Alle geöffneten Dateien + + + Klasse/Modul + + + Datei + + + Namespace + + + Projekt + + + Projektmappe + Tools @@ -5686,6 +5825,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Referenz hinzufügen + + Service-Referenz hinzufügen + Web Referenz hinzufügen @@ -5941,15 +6083,27 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Ersetze mit anderer Bitmap ... + + Cursor aktualisieren ... + + + Icon aktualisieren ... + Möchten Sie wirklich die ausgewählte(n) Ressource(n) löschen? Ressource löschen + + Filter: + Kann Resource nicht laden: + + Kann Ressource nicht aus Datei laden: {0} + Fehler: Ressourcen-Codegenerator überspringt die Ressourcendatei "{0}", weil die generierte Klasse mit der bestehenden Klasse "{1}" kollidieren würde. @@ -5962,8 +6116,11 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Inhalt + + Boolean Eintrag hinzufügen + - &Files hinzufügen... + Dateien hinzu&fügen... String hinzufügen... @@ -6083,6 +6240,9 @@ Bitte einen anderen verwenden. Basisklassen von ${Name} + + Basis-Member von ${Name} + Die Operation kann nicht ausgeführt werden, weil Ihr Sourcecode Fehler enthält: @@ -6095,6 +6255,12 @@ Bitte einen anderen verwenden. Klassen, die von ${Name} erben + + Aus Zwischenablagering + + + Der Zwischenablagering ist leer + In automatische Eigenschaft konvertieren @@ -6125,6 +6291,9 @@ Bitte einen anderen verwenden. Finde Basisklassen + + Finde Basissymbole + Abgeleitete Typen finden @@ -6231,7 +6400,7 @@ Bitte einen anderen verwenden. Alle bekannten Projektformate - Diese Version von SharpDevelop kann keine Projekte, die mit Visual Studio .NET 2003 (oder früher) erstellt wurden. + Diese Version von SharpDevelop kann keine Projekte laden, die mit Visual Studio .NET 2003 (oder früher) erstellt wurden. Versuchen Sie das Projekt mit SharpDevelop 3.2 zu konvertieren, oder erstellen Sie ein neues Projekt und fügen Sie ihm die existierenden Quellcodedateien hinzu. @@ -6437,9 +6606,6 @@ SharpDevelop 2 kompiliert Ressourcendateien anders: der Ressourcenname ist nicht Einheit - - Grundlegende Berichtseinstellungen - Report-Modell @@ -6488,15 +6654,6 @@ SharpDevelop 2 kompiliert Ressourcendateien anders: der Ressourcenname ist nicht Verfügbare Felder - - Pfad zur XSD Schemadatei - - - Speichern (Schema und Daten) - - - Speichern (nur Schema) - Abfrageergebnis anzeigen @@ -6560,6 +6717,9 @@ SharpDevelop 2 kompiliert Ressourcendateien anders: der Ressourcenname ist nicht Projektmappe öffnen + + Aus der Liste der kürzlich verwendeten Projekte entfernen + Startseite @@ -6572,6 +6732,12 @@ SharpDevelop 2 kompiliert Ressourcendateien anders: der Ressourcenname ist nicht Z ${Line} S ${Column} Zei ${Character} + + Lg ${Rows} * ${Cols} (${Total}) + + + Lg ${Length} + Sonstiges @@ -7602,6 +7768,9 @@ Soll der Debugger angehalten werden? Inkrementelle Suche rückwärts + + Nach Problemen suchen... + Lesezeichen s&etzen @@ -7718,10 +7887,10 @@ Fehler beim Starten: Refactoring + + Neu formatieren + Kommentar entfernen - - 6e61ff43-0241-47da-95bd-2ab6cd6d60f7 - \ No newline at end of file diff --git a/data/resources/StringResources.es-mx.resx b/data/resources/StringResources.es-mx.resx index c7228b56d4..88cfab51ab 100644 --- a/data/resources/StringResources.es-mx.resx +++ b/data/resources/StringResources.es-mx.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Este recurso no es utilizado. Su propósito es probar la base de datos de traducción y tiene +un retorno de línea. + Acerca de @@ -405,6 +409,9 @@ Dejarán de funcionar después de desinstalar este complemento! ¿Esta seguro de Mostrar Diagrama de Clase + + Borrar Historial + TortoiseGit necesita ser instalado para ejecutar esta acción. @@ -522,6 +529,21 @@ Dejarán de funcionar después de desinstalar este complemento! ¿Esta seguro de Título + + Consola del Administrador de Paquetes + + + Paquetes Administrados... + + + Paquetes Restaurados + + + Origenes de Paquete + + + Administrador de paquetes + Resultado @@ -1538,6 +1560,30 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Análisis de Calidad de Código + + Formatear código automáticamente + + + (predeterminado) + + + (global) + + + No se seleccionó un formato preestablecido! + + + ¿Esta seguro/a que quiere restablecer todas las opciones de formato previamente definidas? + + + (proyecto) + + + Restablecer a: + + + (solución) + Inserta una referencia a un método explicito; presione tabulador o enter otra vez para insertar una nueva porción de método. @@ -1547,6 +1593,17 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Inserte un método anónimo con parámetros. + + <Crear $[HandlerName]> + + + Use arriba/abajo para moverse a otra ubicación. +Enter para seleccionar ubicación. +Esc para cancelar esta operación. + + + Columnas + Acerca de SharpDevelop @@ -1568,6 +1625,27 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Versión + + Operaciones: + + + Servicios: + + + Interno + + + Publico + + + Nivel de acceso para las clases generadas: + + + Generar opeaciones asyncronas + + + Cliente + archivos recientes @@ -1654,6 +1732,9 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Itálica + + Subrayado + Exportar colores de resaltado @@ -1959,6 +2040,12 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Borrar caché + + Inserte entrada de autocompletado de código seleccionado escribiendo los siguientes caracteres: + + + Inserte solamente entrada de autocompletado de código seleccionado escribiendo <Tab> o <Enter>. + Mostrar lista de completado después de escribir un carácter @@ -1980,6 +2067,18 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Guardar + + Preferencias de Tooltip + + + Enlaces en tooltips deben ir en + + + Definición en código + + + Documentación (si esta disponible) + Pre-seleccionar miembros usados recientemente @@ -2022,6 +2121,12 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". &Utilizar nombres completos de tipos + + Formateando + + + Inspeccion de codigo + Codificación @@ -2034,12 +2139,21 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Detenerse en la primera línea de ejecución. + + Seleccionar excepciones + Habilitar decompilador Habilitar Editar y Continuar + + Nombre completo de la Excepcion + + + Pausa + Excepciones @@ -2352,6 +2466,9 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Resaltar &corchetes + + Resaltar la línea actual + Resaltar símbolos @@ -2430,6 +2547,9 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Seleccione el directorio para crear el ensamblado. + + Referencia del servicio + Resaltado @@ -2613,6 +2733,9 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Valores predeterminados de VB: + + Formato de Código + &Configuración @@ -2622,6 +2745,12 @@ Ejemplo: "120", "MainClass", "Main.cs, 120". Al cambiar la configuración se guardarán los valores actuales. ¿Continuar? + + Nombres de archivo + + + Ejecutar al compilar + Depurar @@ -2798,6 +2927,9 @@ También puede elegir guardar la opción en el archivo .user en lugar de en el a Usar clase existente: + + Reparar problemas automaticamente, si se puede + Explorador de ensamblados .NET @@ -3050,12 +3182,27 @@ También puede elegir guardar la opción en el archivo .user en lugar de en el a Reemplazar + + Reset + Reintentar Seleccion&ar Todo + + Alt + + + Ctrl + + + Win + + + Win + Iconos pequeños @@ -3317,9 +3464,15 @@ También puede elegir guardar la opción en el archivo .user en lugar de en el a Código No Cubierto + + Código Parcialmente Cubierto + Columna + + Contenido + Opciones de Vista @@ -3587,6 +3740,9 @@ Por favor configure la ubicación del archivo ejecutable de NAnt en las opciones No se pudo encontrar el tipo '{0}'.¿Falta una referencia a un ensamblado? + + No se pudo encontrar una definición de tipo o de miembro en la posición del cursor. + El elemento seleccionado no es una clase o miembro sobrescribible, así que no se puede mostrar ningún símbolo derivado. @@ -4298,6 +4454,9 @@ Utilice solamente letras, dígitos, espacio, '.' ó '_'. La solución ha sido cambiada externamente. + + Opciones de Formato de Soluciones + Convertir &proyectos seleccionados a: @@ -4885,6 +5044,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Generación finalizada correctamente. + + La compilación del projecto $[Name] no esta soportada + Generación iniciada. @@ -5473,6 +5635,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Depurar + + <El texto se ha recortado debido a que es muy largo> + Proyectos @@ -5536,6 +5701,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Lista de Tareas + + Todos los archivos abiertos + + + Clase/Modulo + + + Archivo + + + Namespace + + + Projecto + + + Solucion + Herramientas @@ -5689,6 +5872,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Agregar referencia + + Agregar Referencia a Servicio + Agregar Referencia Web @@ -5944,15 +6130,27 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Actualizar bitmap... + + Actualizar cursor ... + + + Icono de Actualización ... + ¿Realmente desea eliminar los recursos seleccionados? Eliminar recursos + + Filtro: + No se pudo cargar el recurso + + No se puede cargar el recurso desde el archivo : {0} + Error: El generador de recursos de código esta omitiendo el archivo de recurso "{0}" debido a que el la clase generada entraría un conflicto con la clase existente "{1}". @@ -5965,6 +6163,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Contenido + + Agregar valor &boolean + Agregar a&rchivos... @@ -6085,6 +6286,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Buscar clases base de ${Name} + + Miembros base de ${Name} + La operación no puede ser realizada debido a que su código fuente contiene errores: @@ -6097,6 +6301,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Clases derivadas de ${Name} + + Pegar desde el anillo del portapapeles... + + + El anillo del portapapeles esta vacío + Convertir a propiedad automática @@ -6127,6 +6337,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Buscar clases base + + Buscar símbolos base + Buscar clases &derivadas @@ -6431,15 +6644,15 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. Tipo de Reporte + + Configuracions basicas del reporte + Nombre de Archivo Unidad Gráfica - - Configuración básica de reporte - Modelo de Reporte @@ -6473,6 +6686,9 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. Diseño de Tabla + + Formato de página + Usar Modelo de Datos @@ -6488,18 +6704,18 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. Campos Disponibles - - Ruta a Esquema de Archivo (.xsd) + + No se ha seleccionado un projecto, por favor proporcione la informacion - - Guardar Resultado (Esquema y Datos) - - - Guardar Resultado (Esquema solamente) + + Clases del projecto seleccionado Mostrar resultado de la Consulta + + Bienvenido al asistente de SharpReport + &Agregar Pestaña @@ -6560,6 +6776,9 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. Abrir solución + + Quitar de la lista de proyectos recientes + Página de Inicio @@ -6572,6 +6791,12 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. ln ${Line} col ${Column} car ${Character} + + len ${Rows} * ${Cols} (${Total}) + + + len ${Length} + Varios @@ -7601,6 +7826,9 @@ Los archivos de recursos han sido renombrados/movidos convenientemente. Invertir Búsqueda Incremental + + Buscar Problemas... + &Alternar marcador @@ -7716,11 +7944,10 @@ Error al iniciar: Refactorizar + + Re formatear + Descomentar región - - Este recurso no es utilizado. Su propósito es probar la base de datos de traducción y tiene -un retorno de línea. - \ No newline at end of file diff --git a/data/resources/StringResources.es.resx b/data/resources/StringResources.es.resx index c259400fca..c3886f0541 100644 --- a/data/resources/StringResources.es.resx +++ b/data/resources/StringResources.es.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Este recurso no se está usando. Su propósito es probar la base de datos de traducción y tiene +un salto de línea + Acerca de... @@ -1537,6 +1541,30 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Análisis de Calidad de Código + + Formatear código automáticamente + + + (predeterminado) + + + (global) + + + No se seleccionó un formato preestablecido! + + + ¿Esta seguro/a que quiere restablecer todas las opciones de formato previamente definidas? + + + (proyecto) + + + Restablecer a: + + + (solución) + Inserta una referencia a un método explicito; presione tabulador o enter otra vez para insertar un nuevo trozo de método. @@ -1651,6 +1679,9 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Cursiva + + Subrayado + Exportar colores de resaltado @@ -1956,6 +1987,12 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Limpiar caché + + Inserte la entrada de autocompletado de código seleccionada escribiendo los siguientes caracteres: + + + Inserte solamente la entrada de autocompletado de código seleccionado escribiendo <Tab> o <Enter> + Mostrar lista de completado después de escribir un carácter @@ -1977,6 +2014,18 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Guardar + + Preferencias de Tooltip + + + Enlaces en tooltips deben ir a + + + Definición en código + + + Documentación (si esta disponible) + Pre-seleccionar miembros utilizados recientemente @@ -2031,6 +2080,9 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Detener ejecución en la primera línea. + + Seleccione excepciones + Habilitar decompilador @@ -2349,6 +2401,9 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Resaltar &corchetes + + Resaltar la línea actual + Resaltar símbolos @@ -2610,6 +2665,9 @@ Para crear/manipular un objeto ActiveX/COM, arrastre una clase de un Control/Bib Valores por defecto para Opciones de VB: + + Formato de Código + &Configuración @@ -3319,9 +3377,15 @@ También puede escoger almacenar el parámetro de configuración en el archivo . Código No Cubierto + + Código Parcialmente Cubierto + Columna + + Contenido + Opciones de Vista @@ -3588,6 +3652,9 @@ Por favor configure la ubicación del archivo ejecutable de NAnt en las opciones No se pudo encontrar el tipo '{0}'.¿Falta una referencia a un ensamblado? + + No se pudo encontrar definición de tipo o de miembro en la posición del cursor. + El elemento seleccionado no es una clase o miembro sobrescribible, así que no se puede mostrar ningún símbolo derivado. @@ -4303,6 +4370,9 @@ Solamente letras, dígitos, espacio, '.' o '_' son permitidos. La solución ha sido cambiada externamente. + + Opciones de Formato de Soluciones + Convertir &proyectos seleccionados a: @@ -5695,6 +5765,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Agregar Referencia + + Agregar Referencia a Servicio + Agregar Referencia Web @@ -6091,6 +6164,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Clases base de ${Name} + + Miembros base de ${Name} + La operación no puede ser realizada debido a que su código fuente contiene errores: @@ -6103,6 +6179,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Clases derivadas de ${Name} + + Pegar desde el anillo del portapapeles... + + + El anillo del portapapeles esta vacío + Convertir a propiedad automática @@ -6133,6 +6215,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Buscar clases base + + Buscar símbolos base + Encontrar clases &derivadas @@ -6444,9 +6529,6 @@ Los archivos de recursos han sido renombrados o cambiados de ubicación de acuer Unidad Grafica - - Configuración base de reporte - Modelo de Reporte @@ -6495,15 +6577,6 @@ Los archivos de recursos han sido renombrados o cambiados de ubicación de acuer Campos Disponibles - - Ruta de archivo de esquema (.xsd) - - - Guardar Resultado (Esquema y Datos) - - - Guardar Resultado (Esquema solamente) - Mostrar resultado de la Consulta @@ -6567,6 +6640,9 @@ Los archivos de recursos han sido renombrados o cambiados de ubicación de acuer Abrir solución + + Quitar de la lista de proyectos recientes + Página de inicio @@ -6579,6 +6655,12 @@ Los archivos de recursos han sido renombrados o cambiados de ubicación de acuer ln ${Line} col ${Column} car ${Character} + + len ${Rows} * ${Cols} (${Total}) + + + len ${Length} + Misceláneo @@ -7726,8 +7808,4 @@ Error mientras se iniciaba: Descomentar Región - - Este recurso no se está usando. Su propósito es probar la base de datos de traducción y tiene -un salto de línea - \ No newline at end of file diff --git a/data/resources/StringResources.fi.resx b/data/resources/StringResources.fi.resx index 065d4426d9..8a9ca88ef8 100644 --- a/data/resources/StringResources.fi.resx +++ b/data/resources/StringResources.fi.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Resurssia ei käytetä. Sen tarkoituksena on testata suomennosta ja rivinvaihtoa. + About SharpDevelop, finnish lang dev: Pekka Herala domain: sivustot.net @@ -4519,9 +4522,6 @@ Resurssitiedostoja on nimetty uudelleen / siirretty. Grafiikka yksikkö - - Perusasetukset ryhmälle - Raporttimalli @@ -4564,15 +4564,6 @@ Resurssitiedostoja on nimetty uudelleen / siirretty. Saatavilla olevat kentät - - Polku skeema (. xsd) tiedostoon - - - Tallenna (schema ja data) - - - Tallenna (vain schema) - Näytä kyselytulokset @@ -5654,7 +5645,4 @@ Työkalusarja, joka rakentaa Windows asennuspaketteja XML-lähdekoodilla. Sarja Kommentti valinta - - Resurssia ei käytetä. Sen tarkoituksena on testata suomennosta ja rivinvaihtoa. - \ No newline at end of file diff --git a/data/resources/StringResources.fr.resx b/data/resources/StringResources.fr.resx index 5622eea6cc..5e2fc361d7 100644 --- a/data/resources/StringResources.fr.resx +++ b/data/resources/StringResources.fr.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Cette ressource n'est pas utilisée. Son but est de tester la base de données de traduction. + A propos @@ -206,7 +209,7 @@ Vous n'avez aucun AddIn installé. -Téléchargez un AddIn depuis l'Internet, cliquez ensuite sur 'Installer un AddIn' et choisissez le fichier téléchargé pour l'installer. +Téléchargez un AddIn depuis Internet, cliquez ensuite sur 'Installer un AddIn' et choisissez le fichier téléchargé pour l'installer. Ouvrir le site Web @@ -287,17 +290,11 @@ Téléchargez un AddIn depuis l'Internet, cliquez ensuite sur 'Installer un AddI Voir le contrat de license - Les Add-Ins installés suivant sont dépendant de "{0}": - -{1} - + Les Add-Ins installés suivant sont dépendant de "{0}": {1} Ils ne fonctionneront plus si vous désactivez cet Add-In! Souhaitez-vous continuer? - Package "{0}" nécessite au moins une dépendance: - -{1} - + Package "{0}" nécessite au moins une dépendance: {1} L'application va essayer de les télécharger et de les installer. Souhaitez-vous continuer? @@ -314,8 +311,8 @@ L'application va essayer de les télécharger et de les installer. Souhaitez-vou Si vous ne le souhaitez pas, veuillez cliquer "Je décline". - En cliquant "J'accepte", vous êtes d'accord pour la license des packages suivant. -Si vous ne le souhaitez pas, veuillez cliquer "Je décline". + En cliquant sur "J'accepte", vous êtes d'accord pour la license des packages suivant. +Si vous ne le souhaitez pas, veuillez cliquer sur "Je décline". Le package suivant nécessite que vous acceptiez sa license: @@ -357,10 +354,7 @@ Si vous ne le souhaitez pas, veuillez cliquer "Je décline". Dépots - Les Add-Ins installés suivant sont dépendants de "{0}": - -{1} - + Les Add-Ins installés suivant sont dépendants de "{0}": {1} Ils ne fonctionneront plus si vous désinstallez cet Add-In! Souhaitez-vous continuer? @@ -405,6 +399,33 @@ Ils ne fonctionneront plus si vous désinstallez cet Add-In! Souhaitez-vous cont Afficher le diagramme des classes + + Effacer la console + + + Effacer l'historique + + + 'git.exe' est introuvable dans le dossier sélectionné! + + + Git n'est pas installé. + + + Choisir l'emplacement de Git + + + Emplacement de Git + + + Réinitialiser l'emplacement de Git. + + + Options Git + + + (détecté automatiquement) + TortoiseGit doit être installé pour exécuter cette action. @@ -522,6 +543,21 @@ Ils ne fonctionneront plus si vous désinstallez cet Add-In! Souhaitez-vous cont Titre + + Console de gestion des packages + + + Gestion des packages... + + + Réinitialiser les packages... + + + Sources de packages... + + + Gestion des packages + Résultat @@ -538,7 +574,7 @@ Ils ne fonctionneront plus si vous désinstallez cet Add-In! Souhaitez-vous cont Session de profilage SharpDevelop - Ce projet ne peut pas démarrer, exécutable introuvable, assurez-vous que le projet et toutes ses dépendances sont construites. + Ce projet ne peut pas démarrer, l'exécutable est introuvable. Assurez-vous que le projet et toutes ses dépendances sont compilées correctement! Aucun projet n'est démarrable. Arrêt... @@ -1026,7 +1062,7 @@ Sauvegardez ces fichiers avant de déclencher l'opération. Sauvegarder en UTF-8 - Le projet est configuré comme dll et aucune commande a exécuter n'a été spécifiée. Vous pouvez spécifier une commande a exécuter dans les options du projet. + Le projet est configuré comme DLL et aucune commande a exécuter n'a été spécifiée. Vous pouvez spécifier une commande a exécuter dans les options du projet. Compiler un fichier seul n'est pas possible, veuillez créer un projet! @@ -1569,6 +1605,15 @@ Pour créer ou manipuler un objet ActiveX/COM, déplcaer une classe depuis TypeL Insérer une méthode anonyme avec paramètres. + + < Créer ${HandlerName} > + + + Utiliser Haut/Bas pour déplacer vers un autre emplacement. Appuyer sur Enter pour sélectionner cet emplacement. Appuyer sur ESC pour annuler. + + + Colonnes: + A propos de SharpDevelop @@ -1590,6 +1635,27 @@ Pour créer ou manipuler un objet ActiveX/COM, déplcaer une classe depuis TypeL Version + + Opérations: + + + Services: + + + Internal + + + Public + + + Niveau d'accès pour les classes générées: + + + Générer des opérations asynchrones + + + Client + fichiers récents @@ -1660,7 +1726,8 @@ Pour créer ou manipuler un objet ActiveX/COM, déplcaer une classe depuis TypeL Aller à la ligne - Veuillez entrer une expression à atteindre. Vous pouvez donner un numéro de ligne, un nom de classe ou de fichier ("120", "MainClass" "Main.cs, 120" par exemple). + Veuillez entrer une expression à atteindre. Vous pouvez donner un numéro de ligne, un nom de classe ou de fichier. +Exemples: "120", "MainClass" "Main.cs, 120". Couleur de l'arrière-plan @@ -1674,6 +1741,9 @@ Pour créer ou manipuler un objet ActiveX/COM, déplcaer une classe depuis TypeL Italique + + Souligné + Exporter les couleurs de surlignage @@ -1979,6 +2049,12 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Vider le cache + + Insérer l'entrée Intellisense via les caractères suivants: + + + Insérer la sélection Intellisense uniquement par appui sur <Tab> ou <Entrée> + Montrer la liste de suggestions sur une saisie de caractères @@ -2000,6 +2076,9 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Enregistrer + + Paramètres des info-bulles + Les liens avec les info-bulles doivent aller vers @@ -2051,6 +2130,12 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? &Utiliser des noms de type complets + + Formatage + + + Inspection de code + Codage @@ -2063,12 +2148,24 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Arrêt sur la première ligne. + + Choisir les exceptions + Activer la décompilation Activer "Editer et Continuer" + + Nom complet de l'exception + + + Arrêt sur + + + Choisir les exceptions sur lesquelles le deboggueur s'arrêtera + Exceptions @@ -2462,6 +2559,9 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Sélectionner le répertoire de création de l'assembly. + + Références du service + Surlignement @@ -2519,6 +2619,69 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Fichier de r&essources Win32: + + Informations sur l'Assembly + + + Fichier Assembly.info introuvable. Veuillez vous assurer qu'il existe dans le projet. + + + Version: + + + Conforme CLS + + + Société: + + + Copyright: + + + Alias par défaut: + + + Description: + + + Version du fichier: + + + GUID: + + + Une valeur du fichier Assembly.info est incorrecte. + + + Version informelle: + + + Optimisation JIT + + + Suivi JIT + + + Rendre l'Assembly visible par COM: + + + Language neutre: + + + Nouveau GUID + + + Aucun + + + Produit: + + + Titre: + + + Trademark: + Avancé @@ -2645,6 +2808,9 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Valeurs par défaut des options VB: + + Formatage du code + &Configuration @@ -2654,6 +2820,12 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Changer la configuration enregistrera les valeurs en cours. Continuer? + + Noms de fichier: + + + Lancer après la construction + Déboguage @@ -2794,7 +2966,7 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Le petit button devant chaque option de configuration vous permet de choisir l'endroit où est enregistré la configuration. -'Configuration-specific' signigie que la configuration est appliqué au type de Projet (Debug/Release). +'Configuration-specific' signifie que la configuration est appliquée au type de Projet (Debug/Release). 'Platform-specific' signifie que la configuration peut avoir une valeur différente par plateforme. Vous pouvez aussi choisir de stocker la configuration dans le fichier .user-file au lieu du projet, permettant à chaque développeur d'utiliser une valeur différente sans entrer en conflit avec le système de gestion du code source. @@ -2831,6 +3003,9 @@ Vous pouvez aussi choisir de stocker la configuration dans le fichier .user-file Utiliser la classe existante: + + Corriger les erreurs automatiquement si possible + Browser d'assemblies .NET @@ -3083,12 +3258,27 @@ Vous pouvez aussi choisir de stocker la configuration dans le fichier .user-file Remplacer + + Réinitialiser + Réessayer Sélectionner tout + + Alt + + + Ctrl + + + Shift + + + Win + Petites icônes @@ -3484,7 +3674,6 @@ Vous pouvez aussi choisir de stocker la configuration dans le fichier .user-file Impossible de trouver NAnt '{0}'. - Configurez le chemin vers NAnt dans les options de SharpDevelop. @@ -3625,6 +3814,9 @@ Configurez le chemin vers NAnt dans les options de SharpDevelop. Impossible de trouver le type '{0}'. Manque-t-il uUne référence d'assembly ? + + Impossible de trouver un membre ou une définition de type à la position du curseur. + L'élément sélectionné n'est ni une classe ni un membre surchargeable: aucun symbole dérivé n'est disponible. @@ -3638,10 +3830,10 @@ Configurez le chemin vers NAnt dans les options de SharpDevelop. Envoyer vers la console Ruby - Chargement du fichier ${FileNameWithoutPath} depuis ${Path}. Controler les droits et l'existence du fichier. + Chargement du fichier ${FileNameWithoutPath} depuis ${Path}. Controlez les droits et l'existence du fichier. - Enregistrement impossible du fichier ${FileNameWithoutPath} sous ${Path}. Choisir un autre nom de fichier ou controler si le répertoire existe ainsi que les droits d'écriture pour le chemin et le fichier. (Peut être un problème de protection en écriture) + Enregistrement impossible du fichier ${FileNameWithoutPath} sous ${Path}. Choisissez un autre nom de fichier ou controlez si le répertoire existe ainsi que les droits d'écriture pour le chemin et le fichier. Navigateur @@ -3674,7 +3866,7 @@ Configurez le chemin vers NAnt dans les options de SharpDevelop. <Par défaut> - Etes-vous sûr de vouloir charger la configuration par défaut de l'espace de travail? Note: Ceci n'affectera pas vos layouts personnalisés. + Etes-vous sûr de vouloir charger la configuration par défaut de l'espace de travail ? Note: Ceci n'affectera pas vos layouts personnalisés. Conversion @@ -3755,7 +3947,7 @@ Configurez le chemin vers NAnt dans les options de SharpDevelop. Le fichier est introuvable. - Etes vous sûr que vous voulez recharger le fichier ? + Etes-vous sûr que vous voulez recharger le fichier ? Toutes les modifications seront perdues. @@ -4027,7 +4219,7 @@ Toutes les modifications seront perdues. L'ajout de ce composant conduirait à une dépendance cyclique. - Exception lors de la création d'un composant pour le Form Designer (un composant a levé une exception dans son constructeur). CELA N'AFFECTE EN RIEN VOTRE CODE SOURCE. + Exception lors de la création d'un composant pour le Form Designer (un composant a levé une exception dans son constructeur). CELA N'AFFECTE PAS VOTRE CODE SOURCE. Impossible de charger le concepteur. Vérifier les erreurs de syntaxe du code source et si toutes les références sont disponibles. @@ -4521,7 +4713,7 @@ Allez dans 'Outils/Options->Style Visuel pour changer l'ambiance actuelle.Impossible de trouver le dialogue id '{0}' dans le document. - Une extension doit être de la forme: Classe, Assembly + Une extension doit être de la forme: Classe, Nom d'Assembly Par exemple: Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension @@ -4706,6 +4898,15 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Extension Visual Studio + + Activer l'analyse de App.xml + + + Editeur WPF + + + Appuyer sur "Alt" pour saisir un Conteneur + Vignettes du Concepteur WPF @@ -4925,6 +5126,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Construction terminée avec succès. + + La compilation du projet ${Name] n'est pas supportée. + Construction lancée. @@ -5186,6 +5390,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Break + + Arrêt sur l'exception gérée ${ExceptionName} + Continuer @@ -5513,6 +5720,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Déboguer + + < Texte tronqué à cause de sa longueur > + Projets @@ -5576,6 +5786,24 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Liste des tâches + + Tous les fichiers ouverts + + + Classe/Module + + + Fichier + + + Espace de nom + + + Projet + + + Solution + Outils @@ -5729,6 +5957,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Ajouter une référence + + Ajouter une référence de Service + Ajouter une référence web @@ -5984,15 +6215,27 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Mettre à jour le bitmap + + Mettre à jour le curseur ... + + + Mettre l'icône à jour... + Voulez-vous vraiment supprimer les ressources sélectionnées? Supprimer ressource + + Filtre: + Ne peut pas charger la ressource + + Impossible de charger la ressource depuis le fichier: {0} + Erreur: le générateur de code de ressource ignore le fichier ressource '{0}' car la classe générée entrerait alors en conflit avec la classe existante '{1}'. @@ -6005,6 +6248,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Contenu + + Ajouter un booléen + Ajouter &fichiers... @@ -6125,6 +6371,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Classes de base de ${Name} + + Membres de base de ${Name} + L'opération ne peut être effectuée car votre code contient des erreurs: @@ -6173,6 +6422,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Trouver les classes de base + + Trouver les symboles de base + Chercher les classes &dérivées @@ -6477,15 +6729,15 @@ Les fichiers de resources ont été renommés/déplacés en conséquence. Type de rapport + + Paramètres de base d'un rapport + Nom de fichier Unité graphique - - Paramètres d'un rapport de base - Modèle de rapports @@ -6519,6 +6771,9 @@ Les fichiers de resources ont été renommés/déplacés en conséquence. Structure de table + + Structure de la page + Modèle de données: extraire @@ -6534,18 +6789,18 @@ Les fichiers de resources ont été renommés/déplacés en conséquence. Champs Disponibles - - Chemin vers le fichier schéma (.xsd) + + Aucun projet n'est sélectionné, saisir le nom des champs - - Sauvegarder le résultat (schémas et données) - - - Sauvegarder le résultat (schéma uniquement) + + Classes du projet sélectionné Afficher le résultat de la requête + + Bienvenue dans l'assistant SharpReport + &Ajouter onglet @@ -6606,6 +6861,9 @@ Les fichiers de resources ont été renommés/déplacés en conséquence. Ouvre une solution + + Supprimer de la liste des projets récents + Page de démarrage @@ -7597,7 +7855,7 @@ Les fichiers de resources ont été renommés/déplacés en conséquence.Compiler projet actif ou buffer (si pas de projet ouvert) (Sauvegarde auto.) - Une session de déboguage est en cours, voulez vous l'arrêter pour reconstruire le projet? + Une session de déboguage est en cours, voulez-vous l'arrêter pour reconstruire le projet? Arrêter le déboguage @@ -7653,6 +7911,9 @@ Les fichiers de resources ont été renommés/déplacés en conséquence. Recherche incrémentale inversée + + Rechercher les erreurs... + Ac&tiver/Désactiver un marque-page @@ -7768,10 +8029,10 @@ Erreur lors du démarrage: Refactoring + + Reformater + Partie non commentée - - Cette ressource n'est pas utilisée. Son but est de tester la base de donnée de traduction. - \ No newline at end of file diff --git a/data/resources/StringResources.hu.resx b/data/resources/StringResources.hu.resx index 6732abf516..fa97baf6fd 100644 --- a/data/resources/StringResources.hu.resx +++ b/data/resources/StringResources.hu.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Ez az erőforrás nincs használva. Célja a fordító adatbázis tesztelése. +Valamint soremelést tartalmaz. + About @@ -4030,9 +4034,6 @@ Az erőforrás fájlok mozgatása/átnevezése megtörtént. Grafikus Egység - - Alap kimutatás beállítások - Kimutatás Model @@ -4060,15 +4061,6 @@ Az erőforrás fájlok mozgatása/átnevezése megtörtént. Használható Mezők - - A Séma (.xsd) fájl útvonala - - - Eredmény Mentése (Adat és Séma) - - - Eredmény Mentése (Csak Séma) - Lekérdezési eredmények Mutatása @@ -5079,8 +5071,4 @@ Hiba az indításkor: Megjegyzésből ki - - Ez az erőforrás nincs használva. Célja a fordító adatbázis tesztelése. -Valamint soremelést tartalmaz. - \ No newline at end of file diff --git a/data/resources/StringResources.it.resx b/data/resources/StringResources.it.resx index c14fa8840a..7743977f62 100644 --- a/data/resources/StringResources.it.resx +++ b/data/resources/StringResources.it.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Questa risorsa non viene utilizzata. Il suo scopo è di testare il database di traduzione ed ha +una riga a capo + Informazioni su... @@ -160,7 +164,7 @@ Il componente è stato installato due volte. Rimuovere una copia. - L'AddIn deve avere un <Identity> per poter essere utilizzato dal gestore di AddIn. + Il componente deve avere un <Identity> per poter essere utilizzato dal gestore di AddIn. Il componente sarà rimosso dopo il riavvio di SharpDevelop @@ -169,7 +173,7 @@ Il componente sarà aggiornato dopo il riavvio di SharpDevelop - L'AddIn sarà disabilitato dopo il riavvio di SharpDevelop + Il componente sarà disabilitato dopo il riavvio di SharpDevelop Impossibile disabilitare il gestore degli AddIn in quanto è necessario riabilitare gli AddIn !!! @@ -178,13 +182,13 @@ Impossibile installare gli AddIn dentro la cartella ${ProductName}, essi verranno caricati come AddIn preinstallati automaticamente. - Annulla rimozione del componente/i selezionato/i. + Annulla disinstallazione del/i componente/i selezionato/i. - Annulla l'installazione dei componenti selezionati + Annulla l'installazione del/i componente/i selezionato/i - Annulla l'aggiornamento del componente/i selezionato/i + Annulla l'aggiornamento del/i componente/i selezionato/i Disabilita il componente/i selezionato/i. @@ -193,20 +197,20 @@ Abilita il componente/i selezionato/i. - La selezione non è consistente, scegli solo AddIn con lo stesso status. + La selezione non è consistente, scegli solo Componenti con lo stesso status. Pacchetto Installazione Componente - AddIn di SharpDevelop|*.addin;*.sdaddin|Tutti i file|*.* + Componenti di SharpDevelop|*.addin;*.sdaddin|Tutti i file|*.* &Install Componente Nessun Componente installato. -Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare il file scaricato per installarlo. +Scaricare un componente da internet, poi cliccare 'Installa AddIn' e selezionare il file scaricato per installarlo. Apri Sito web @@ -221,10 +225,10 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare Dipendenze richieste: - Mostra AddIn preinstallati + Mostra Componenti preinstallati - Gestore AddIn + Gestore Componenti Formato file sconosciuto: @@ -239,7 +243,7 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare Cerca: - Visualizza AddIns preinstallati + Visualizza Componenti preinstallati Visualizza prereleases @@ -248,7 +252,7 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare Non puoi disinstallare il gestore AddIn perché ti serve per reinstallare gli AddIns! - Lista SharpDevelop AddIn + Repository dei Componenti di SharpDevelop Creato da: @@ -287,11 +291,11 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare Mostra i Termini di Licenza - I seguenti AddIns dipendono da "{0}": + I seguenti Componenti dipendono da "{0}": {1} -Smetteranno di funzionare dopo aver disabilitato questo AddIn! Sei sicuro di voler continuare? +Smetteranno di funzionare dopo aver disabilitato questo Componente! Sei sicuro di voler continuare? "{0}" richiede almeno un pacchetto aggiuntivo: @@ -301,7 +305,7 @@ Smetteranno di funzionare dopo aver disabilitato questo AddIn! Sei sicuro di vol L'applicazione tenterà di scaricarlo e installarlo. Sei sicuro di voler continuare? - Il pacchetto selezionato non contiene un AddIn per SharpDevelop valido. + Il pacchetto selezionato non contiene un Componente valido per SharpDevelop. &Accetto @@ -318,10 +322,10 @@ Se non accetti i termini di licenza clicca "Rifiuto". Se non accetti i termini di licenza clicca "Rifiuto". - Questo pacchetto richiede l'accettazione della licenza: + Il seguente pacchetto richiede l'accettazione della licenza: - I seguenti pacchetti richiedono un clic per accettare la licenza: + I seguenti pacchetti richiedono l'accettazione della licenza: Condizioni di Licenza @@ -348,7 +352,7 @@ Se non accetti i termini di licenza clicca "Rifiuto". Sorgente: - AddIns + Componenti Generale @@ -357,14 +361,14 @@ Se non accetti i termini di licenza clicca "Rifiuto". Repositories - I seguenti AddIns dipendono da "{0}": + I seguenti Componenti dipendono da "{0}": {1} -Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler continuare? +Smetteranno di funzionare dopo la rimozione di questo Componente! Sei sicuro di voler continuare? - SharpDevelop AddIns|*.sdaddin;*.addin|All files|*.* + Componenti di SharpDevelop|*.sdaddin;*.addin|All files|*.* Clicca qui per visualizzare gli aggiornamenti. @@ -405,6 +409,33 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Mostra Diagramma delle Classi + + Pulisci console + + + Cancella cronologia + + + 'git.exe' non è stato trovato nella cartella selezionata! + + + Nessuna installazione di Git trovata. + + + Seleziona il percorso Git + + + Percorso Git + + + Azzera il percorso Git + + + Opzioni Git + + + (rilevato automaticamente) + TortoiseGit deve essere installato per eseguire questo comando. @@ -423,6 +454,12 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Imposta le Preferenze di Aiuto + + Impossibile eseguire il Gestore delle librerie di aiuto, in quanto non è stato installato/selezionato alcun catalogo. Per favore verificare le impostazioni di aiuto (vedi Strumenti > Opzioni > Strumenti > Visualizzatore aiuti di Microsoft). + + + Il Gestore delle librerie di aiuto non è stato trovato. Per poter utilizzare l'aiuto di SharpDevelop per favore scaricare e installare il SDK di Microsoft Windows 7.1. + Aiuto in linea non trovato. Per favore controlla che sia installato correttamente. @@ -463,7 +500,7 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Numero di bytes per linea - Display + Visualizza Dati @@ -516,6 +553,21 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Titolo + + Console per la gestione del Pacchetto + + + Gestisce i Pacchetti... + + + Ripristina i Pacchetti + + + Sorgenti del Pacchetto + + + Gestione del Pacchetto + Risultato @@ -532,7 +584,7 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Sessione di Profilazione SharpDevelop - Il progetto non può essere avviato perché non è stato trovato l'eseguibile, verifica che il progetto e tutte le sue dipendenze siano stati compilati correttamente! + Il progetto non può essere avviato perché non è stato trovato l'eseguibile, verificare che il progetto e tutte le sue dipendenze siano stati compilati correttamente! Nessun progetto di avvio. Annullo... @@ -589,7 +641,8 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Argomenti della linea di comando: - Seleziona il percorso dell'eseguibile che vuoi profilare. Puoi specificare anche una cartella di lavoro e gli argomenti da linea di comando. + Seleziona il percorso dell'eseguibile che vuoi profilare. +Puoi specificare anche una cartella di lavoro e gli argomenti da linea di comando. Percorso eseguibile: @@ -853,7 +906,7 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler Confronta - Aggiungi automaticamente i nuovi files + &Aggiungi automaticamente i nuovi files Rimuove automaticamente i file &cancellati @@ -899,7 +952,7 @@ Smetteranno di funzionare dopo la rimozione di questo AddIn! Sei sicuro di voler L'operazione di controllo versione coinvolgerà file con modifiche non salvate. -Salva questi file prima di eseguire l'operazione. +Salvare questi file prima di eseguire l'operazione. Scambia @@ -926,7 +979,8 @@ Salva questi file prima di eseguire l'operazione. Non voglio partecipare - Abbiamo bisogno del tuo aiuto! Per migliorare SharpDevelop abbiamo bisogno di sapere quali sono le funzionalità maggiormente usate. SharpDevelop può raccogliere queste informazioni e inviarle automaticamente. + Abbiamo bisogno del tuo aiuto! Per migliorare SharpDevelop abbiamo bisogno di sapere quali sono le funzionalità maggiormente usate. +SharpDevelop può raccogliere queste informazioni e inviarle automaticamente. Informativa sulla Privacy @@ -1019,7 +1073,8 @@ Salva questi file prima di eseguire l'operazione. Salva come UTF-8 - Il Progetto è stato configurato come DLL e non è stato specificato nessun comando da eseguire. Se ne può specificare uno nelle opzioni del progetto. + Il Progetto è stato configurato come DLL e non è stato specificato nessun comando da eseguire. +Se ne può specificare uno nelle opzioni del progetto. La compilazione di un singolo file non è supportata, creare un progetto! @@ -1529,6 +1584,30 @@ Per creare/manipolare un oggetto ActiveX/COM, trascina una classe da Libreria Ti Analisi della Qualità del Codice + + Formatta automaticamente il codice + + + (predefinito) + + + (globale) + + + Nessuna impostazione di formattazione selezionata! + + + Sei sicuro di voler reimpostare tutte le opzioni di formattazione precedentemente definite? + + + (progetto) + + + Reimposta a: + + + (soluzione) + Inserisci riferimento al metodo; premi ancora tab o invio per inserire un nuovo metodo. @@ -1538,6 +1617,17 @@ Per creare/manipolare un oggetto ActiveX/COM, trascina una classe da Libreria Ti Inserito un metodo anonimo con parametri. + + <Crea ${HandlerName}> + + + Usa Su/Giu per muoverti in un'altra posizione. +Premi Enter per selezionare la posizione. +Premi Esc per annullare questa operazione. + + + Colonne: + A proposito di SharpDevelop @@ -1559,6 +1649,27 @@ Per creare/manipolare un oggetto ActiveX/COM, trascina una classe da Libreria Ti Versione + + Operazioni: + + + Servizi: + + + Interno + + + Pubblico + + + Livello di accesso per le classi generate: + + + Genera operazioni asincrone + + + Client + file recenti @@ -1630,7 +1741,7 @@ Per creare/manipolare un oggetto ActiveX/COM, trascina una classe da Libreria Ti Inserire una espressione da raggiungere. -Inserire numero linea, nome classe e nome file. +Si possono usare numeri di linea, nomi di classi e nomi di file. Ad esempio: "120", "MainClass", "Main.cs, 120". @@ -1645,6 +1756,9 @@ Ad esempio: "120", "MainClass", "Main.cs, 120". Corsivo + + Sottolineato + Esporta schema colori @@ -1722,7 +1836,7 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Errore parsing espressione regolare: - Trova &tutti + Trov&a tutti &Trova @@ -1949,6 +2063,12 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Pulisci cache + + Inserire la voce suggerita dal completamento codice premendo i seguenti caratteri: + + + Inserire la voce selezionata dal completamento codice solamente premendo <Tab> o <Enter>. + Mostra lista completamento dopo aver digitato un carattere @@ -1970,6 +2090,18 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Salva + + Impostazioni suggerimenti + + + I collegamenti nei suggerimenti dovrebbero andare a + + + Definizione nel codice + + + Documentazione (se disponibile) + Pre-seleziona i membri utilizzati recentemente @@ -2012,6 +2144,12 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? &Usa nomi dei tipi completi + + Formattazione + + + Ispezione del codice + Codifica @@ -2024,12 +2162,24 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Ferma alla prima linea in esecuzione. + + Scegli eccezioni + Attiva decompilatore Attiva Modifica e Continua + + Nome eccezione completo + + + Arresta su + + + Scegli le eccezioni sulle quali vuoi che il debugger si arresti + Eccezioni @@ -2094,10 +2244,10 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Cre&a copia di backup - Codifica file predefinita: + Codifica fil&e predefinita: - &Controlla modifiche esterne ai files + Controlla mo&difiche esterne ai files Carica @@ -2224,7 +2374,7 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Si pu&o spostare dopo EOL - C&onverte Spazi in Tabulazioni + C&onverte Tabulazioni in Spazi Usa Ctrl+Click per "Vai alla definizione" @@ -2296,7 +2446,7 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Abilita &doppio buffer - Abilita c&artelle + Abilita &struttura Carattere @@ -2343,6 +2493,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Evide&nzia coppie parentesi + + Evidenzia la riga corrente + Evidenzia simboli @@ -2421,6 +2574,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Seleziona la directory dove l'assembly verrà creato. + + Riferimenti del Servizio + Evidenziazioni @@ -2478,6 +2634,69 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? File di R&isorsa Win32: + + Informazioni assembly + + + Il file delle informazioni dell'assembly non è stato trovato. Prego assicurarsi che il progetto contenga il file + + + Versione assembly: + + + Compatibile CLS + + + Società: + + + Copyright: + + + Alias predefinito: + + + Descrizione: + + + Versione File: + + + GUID: + + + Uno dei valori delle informazioni dell'assembly non è corretto. + + + Versione informativa: + + + Ottimizzazione JIT + + + Monitoraggio JIT + + + Rendi l'assembly visibile a COM + + + Linguaggio neutrale: + + + Nuovo GUID + + + Nessuna + + + Prodotto: + + + Titolo: + + + Marchio: + Avanzato @@ -2604,6 +2823,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Valori di default per le opzioni VB: + + Formattazione codice + &Configurazione @@ -2613,6 +2835,12 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Cambiare la configurazione salverà i valori correnti. Continuare? + + Nomi files: + + + Esegui alla Generazione + Debug @@ -2753,9 +2981,9 @@ Vuoi aggiungere il nuovo file al progetto ${CurrentProjectName}? Con il bottone piccolo davanti ad ogni impostazione di configurazione, si sceglie dove l'impostazione è memorizzata. -"Specifiche della Configurazione" significa che le impostazioni possono avere valori differenti in ogni configurazione (debug/release) +"Specifiche della Configurazione" significa che le impostazioni possono avere valori differenti in ogni configurazione (Debug/Release) "Specifiche della Piattaforma" significa che le impostazioni possono avere valori differenti a seconda della piattaforma -Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che nel file di progetto, così che ogni sviluppatore possa utilizzare un valore differentesenza andare in conflitto con il sistema di controllo dei sorgenti. +Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che nel file di progetto, così che ogni sviluppatore possa utilizzare un valore differente senza andare in conflitto con il sistema di controllo dei sorgenti. Memorizza in file .user @@ -2790,6 +3018,9 @@ Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che Usa classe esistente: + + Correggi problemi in automatico se possibile + Gestore Assembly .NET @@ -3043,12 +3274,27 @@ Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che Sostituisci + + Azzera + Riprova Seleziona &Tutto + + Alt + + + Ctrl + + + Shift + + + Win + Icone piccole @@ -3310,6 +3556,9 @@ Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che Codice Non Analizzato + + Codice Parzialmente Coperto + Colonna @@ -3442,7 +3691,7 @@ Puoi anche scegliere di memorizzare le impostazioni in un file .user invece che Impossibile trovare NAnt '{0}'. -Configura il percorso di NAnt nelle opzioni di SharpDevelop. +Configura il percorso di NAnt nelle Opzioni di SharpDevelop. Build di NAnt arrestata. @@ -3582,6 +3831,9 @@ Configura il percorso di NAnt nelle opzioni di SharpDevelop. Impossibile trovare il tipo '{0}'. Hai dimenticato il riferimento a qualche assembly? + + Non è stato possibile trovare la definizione del tipo o il tipo del membro alla posizione corrente del cursore. + L'elemento selezionato non è una classe o un membro overridable quindi non può essere mostrato nessun simbolo derivato. @@ -3595,10 +3847,11 @@ Configura il percorso di NAnt nelle opzioni di SharpDevelop. Invia alla Console Ruby - Non si può caricare il file ${FileNameWithoutPath} da ${Path}. Controllare i permessi e la presenza del file stesso. + Non si può caricare il file ${FileNameWithoutPath} da ${Path}. +Controllare i permessi e la presenza del file. - non si può salvare il file ${FileNameWithoutPath} in ${Path}. Scegliere un altro nome o controllare se la cartella esiste e che si hanno i permessi di scrittura. (potrebbe essere attivata la protezione da scrittura ??). + Non si può salvare il file ${FileNameWithoutPath} in ${Path}. Scegliere un altro nome o controllare se la cartella esiste e che si hanno i permessi di scrittura. (potrebbe essere attivata la protezione da scrittura?) Visualizzatore @@ -3715,7 +3968,7 @@ Nota: Questa operazione non influenza i propri layout. Si vuole veramente ricaricare il file ? -Tutti i cambiamenti saranno persi. +Tutte le modifiche andranno perse. Il collegamento al linguaggio ${LanguageBinding} non può compilare ${FileName}. @@ -3744,8 +3997,7 @@ Tutti i cambiamenti saranno persi. Il file ${File} -è stato cambiato esternamente. Vuoi ricaricarlo? - +è stato cambiato da un'altra applicazione. Vuoi ricaricarlo? Ricerca incrementale: @@ -3988,7 +4240,7 @@ ${File} Stai tentanto di aggiungere un componente che risulta in una dipendenza ciclica. - SI è verificata un'eccezione nella creazione del componente per il Forms Designer (Un componente ha genrato un'eccezione nel costruttore). + SI è verificata un'eccezione nella creazione del componente per il Forms Designer (Un componente ha generato un'eccezione nel costruttore). QUESTO NON INTERESSA IL CODICE SORGENTE. @@ -4000,7 +4252,7 @@ QUESTO NON INTERESSA IL CODICE SORGENTE. Impossibile caricare la barra laterale dei componenti. Nessun componente Windows Forms trovato, configurare la barra laterale manualmente. -(Tasto destro sulla barra laterale->Configurare barra laterale) +(Tasto destro sulla barra laterale->Personalizza barra laterale) Componenti personalizzati @@ -4078,7 +4330,7 @@ Nessun componente Windows Forms trovato, configurare la barra laterale manualmen Collega al Processo - Impossibile creare la directory. + Impossibile creare la directory di destinazione. Controllare se si hanno i permessi richiesti. @@ -4298,6 +4550,9 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'. La soluzione ha subito dei cambiamenti esterni. + + Opzioni di Formattazione della Soluzione + Converti &progetti selezionati in: @@ -4324,17 +4579,19 @@ Sono ammesse solo lettere, numeri, spazi, '.' o '_'. Il progetto '${ProjectName}' usa MSBuild ${OldToolsVersion}, ma questa versione non è installata. -Vuoi aggiornare il progetto a MSBuild ${NewToolsVersion}? Il progetto non può essere aperto senza essere aggiornato. +Vuoi aggiornare il progetto a MSBuild ${NewToolsVersion}? +Il progetto non può essere aperto senza essere aggiornato. Aggiorna a MSBuild ${NewToolsVersion} - Questa soluzione è stata creata con una versione precedente di SharpDevelop. Potresti volerla aggiornare così da utilizzare le nuove funzionalità del linguaggio o del framework. + Questa soluzione è stata creata con una versione precedente di SharpDevelop. +Potresti volerla aggiornare così da utilizzare le nuove funzionalità del linguaggio o del framework. Ambiente corrente non trovato. -Vai a 'Opzioni->Stile visuale' e cambia l'attuale ambiente di linguaggio. +Vai a 'Opzioni->Stile visuale' e cambia l'attuale ambiente del linguaggio. Marcatori eseguiti @@ -4664,6 +4921,15 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Estensione Visual Studio + + Attiva l'analisi di App.xaml + + + Editor WPF + + + Premere "Alt" per entrare nel Contenitore + Anteprima WPF Designer @@ -4883,6 +5149,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Compilazione completata con successo. + + La generazione del progetto ${Name} non è supportata. + Generazione avviata. @@ -4893,7 +5162,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Generazione - Compilazione in corso + Compilazione Generazione assembly di interoperabilità COM... @@ -5018,6 +5287,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Apri assembly dalla GAC... + + Apri nel Browser delle Classi + Ricerca nel visualizzatore di classi @@ -5036,6 +5308,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Abilita a capo + + Aggiungi monitoraggio espressione + Interruzioni @@ -5138,6 +5413,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Interrompi + + Arresta su eccezione gestita ${ExceptionName} + Continua @@ -5465,6 +5743,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Debug + + <Il testo è stato troncato perché era troppo lungo> + Progetti @@ -5528,6 +5809,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Lista Azioni + + Tutti i file aperti + + + Classe/Modulo + + + File + + + Spazio dei Nomi + + + Progetto + + + Soluzione + Strumenti @@ -5681,6 +5980,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Aggiungi Riferimento + + Aggiungi Riferimento Servizio + Aggiungi Riferimento Web @@ -5936,15 +6238,27 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Aggiorna bitmap ... + + Aggiorna cursore ... + + + Aggiorna icona ... + Vuoi veramente cancellare la(e) risorsa(e) selezionata(e)? Cancella risorsa + + Filtro: + Impossibile caricare risorsa + + Impossibile caricare la risorsa dal file: {0} + Errore: il generatore di codice risorsa sta saltando il file "{0}" perché la classe generata è in conflitto con la classe esistente "{0}". @@ -5957,6 +6271,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Contenuto + + Aggiungi voce &booleana + Aggiunge &file... @@ -6077,6 +6394,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Classi base di ${Name} + + Membri Base di ${Name} + L'operazione non può essere completata a causa di errori nel codice sorgente: @@ -6089,6 +6409,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Classe derivante da ${Name} + + Dagli appunti + + + Gli appunti non contengono nulla + Converti in proprietà automatica @@ -6119,6 +6445,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Trova classi base + + Cerca simboli base + Trova classi &derivate @@ -6225,7 +6554,8 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Tutti i formati di progetto conosciuti - Questa versione di SharpDevelop non riesce a caricare progetti creati con Visual Studio .NET 2003 (o precedenti). Prova ad usare SharpDevelop 3.2 per convertirli oppure crea un nuovo progetto e aggiungi i file esistenti. + Questa versione di SharpDevelop non riesce a caricare progetti creati con Visual Studio .NET 2003 (o precedenti). +Prova ad usare SharpDevelop 3.2 per convertirli oppure crea un nuovo progetto e aggiungi i file esistenti. Non posso salvare {0}:\n{1} @@ -6237,8 +6567,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Non posso salvare {0}:\n{1}\n\nAssicurati che il file sia scrivibile. - C'erano dei file di riorsa nel progetto. -SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è solo il nome del file, ma è prefissato con il nome del namespace radice e della cartella. + C'erano dei file di risorsa nel progetto. +SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è solo il nome del file, ma è prefissato con il nome del namespace radice e della cartella. +I files di risorsa sono stati di conseguenza rinominati/spostati. I seguenti files non possono essere rinominati/spostati automaticamente: @@ -6418,17 +6749,17 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Impostazioni base - Tipo di Report + Tipo di Report : + + + Impostazioni di base del report - Nome File + Nome File : Unità di misura Grafici - - Impostazioni di base del report - Modello del Report @@ -6442,10 +6773,10 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Inserisce Dato - Nome del Report + Nome del Report : - Tipo di Report + Tipo di Report : Seleziona Colonne di Gruppo @@ -6462,6 +6793,9 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Layout tabella + + Impaginazione + Preleva Modello dei Dati @@ -6477,18 +6811,18 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Valori Disponibili - - Percorso per il file di Schema (.xsd) + + Nessun progetto selezionato, prego inserire i nomi dei files - - Salva risultato (Schema e Dati) - - - Salva risultato (solo schema) + + Classi nel progetto selezionato Mostra i risultati dell'Interrogazione + + Benvenuto nella procedura guidata di SharpReport + &Aggiunge Tabulazione @@ -6550,6 +6884,9 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Apri soluzione + + Rimuovi dalla lista dei progetti recenti + Pagina Iniziale @@ -6562,6 +6899,12 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è lin ${Line} col ${Column} car ${Character} + + Lunghezza ${Rows} * ${Cols} (${Total}) + + + Lunghezza ${Length} + Varie @@ -7175,7 +7518,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Ferma il processo corrente e termina il debug. - Attiva/Disattiva BreakPoint + Commuta Breakpoint &Modifica @@ -7205,10 +7548,10 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Mostra solo le &definizioni - Mostra &tutte le Cartelle + Commuta &tutte le Cartelle - Mo&stra cartella + Commu&ta cartella &Formato @@ -7394,7 +7737,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è &Mezzo - &Centro nella Form + &Centra nella Form &Orizzontalmente @@ -7421,7 +7764,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Rendi &Uguali - Porta in &Sfondo + Porta su &Sfondo A&llinea Icone @@ -7460,7 +7803,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è &Proprietà - Mostra ordine $tabulazioni + Mostra ordine &tabulazioni Spaziatura &Verticale @@ -7475,7 +7818,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è &Incrementa - Rendi &Uguali + Rendi &Uguale &Aiuto @@ -7535,7 +7878,7 @@ SharpDevelop 2 compila le risorse differentemente: il nome della risorsa non è Compila il progetto o il buffer corrente (quando nessun progetto è aperto)(salva automaticamente) - Devi interrompere il debugper generare il progetto. + Devi interrompere il debugger per generare il progetto. Vuoi fermare il debug? @@ -7545,16 +7888,16 @@ Vuoi fermare il debug? &Esegui - Esecuzione del compilato (ricompilazione) + Esecuzione del compilato (ricompila) &Cerca - &Cancella Tutti i Segnalibri + &Cancella Tutti i Segnalibro - Cancella tutti i segnalibri nel buffer corrente + Cancella tutti i segnalibro nel buffer corrente &Cerca... @@ -7569,7 +7912,7 @@ Vuoi fermare il debug? &Vai a... - Vai alla parentesi graffa + Vai alla parentesi graffa corrispondente Ricerca Incrementale @@ -7592,8 +7935,11 @@ Vuoi fermare il debug? Ricerca Incrementale Inversa + + Cerca per Problemi... + - A&ttiva segnalibro + Commu&ta segnalibro Mette/toglie segnalibro alla linea corrente @@ -7605,11 +7951,11 @@ Vuoi fermare il debug? &Converti il codice in - Digitare argomenti per il tool: + Digitare argomenti per lo strumento: Esecuzione programma esterno fallita. -Errore durante esecuzione: +Errore durante l'avvio: Interrotto con il codice: @@ -7648,7 +7994,7 @@ Errore durante esecuzione: Finestre - File + Files Mo&stra pagina iniziale @@ -7687,7 +8033,7 @@ Errore durante esecuzione: Opzioni dell'Editor - Commenta la regione + Commenta la zona &Copia @@ -7707,11 +8053,10 @@ Errore durante esecuzione: Refactoring - - Rimuovi commento regione + + Riformatta - - Questa risorsa non viene utilizzata. Il suo scopo è di testare il database di traduzione ed ha -una riga a capo + + Rimuovi commento dalla zona \ No newline at end of file diff --git a/data/resources/StringResources.jp.resx b/data/resources/StringResources.jp.resx new file mode 100644 index 0000000000..23223756be --- /dev/null +++ b/data/resources/StringResources.jp.resx @@ -0,0 +1,5096 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + このリソースは使われません。改行\nのテスト目的です。(この日本語翻訳について要望などありましたらSharpDevelop-jpまでお願いします) + + + アバウト + + + アンインストールの中止 + + + インストールの中止 + + + アップデートの中止 + + + 無効 + + + 有効 + + + インストール + + + アンインストール + + + アップデート + + + このアドインには依存するものが見つかりません。このアドインをインストールして有効にしてください。 + + + 無効 + + + アドインはSharpDevelopの再起動後に有効になります + + + アドインはSharpDevelopの再起動後にインストールされます + + + このアドインは2度インストールされました。1つをアンインストールしてください + + + アドインマネージャで利用するために、アドインは<識別子>を持たなければなりません + + + アドインをSharpDevelopの再起動後に削除します + + + アドインをSharpDevelopの再起動後にアップデートします + + + アドインをSharpDevelopの再起動後に無効にします + + + アドインマネジャーは無効にできません。アドインを再度有効にするのに必要です! + + + アドインを${ProductName}ディレクトリにインストールできません。インストール前に自動的に設定されます + + + 選択したアドインのアンインストールを中断します。 + + + 選択したアドインのインストールを中断します。 + + + 選択したアドインのアップデートを中断します。 + + + 選択したアドインを無効 + + + 選択したアドインを有効 + + + 矛盾した選択です。同じ状態のアドインのみ選択してください + + + アドイン インストール パッケージ + + + SharpDevelop アドイン|*.addin;*.sdaddin|すべてのファイル|*.* + + + アドインのインストール(&I) + + + アドインがインストールされていません。インターネットからアドインをダウンロードし、「アドインのインストール」をクリックして、ダウンロードしたファイルを選択すれば、インストールできます。 + + + Webサイトを開く + + + オプション + + + アドイン被依存 : + + + 必要な依存関係 : + + + プレインストールのアドインを表示 + + + アドインマネージャ + + + 不明なファイル形式 + + + 圧縮ファイルからインストール... + + + レポジトリ : + + + 検索 : + + + プレインストールのアドインを表示 + + + リリース前バージョンを表示 + + + アドインマネジャーはアンインストールできません。アドインを再インストールするのに必要です! + + + SharpDevelop アドイン レポジトリ + + + 作成 : + + + 依存関係 : + + + ダウンロード : + + + ファイル名 : + + + インストール済みバージョン : + + + 最終更新 : + + + 詳細 + + + 新バージョン : + + + 評価 : + + + クラスダイアグラムを表示 + + + ヘルプモード + + + ???????????????? + + + Microsoft???????? + + + ??????????????????????????????????????????????????????? + + + ?????? + + + ???????? + + + ???????????? + + + 行当たりのバイト数 + + + ?? + + + ??? + + + ????? + + + ?? + + + 16?? + + + ????????? + + + ?? + + + ????? + + + URL入力 + + + 進む + + + ?????? + + + ?? + + + 新しいウィンドウ + + + 検索 + + + ?? + + + ???? + + + ?? + + + ????????? + + + {0} ???? + + + SharpDevelop?????????????? + + + ?????????????????????????????????????????????????????????????????? + + + + ???????????????????... + + + ??????... + + + COM??????????????????????????????????????! + + + ?????? + + + .NET???????????????? + + + ???????????????? + + + ???????????????? + + + ????????? + + + ???????????????? + + + ??????????????????? +???????????????????????????? + + + + ????: + + + ?????: + + + ????????? + + + ???????/??? + + + ?????????? + + + CPU????: + + + ????? + + + ??????? + + + ????? + + + ????????? + + + % ????? + + + ???? / ???? + + + ????(??) + + + ????(??) / ???? + + + ??: + + + ???20 + + + 検索... + + + ?????????continue??????????????????????????????????????????? + + + ?????????goto????????????????????????????????????????? + + + {0}???????????????????????? + + + ?????????? + + + ????????? + + + ?? + + + Equals()?GetHashCode()???????? + + + ???????? {0} ??? + + + ?????????????? + + + ToString()?????????????? + + + ?????????: {0} + + + ???????? + + + Subversion???????'{0}'????????/???????????????? + + + Subversion???????'{0}'????????/??????????????? + + + ??????? + + + ?????? + + + ????????? + + + ???? + + + ????? + + + ??????????? + + + ??????????????(&A) + + + Subversion????? + + + ??? + + + ???????????????????????????? + + + ????????? + + + ???????? + + + ?????? + + + ???????????????????????????????????? +?????????????????????????????? + + + ?????????TortoiseSVN??????????????????? + + + ?????? + + + Update to revision + + + ????????????! ??SharpDevelop????????????????? + + + ????? - ????????????????? + + + ???SharpDevelop?????????????????? + + + ???????????????????SharpDevelop???????????????????????????????????????? +SharpDevelop??????????????????????? + + + ??????????? + + + ????????? + + + ??????????????? + + + ?????/????? + + + ?????????????????????????????????????????????????? + + + <???????????> + + + ???????: + + + XML?????????: + + + ????????: + + + ????????????? + + + ?????????? + + + ???${encoding}??????????????????????????? + + + プロジェクトは実行可能コマンドではなくdllとして定義されます。プロジェクトオプションで実行可能コマンドとして指定することが出来ます。 + + + 説明 + + + ファイル名 + + + ????? + + + ??????????(&O) + + + ???????????(&V) + + + ???????????(&T) + + + ??????(&E) + + + ???????????(&P) + + + TypeLib??? + + + ????????? + + + ????{0}????????? + + + ???? + + + ???? for + + + ???? + + + ?????????????????? + + + ??? + + + ???????? + + + COM???????? + + + ???????????????????OK?????????????????????????????????????????? + + + ?????? + + + ???????????????? + + + ?????? + + + ????COM???????? + + + ??? + + + ?????? + + + ???(&C) + + + ??????????? + + + ?? + + + ???????(&S) + + + ?? + + + ????: + + + ?? + + + ????? + + + ??? + + + ??? + + + ??????? + + + {0} ???????????????????;??????????????? + + + ????? + + + ?????: + + + ???? + + + ??????????? + + + ???????? + + + ????COM???????? + + + ????COM??????????? + + + ??? + + + GAC?????? + + + ???????ActiveX/COM???????????????? + +???????????????COM????????????????????????????????????????????????? + +ActiveX/COM????????????COM???????????????? + +??????????????????????????????????? + + ActiveX/COM?????????/????????????????????????????????????????/??????????????? + + + ???????? + + + ???? + + + ?????????? ?????? + + + ??????? + + + ???????(&M) + + + ??????(&I) + + + ?? + + + ?? + + + ?????(&A) + + + ActiveX???? + + + ??????(&D)... + + + ?????(&O) + + + ???(&P)... + + + ?????(&T)... + + + ???????(&T)... + + + ???? + + + 16 ????? + + + ????????? + + + ???????? + + + ????? + + + ?????? + + + ???? + + + ???????????????????? + + + ????? + + + ???????? + + + COM???????????????????????? + + + {0}??????????????????? + + + ??????????????????? + + + ?????????????????????????????? + + + ????? + + + ????????(&F) + + + ????????(&S) + + + ??????? + + + ?? + + + ?????????????????????????????????????????? + + + ??????????????????????????????????(????????????)????????????????????? + + + ??????? + + + ???????????????;????????????????????????? + + + ????????????? + + + ????????????? + + + SharpDevelop???????? + + + ????? + + + ??? + + + バージョン情報 + + + ???(&C) + + + バージョン + + + ????????? + + + ??????????? + + + すべて破棄(&D) + + + ?????(&A) + + + 保存(&S) + + + ???????????? + + + ?????????????????? + + + ??? '{0}' ?????? + + + ?????????(&S): + + + ??????????????????(&C) + + + ??????????? + + + ????????????????? + + + ???????????? + + + ?? + + + ???? + + + ??????????????? +???????????????????????? +?:"120", "MainClass", "Main.cs, 120". + + + 背景色 + + + 太字 + + + ??? + + + 斜体 + + + ? + + + ??????? + + + ??????????????????????????????????????????????? +???????????????${CurrentProjectName}????????? + + + カテゴリ(&C): + + + 新しいファイル + + + ファイル名(&F) + + + プロパティを入力してください + + + ファイルを作成する前にプロパティを指定してください。 + + + テンプレート(&T): + + + ??????????????????(&D) + + + 新しいプロジェクト + + + 場所(&L): + + + 名前(&N): + + + ??????????????????: + + + ????(&C): + + + ??????????: + + + ??????(&A) + + + ??(&F) + + + ?? + + + ????(&F) + + + ?????: + + + ??????????(&S) + + + ??????????????(&T) + + + ????????????? + + + ????????? + + + ????? + + + ?????? '{0}' ??????? + + + ?????????? + + + ???????????? + + + すべてをマーク + + + ????????????(&C) + + + すべて置換(&A) + + + 置換(&R) + + + 置換 + + + 置換後の文字列: + + + 検索対象: + + + ???? + + + ????? + + + ワイルドカード + + + 指定されたテキストは見つかりませんでした。 + + + ????? + + + オプション: + + + ????????????????????? + + + ????????(&M): + + + ??????(&T): + + + ??????? + + + ??????????(&D) + + + ?? + + + 説明(&D) + + + ????????? + + + テンプレート(&T) + + + ??(&X) + + + グループを削除(&M) + + + ?????? + + + コードテンプレート + + + ?? + + + ??(&A) + + + コマンド(&C) + + + 引数のプロンプト(&P) + + + ?????????????(&C) + + + コンバインファイル名 + + + カレント列 + + + ????? + + + ??????? + + + ??????????(&I) + + + アイテムパス + + + ターゲットパス + + + アイテム拡張子 + + + ????????? + + + ????????????(&P) + + + プロジェクトファイル名 + + + #Develop????????????? + + + ターゲットディレクトリ(&T) + + + ターゲット拡張子 + + + ??? + + + ????(&T) + + + ???(&T) + + + ??????????????(&O) + + + ????????(&W) + + + 外部ツール + + + ?????????? + + + ???????????????????????????????????????? + + + ?????????????????????????? + + + ?? + + + ?? + + + ???????????????? + + + ????????????????????? + + + メンバの間に空行を挿入(&I) + + + ??????? + + + ??????????? + + + else????????????(&E) + + + ??????????(&A) + + + ??????????????(&D) + + + ?????????????(&S) + + + ????? + + + ?????????(&U) + + + コーディング + + + ?????? + + + ??????????????????????? + + + ????????????????? + + + ???? + + + ????(&H) + + + ??(&L) + + + ???????? + + + 全般 + + + ???????????(&A) + + + ?????????????????(&E) + + + ????????????(&D) + + + ???? + + + ????????????(&L) + + + 読み込み/保存 + + + ?? + + + Unix + + + Windows + + + ???????? + + + ?????? + + + ?????????????????????? + + + ?????????????? + + + ??????????????? + + + ?????????????? + + + ???: + + + ?????????????? + + + ???UI?????: + + + ????????????????????????. + + + UI用言語設定 + + + 好みの外観を選択してください(&A): + + + ?????????????????????(&E) + + + ??????????(&S) + + + ????????(&T) + + + ??????????????????(Office 2003?)??? + + + 表示スタイル + + + スタイル + + + コメントタグ + + + 名前(&N) + + + タスクリスト + + + トークンリスト(&T) + + + ?? + + + EOL???????????(&C) + + + タブをスペースに変換(&O) + + + Ctrl+??????????????? + + + ??????????(&U) + + + ??????????????????? + + + 文字入力中はマウスカーソルを隠す(&H) + + + インデント(&N) + + + インデントサイズ(&I) + + + ?? + + + なし + + + スマート + + + ??????????(&M) + + + ?? + + + 動作 + + + ?? + + + タブ + + + ?????(&T) + + + ???????????(&A) + + + ???????????(&R) + + + ???????????? + + + ?????????(&C) + + + ?????????????(&D) + + + ????????????(&F) + + + ???? + + + ???????????? + + + ????????(&E): + + + サイズ: + + + ???? + + + マウスホイールでズーム + + + クイッククラスブラウザパネルを表示(&Q) + + + ????????: + + + 列(&N) + + + キャレット後 + + + ????? + + + ??????? + + + ??????????? + + + EOL??????(&E) + + + ??????????????(&M) + + + 水平ルーラを表示(&H) + + + ???????(&I) + + + ??????????(&A) + + + 行番号を表示(&L) + + + 1? + + + なし + + + ??????? + + + マーカとルール + + + ???????(&S) + + + ?????(&T) + + + エラーに下線を表示(&U) + + + ???????(&C) + + + ?????????????? + + + ????????????????? + + + ??????????? + + + ???????? + + + ツール + + + ????????????? + + + ????? + + + モジュール + + + Windowsアプリ + + + アセンブリを生成するディレクトリを選択してください. + + + ????? + + + SharpDevelopの設定 + + + ????????????(&C) + + + ??????????????(&M) + + + ???????????????? + + + ??????????(&F) + + + ?????????? + + + Win32????????(&R) + + + ?? + + + DLL???????: + + + ?????? + + + ??????: + + + ??????: + + + ?? + + + ????(&O): + + + ?????(&S) + + + Intel 64-bit Itanium????? + + + ???(&A) + + + ?????(&S): + + + ?????????????(&R) + + + ????? + + + ????????????? + + + ?????????????????????????(&C) + + + ????????? ????: + + + ?? + + + mscorlib.dll??????(&M) + + + ?????? + + + VB?????????: + + + ?? + + + ??-?? + + + ?????????(&M) + + + ????????? + + + ????????(&W): + + + ?????????????????????????????????????????? + + + ???????? + + + ????????-?? + + + ??????????? + + + ????(&N) + + + ????????(&R) + + + ?? + + + ???? + + + ????(&A) + + + ???????????????? + + + ?????? + + + ?????? + + + ????????(&W) + + + ????????(&F) + + + ????????(&E) + + + ?????????(&N) + + + ???????? ??????? + + + ????????????????? + + + ???????????6?????????? + + + sn.exe?????????.NET Framework SDK????????????????????? + + + ??????? + + + ??????? + + + ??????????????????????????????????????????????????????????????? + + + ??????? + + + .NETアセンブリブラウザ + + + ????? + + + ????????????????? + + + ??? + + + バージョン + + + GAC + + + ?? + + + プロジェクトディレクトリ + + + ??????? + + + プロジェクト + + + ??? + + + 選択された参照 + + + ??(&E) + + + + + + ?? + + + ??? + + + ??????? + + + ファイル名 + + + ???????????????????????????????? + + + 対象(&C) + + + 行数 + + + プロジェクトモードで行う必要があります + + + ??(&S) + + + 合計 + + + ??? + + + ????SDK bin?????${Executable} ???????? + + + ${File}を読み込めませんでした。 ファイルが見つかりません。 + + + ???????? + + + ??????? + + + ???????????????????????????? + + + ???? + + + ソース + + + ???? + + + 追加(&A) + + + < 戻る + + + ??(&B) + + + キャンセル + + + ??(&C) + + + 保存先を選択 + + + ???(&C) + + + 新規 + + + ?? + + + ??(&D) + + + ?????? + + + 編集(&E) + + + エラー + + + {0}'???????????????? + + + 完了 + + + 終了 + + + ???? + + + ???????? + + + ???? + + + ???(&H) + + + 無視 + + + ??????? + + + ?????????????? + + + 現在のファイル + + + ディレクトリ + + + すべてのプロジェクト + + + 下へ移動(&D) + + + ????(&U) + + + ?? + + + ?? > + + + OK + + + ??(&O) + + + ????? + + + ?? + + + ?? + + + 更新 + + + 取り除く(&R) + + + ?????(&N) + + + ??? + + + ??????? + + + ?? + + + + + + 警告 + + + ?? + + + ????????????????????????. ?????????????? + + + ファイル名に不正な文字が含まれています。異なる名前を選択してください。 + + + ?? + + + ????... + + + ?????(&D): + + + ?????(&P): + + + ????????(???????????) + + + ????Web???? + + + XML???? + + + ?????????????????: + + + ????? + + + ???????????{0}??? + + + <?????> + + + ?????????????????? ${Count} ????????????????????????????????????? + + + ?????????? + + + ????????????? + + + ???????????????? + + + ?? + + + ??????: + + + ??????????????? + + + ?????????????????????????? + + + ??????? + + + ? {0} ???????: + + + ICSharpCode.Core?????????? + + + ? + + + ???????????????????Ctrl+Space????????? + + + FxCop??????????????: + + + ??Mono????????????????: + + + FxCop????? + + + FxCop?????? + + + FxCop?? + + + FxCop????????? - ???FxCop????????????? + + + ????????(CODE_ANALYSIS?????) (&E) + + + ?????????????... + + + ???????????????(CODE_ANALYSIS?????) (&R) + + + SharpDevelop????????FxCop?????????? + + + ??? + + + ???????? + + + ????????? + + + ??????? + + + ????? + + + ??? + + + ??????????????????????: + + + ?? + + + ?? + + + ????????? + + + 説明 + + + ???? + + + ????? + + + ??????? + + + ?????????? + + + ????????? + + + ??????? + + + ?????????????????????? + + + .NETリソースファイル(バイナリ) + + + C#ソースファイル + + + Javaソースファイル + + + ?????? + + + .NETリソースファイル + + + VB.NETソースファイル + + + XMLドキュメント + + + NAnt '{0}' ???????? + +SharpDevelop???????NAnt??????????????????? + + + NAnt???? + + + ??????????(&B) + + + ??????(&G) + + + NAnt?????(&V) + + + ??(&B) + + + NAnt???????? + + + ????????? + + + ?????????????(&T) + + + ????????(&T) + + + NAnt???(&S) + + + ??????? + + + PInvoke????? + + + ?? + + + ?? + + + ?????: + + + ???? + + + ?? '{0}' ??????????? + + + PInvoke?????... + + + C#??Python + + + VB.NET??Python + + + ??Python???????? + + + Python???????? + + + {0}'??????????????????????????????? + + + ??Ruby???????? + + + Ruby???????? + + + ${Path}?????${FileNameWithoutPath}????????????????. ??????????????????????????????????. + + + ${Path}???${FileNameWithoutPath}??????????????????. ???????????????????????????????????????????????????. (???????????????) + + + C#からVB.NETへ + + + デバッグ + + + デフォルト + + + <??> + + + ??????? + + + ??????? + + + <デフォルトにリセット> + + + ????????????????????????? +??:???????????????????????? + + + ?? + + + ???? + + + ???? + + + ??????????????????????(??????????) + + + ?????${ErrorCount} ???????????? + + + ????????? + + + ???????? + + + VB.NET??Boo + + + '${FileName}'をオープン出来ませんでした。有効なコンバインやプロジェクトではありません。 + + + SharpDevelop?'${SolutionName}'??????????'${ProjectName}'????????? + + + ${ProjectName}' ? '${SolutionName}' ??? + + + ${ProjectName}' ?????????????? + + + プリントドキュメントの生成が出来ません + + + この名前のファイルは書き込み保護され既にこの位置に存在します。 + + + ?? + + + ????????? + + + ??????? + + + ???????????? + + + ファイルを再読み込みしますか? +(再読み込みするとすべての変更が失われます) + + + ????????? ${LanguageBinding} ?${FileName}??????????? + + + ファイルを保存しました + + + ?????'${FileName}'????????? + + + ファイルを保存しました + + + ???????????????????? + + + VB.NETからC#へ + + + (+${NumOverloads} ???????) + + + ${CurrentMethodNumber} / ? ${NumberOfTotalMethods} + + + ファイル ${File} が外部で変更されたようです。再読み込みしますか? + + + ?? + + + SharpDevelop??? + + + SharpDevelop??????????????????????????????????SharpDevelop?????????????SharpDevelop?????????????????????? + + + ???????????????:??????????????????Web?????????????????? +??????????????????????????????????????????????????????????????????????? + + + ???SharpDevelop???????? ???????????????! + + + SharpDevelop???????????? + + + ??????????????SharpDevelop??????????????????? + + + フォームをデシリアライズできません。可能な理由:Initialize componentメソッドが手動で変更されました。 + + + ${RootComponent}'.???????????????????????? + + + ルートデザイナーはウィンドウフォーム表示テクノロジをサポートしていません。 + + + ??????????????: + + + ????? + + + ?? + + + ???? + + + ???????????(&O) + + + カスタム + + + ?????????? + + + ????????????????? + + + ???.NET????????????????? + + + バージョン + + + GAC + + + ????? ${Name} ??????????????????? + + + ?????(&F) + + + ??????????(&A) + + + ????? + + + ???? + + + ???????? + + + ???? + + + ??(&N) + + + ????????????????? + + + ??????????(&M) + + + ???????????????????????????? + + + ?????(&E) + + + ?????... + + + ???????? + + + ?????????? + + + ?????? + + + ????? + + + ?? + + + Visual Studio????????????????? + + + グリッドプロパティ + + + 高さ(&H) + + + ????????? + + + ??????????? + + + プロパティをアルファベット順にソート + + + ???????(&S) + + + ????????????? + + + ????? + + + グリッドに吸着(&N) + + + ?(&W) + + + ????????????"TODO"??????? + + + ?????????(??????????????????????????????????) + + + ?????????????? + + + ウィンドウフォームデザイナー + + + カテゴリ名(&C) + + + この名前は重複しています。別の名前を選択してください。 + + + ??????? + + + カテゴリ名を変更 + + + ??????????(&S) + + + ??????????????????????????????? + + + ???????????????????????(???????????????????????????) +?????????????????? + + + ??????????????????????????? +Windows?????????????????????????????????????????? +(?????????????????????????????) + + + False + + + True + + + Web????? + + + ?????? + + + ?? + + + ?? + + + ??URI + + + ???? + + + ?? + + + ????(&A) + + + ? + + + ?????Web???? + + + ????????? + + + ??????????????? +??????????????? + + + 不正なプロジェクト名。文字、数字、スペース、'.'もしくは'_'のみが許されています。 + + + ??????????:??????????????????? + + + ??????????:???????????????????????? + + + &Select the file types you want to associate with SharpDevelop: + + + ファイルタイプ + + + &Register file types at application startup + + + 大文字と小文字を区別する(&C) + + + ????????? + + + ??????????(&I) + + + ????????(&R) + + + ソート方向 + + + ??(&A) + + + 降順(&D) + + + ??????? + + + Url: + + + ????(&U) + + + ?????... + + + ????(&R) + + + 説明を表示(&S) + + + ??????????:???????????????????????????????? + + + ???? + + + ???????? + + + ファイルのビルドアクション + + + ?????????????????????????? + + + ??????? + + + ??????????? + + + ?????????????????????? + + + ??? + + + ????? + + + ????????????????????????????????????????????????????????????:???????????????? + + + ???????? + + + もしtrueならば、アウトプットパスに参照されたアセンブリがコピーされます + + + ??? + + + ???????? + + + URL?? + + + Web??URL?? + + + ????? + + + Web??URL + + + Web??URL + + + ??????????? ${combineLocation} ????????????????????????? + + + ? '${type}' ??????????????? + + + ファイル ${fileName} を書き込むことが出来ないかもしれません。 + + + プロジェクトファイル ${projectLocation} はすでに存在する。すでに存在するファイルを上書きしますか? + + + ???????????? + + + ?????????????????? + + + ?????????????? + + + ????????????????????? + + + ?????????????(&p) : + + + ???????????????(&t) : + + + ??????????????????? + + + ??????????? + + + <?????> + + + ?????? ??????? + + + ???????????????????SharpDevelop????????? +??????Framework????????????????????????????? + + + 現在の環境が見つかりません。 +'オプション->表示スタイル'を表示し、現在の言語環境を変更してください。 + + + 全てマークしました。 + + + 置換が全て完了しました。 + + + ???? + + + ??????? + + + ????????????? + + + ????????????? + + + ?????????????? + + + ??????????? + + + ??????? + + + ${Name} ?????... + + + ???????????????????? '{0}' ????????? + + + ??????? + + + ?????: + + + ???????: + + + ??????????? + + + WiX????? + + + ????????????ID '{0}' ??????????? + + + ?????????,????????????? + +?: + +Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension + + + ????? + + + ?? + + + ????????? + + + ???????????????????WiX????????????? + + + TARGETDIR ???????DirectoryRef??????????????????????WiX???????WiX3.0??????"http://schemas.microsoft.com/wix/2006/wi"???????? + + + ?????????? + + + ?????????... + + + WiX???????? + + + WiX????? + + + ???????????? + + + {1} ?? {0} ??????????? + + + ??... + + + WiX?????????????????????????????????????????????????????????????????????????????? + + + ??????????? + + + ????????????? + + + ??????64 + + + ?????? + + + ????? + + + ???? + + + ?????? + + + ??? + + + ?????????(x64) + + + ????????? + + + ?? + + + ??????? + + + ???? + + + Temp + + + ?????? + + + Wix?? + + + WiX????? + + + WiX?????????? + + + .NET Framework?? + + + ?????????? + + + WiX?????? + + + WiX?????????? + + + WiX????????? + + + ?????? + + + ???? + + + ????? + + + ?? + + + ??? + + + ????: + + + XSLT?????(&A)... + + + XSLT???????????? + + + スキーマを生成 + + + XPath?????(&X) + + + XSLT???(&O) + + + XSLT???(&T) + + + Xmlスキーマを選択 + + + XML???(&V) + + + ?????????????(&A) + + + ??????????????(&T) + + + XML????? + + + XML?????? + + + 拡張(&E) + + + ??????? + + + 接頭辞(&P) + + + スキーマ(&S) + + + ???? + + + スキーマを追加できません。'{0}'という名前空間はすでに存在します。 + + + ???? '{0}' ???????????????? + + + Xmlスキーマ + + + スキーマを追加することが出来ません。 + + + 変更を保存することが出来ません。 + + + ?????... + + + ???????? + + + ??????????? + + + ???????... + + + ???????????? + + + ???????????? + + + ????? + + + XML??? + + + ???? + + + XPath????0??????? + + + ?? + + + XPath??? + + + XPath: + + + XSLT?? + + + ILSpy?????????????? + + + ILSpy??? + + + ILSpy?????? + + + 外部ツールの構成ファイルを読み込むことが出来ません + + + テンプレート構成ファイルを読み込むことが出来ません + + + プロジェクトテンプレート読み込みエラー: + + + ?????????????? + + + ?????????? + + + ?????????? + + + ??????????... + + + ------ ?????: ??????: ${Project} ??: ${Config} ------ + + + ?????? + + + COM ?????????????? + + + ??: ${Script} + + + ??????... + + + ビルド完了 -- ${Errors} エラー, ${Warnings} 警告 + + + ${Name} ?????????(SharpDevelop??????) + + + SharpDevelop + + + 変更を破棄しますか? + + + 変更を保存しますか? + + + ?????????? + + + ?????? ${Project} + + + レディ + + + ????????? + + + ?????/?? + + + ???????? + + + ???????? + + + {0} @? {1} + + + ?? + + + ?????? + + + ????????(&O) + + + ???????????(&P) + + + ???????????(&S) + + + ???????? + + + ?? + + + ??? + + + ?? + + + ?????????? + + + ??? + + + ???????: + + + ???????? + + + ??????? + + + ??????????????????????????? + + + ??????????????????????? + + + ?????????????????????????????????????????? + + + [??????] + + + ?? + + + ????????? + + + ??????? + + + ????????? + + + ???? + + + ???????? ???! + + + {2} ??? {1} ?? {0} ????????????? + + + ?? + + + ?? + + + ?? + + + ??????????? + + + ??????????? + + + ???????????? + + + ???? + + + ????? + + + ???????? + + + at {0} + + + ???????? {0} ????????? + + + ???????? + + + ????????? + + + ????? + + + ?? + + + ??/??? ????????? + + + ???? + + + ????? + + + ??????????????????????? + + + {0} ? {1} ???????? + + + ????????? + + + ????????? + + + ????????????? + + + ??????????? + + + ????????????????? + + + ???????????????? + + + ?????????... + + + 16??????? + + + ????????? + + + ???? + + + ????????: + + + ???????: + + + ???????? + + + ????????????????????! + + + ???????? + + + {0} ?? {1} ?????? - ??? {2}. + + + ?????????????? + + + {1} ???????? {0}????????? + + + ??????????? + + + ????????????? + + + ?? + + + ???? + + + ????????? + + + ???????? + + + ???????????? + + + スレッド + + + ????????????????????????????? + + + ????????????????????????? + + + ??????????????????????????????? + + + ?? + + + ?? + + + ?? + + + ???? + + + ???? + + + ?? + + + ?? + + + ????????????? + + + ???? + + + ?????? + + + ????????: + + + ??????? + + + ${TaskService.Messages} ????? + + + ?????????????????? + + + ??????????????? + + + ??? + + + ?????? + + + ???? + + + ??? + + + ファイル + + + ??? + + + アウトプット + + + ビルド + + + ???? + + + プロジェクト + + + ????? + + + ????????? + + + <?????> + + + ???????? + + + ???? + + + in + + + 1 ???? + + + 1 ? + + + ???????? + + + ???? + + + ?????? + + + ??? + + + ??????? + + + ?????? + + + ?????? + + + ???????: ?? + + + ------ xml検証中 ------ + + + 検証: 成功 + + + ?????????????????????????? + + + 定義へ移動(&G) + + + 現在選択しているプロジェクトにnunitへの参照を追加 + + + ????????????? + + + ?????????? + + + ?????? + + + ?????? + + + ?????? + + + ????????????????????????????????? + + + エラーの読み込み + + + ?????? '${TestCase}' ?? + + + ?????? '${TestCase}' ??????????? + + + アセンブリをロード... + + + ?????????????? + + + ??????????? + + + ???(&C) + + + これ以外を閉じる(&b) + + + 保存(&A) + + + ????????(&A)... + + + ファイル名をコピー + + + ????????????????????? + + + ??? + + + ??? + + + ??????????????????????????????????????????? + + + ${FileName}' ?????????????????????????? + + + 追加 + + + ????? + + + Web????? + + + ${FileName}'?????????? + + + ${FileName}'??????????????????????? + + + ?????????? + + + ???????... + + + ????????? + + + Html???????(&E) + + + ????????? + + + コンパイル + + + 配置 + + + ???????... + + + ???????(&E) + + + ?????(&N) + + + ?????????(&N) + + + ??????????????(&F) + + + 開く(&P) + + + ????(&E) + + + 名前の変更(&N) + + + ????????????????(&A) + + + 新しいフォルダ + + + project {0} から全てのWeb参照を削除しますか? + + + ????Web????? + + + ????? (*.dll)|*.dll + + + アセンブリ + + + ???? + + + ????? + + + アセンブリの生成 + + + ECMA script ?? + + + 終了 + + + 明白なキャプチャ + + + ???? + + + ????????? + + + ホワイトスペースを無視 + + + ?? + + + ?? + + + マルチライン + + + ???? + + + public??? + + + ???? + + + 置換 + + + 置換後の文字列 + + + 置換結果 + + + 右から左へ + + + ??????? + + + ??? + + + 開始 + + + ??? + + + ??? + + + クラス名は空にすることが出来ません + + + ????????????: + + + 生成に失敗しました:理由 + + + ??????????????? + + + 有効なファイル名を入力してください。 + + + ファイル名を入力してください。 + + + ?? + + + 一致 + + + ????????????? + + + ?? + + + ???? + + + ??????? + + + ?? + + + ビットマップを更新... + + + ??????? + + + リソースを読み込めません + + + ?????????????: ??????????????'{0}' ??????? + + + ?? + + + ???????(&F) + + + 文字列の追加(&N)... + + + リソース名をコピー + + + 名前の変更(&R) + + + + + + このキーはすでに定義されています。別のものを使ってください。 + + + すべてのファイル (*.*) + + + ????????? (*.exe;*.dll) + + + Boo?????????? + + + コンバインファイル (*.cmbx) + + + C++ファイル (*.cpp;*.c;*.hpp;*.h) + + + C#???? (*.cs) + + + ???????? + + + ???????? (*.exe;*.com;*.pif;*.bat;*.cmd) + + + ???????? (*.ico) + + + IL???? + + + ILAsm?????????? + + + ???????? + + + NAnt??????? + + + ???????? (*.resources;*.resx) + + + ??????? (*.sln) + + + VBファイル (*.vb) + + + XML???? (*.xml) + + + Xmlスキーマファイル (*.xsd) + + + XSL???? + + + グリッドに合わせる(&G) + + + ??????(&C) + + + ???? + + + ????????????! + + + ${Name}?????? + + + ?????????????????????? + + + ${Name}?????? + + + ???????? + + + ??????? + + + ?????????? + + + ????????(&D) + + + ???????? + + + ?????????... + + + ?????????(&O) + + + ????????(&B) + + + ???????? + + + ?????????????????????????? + + + ????'${FileName}'??????? + + + ${Name}??????? + + + ????????import??????????(&U) + + + ???????????? + + + ?????(&R) + + + ASCIIコード表 + + + ?????????? + + + C#ドキュメントタグ + + + ?? + + + ????? + + + ???????????????????????? + + + XSLT + + + ?????????????????? + + + ??SharpDevelop????????Visual Studio .NET 2003(??)?????????????????????????? +??????SharpDevelop 3.2???????????????????????????????????? + + + {0}????????:\n{1} + + + ??????????? {0} ????????????????????????? + + + {0}????????::\n{1}\n\n???????????????? + + + ??????????????????????? +SharpDevelop 2??????????????????:????????????????????????????????????????????? + +?????????????????/??????? + + + ????????????????/?????????? + + + {0}'?????????????????????? + + + データベース + + + SharpDevelop???? + + + ?????????? + + + ????? + + + ?????????? + + + グループ化/並び替え + + + ?????????? + + + ???????? + + + 選択を表示 + + + 基本設定 + + + ???? + + + 詳細セクション + + + ページフッタ + + + ページヘッダ + + + ???????? + + + ???????? + + + ???????????? + + + SharpDevelop??????????????????1?????????????????????? + + + ???'SharpReport'????????????????????? + + + ファイルが壊れていて読み込めません(SharpReportファイルは不正なフォーマットです) + + + ?????????? + + + ?????? + + + ????????? + + + ?? + + + ??? + + + ??????????? + + + ????? + + + ?????????? + + + ???????? + + + ?????? + + + ?????? + + + ?? + + + ??????????? + + + PDF??????? + + + ?? + + + ? + + + SharpReport - コントロール + + + データフィールド + + + ???? + + + SharpReport - 機能 + + + ????? + + + ページ数 + + + 今日 + + + ???????? + + + ???????? + + + ???? + + + ? + + + ???? + + + 矩形 + + + ? + + + ??? + + + ???? + + + ??????? + + + ??????? + + + ????? + + + ??????? + + + ????????? + + + ?????? + + + ????????? + + + ??????? + + + ????????? + + + ???????? + + + タブを追加(&A) + + + ?????(&D) + + + ??"${TabHeader}"????????(????????????????????) + + + ?????(&D) + + + アイテム"${TabItem}"を削除しますか? + + + ????????(&R) + + + ????????(&R) + + + 作者を表示 + + + ?? + + + ??????? + + + ???? + + + ????? + + + ????? + + + ???????? + + + ?? + + + ???? + + + スタート + + + ?????????? + + + コンバインを開く + + + ??????? + + + 挿入 + + + 上書 + + + 行:${Line} 列:${Column} 文字:${Character} + + + その他 + + + Windows???????? + + + ???????????? + + + ??????????????? + + + ??????? + + + ??? + + + ????????? + + + 空のファイル + + + ?? + + + 空のヘッダファイルを生成。 + + + ヘッダファイル + + + 空のHTMLファイル + + + ??HTML??????? + + + ???????? + + + "My"???????????????? + + + ???NAnt?????????? + + + NAnt??????? + + + #if TEST ... #endif'??? + + + ??????????TEST??????????????????????? + + + SetUp??? + + + True????SetUp??? + + + TearDown??? + + + True????TearDown??? + + + ????? + + + ????? + + + ?????????????????????????????????????? + + + 空のリソースファイルを作成 + + + 空のリソースファイル + + + #Dの空のメニューコマンド。 + + + メニューコマンド + + + #Dのオプションパネル。 + + + オプションパネル + + + 様々な場合に使用することができるコマンド。 + + + シンプルコマンド + + + #Dパッドコンテンツ (#Dビューの例)。 + + + 空のパッド + + + #Dビューコンテンツ (テキストエディタやリソースエディタの例) + + + 空のビュー + + + シングルトンパターンに従ったクラスを生成します。 + + + シングルトンクラス + + + Equals()?GetHashCode()??????????? + + + ???????Equals()?GetHashCode()????????? + + + ??? + + + ?????????? + + + ?????????????? + + + 基本的な単体テストを生成します。 + + + ??????? + + + ASP.NET Web?????? + + + ASP.NET Web???? + + + ??????????ASP.NET??Web??????????? + + + ASP.NET Web???? + + + ASMX Web???????????????? + + + ASP.NET Web???? + + + Windows????????????? + + + フォーム + + + Windows?????????????????? + + + ユーザコントロール + + + WPF????????? + + + WPF??? + + + WPF?????????? + + + WPF?????????? + + + WPF????????? + + + WPF????? + + + WPF????? + + + Wix用空の断片ファイル + + + 空のWix断片ファイル + + + ????????????? + + + ????????????????? + + + ?????????????? + + + ?????????app.config??????????????????MSBuild????appname.exe.config??????????? + + + 空のXMLファイル + + + 空のXMLファイルを作成。 + + + ??XML??????? + + + XML???? + + + ??XML???????????? + + + XML????????? + + + ????????????????????? + + + 空のコンバイン + + + ??????????????????????????? + + + ???????? + + + コマンドラインアプリケーションを生成するプロジェクトです。 + + + ????????????? + + + ????????????????? + + + Direct3D?????????????????????????????? + + + Direct3D???????? + + + 空のプロジェクト。 + + + ???????? + + + Glade# ????????????????? + + + Gtk# ????????????????? + + + MSIインストーラのためのWindowsインストーラプロジェクト。 + + + ???????????? + + + COM??????????????????? + + + ?????? + + + SharpDevelop????????????????????????? + + + SharpDevelop???? + + + Silverlight????????????????????? + + + ?????????????????????????????????????? + + + ?????????????? + + + Windowsアプリケーションに使用されるユーザコントロールを生成するプロジェクトです。 + + + Windowsユーザコントロールライブラリ + + + ASP.NET Web??????????????? + + + Windows?????????????????????????????? + + + Windows???????? + + + Windows??????????????? + + + Windowsサービス + + + ?????WPF??????????? + + + 1?????????????????WPF??????????? + + + ??????????????????????? + + + ????????... + + + ??(&A) + + + ?????? + + + ???? + + + ???????????(&B) + + + ????????????(&C) + + + ??/??????????? + + + ??????????(&P) + + + ${CurrentProjectName} ?????(&E) + + + ????(&D) + + + ?????????... + + + ??(&B) + + + ??????????? + + + デバッグを続ける(&C) + + + ????????? + + + ???? + + + ??????.NET Framework????????????????????????????????????????? + + + ??????????? + + + ????????? + + + ???????????????????????????? + + + ?????????????????????????? + + + ????????? + + + ????????? + + + ???????????????????? + + + ?????? + + + ?????? + + + ??????? + + + ??????? + + + ???????? + + + ???????? + + + プロセスを停止 + + + 現在のプロセスを停止させ、デバッガを終了します。 + + + ????????????? + + + 編集(&E) + + + コピー(&C) + + + ??????????????????? + + + ????(&T) + + + ??????????????????????? + + + ??(&D) + + + ?? + + + 折りたたみ(&O) + + + 定義だけ表示(&D) + + + すべての折りたたみをトグル(&A) + + + ???????????(&T) + + + ??????(&F) + + + ???????????? + + + 大文字小文字変換 + + + ??????????? + + + 行頭のタブをスペースに変換 + + + ????????? + + + 行頭のホワイトスペースを削除 + + + 行末のホワイトスペースを削除 + + + 並び替え... + + + スペースをタブに置換 + + + タブをスペースに置換 + + + 大文字に変換 + + + ????(&P) + + + クリップボードの文字列を挿入します + + + やり直し(&R) + + + ?????????????? + + + ?????(&A) + + + 元に戻す(&U) + + + ??????????????? + + + ???????(&W)... + + + ????(&F) + + + ???????????????? + + + ?????????????????? + + + ???(&C) + + + ファイル(&F) + + + コンバイン(&C) + + + すべてのバッファを閉じる(&L) + + + アプリケーションの終了(&E) + + + 新規作成(&N) + + + ????(&F)... + + + ??????????????? + + + ??????(&P).. + + + コンバイン(&C)... + + + 開く(&O) + + + ????(&F)... + + + ???????????? + + + ??????/???????(&P)... + + + ??(&R) + + + ???????(&P) + + + ?????????(&F) + + + ???????????(&R) + + + ??????????(&E) + + + 上書き保存(&S) + + + ???????????????? + + + ?????(&L) + + + 現在オープンしているバッファをすべて保存します + + + ????????(&A)... + + + フォーマット(&O) + + + ??(&A) + + + 下(&B) + + + ????(&C) + + + 左(&L) + + + 右(&R) + + + グリッドに合わせる(&G) + + + 上(&S) + + + 上下中央(&M) + + + ??????????(&C) + + + ??(&H) + + + 上下(&V) + + + 左右の間隔(&H) + + + 最前面へ移動(&B) + + + ??(&R) + + + 間隔を狭くする(&D) + + + 間隔を広くする(&I) + + + ????????(&E) + + + 最背面へ移動(&S) + + + アイコンを並べる(&L) + + + コントロールのロック(&L) + + + ??(&O) + + + ??????(&B) + + + ??????(&S) + + + 同じサイズに揃える(&M) + + + ??(&B) + + + ??(&H) + + + ?(&W) + + + グリッドのサイズに揃える(&D) + + + ??????????(&S) + + + ?????(&P) + + + ????????(&T) + + + ?????(&V) + + + 削除(&R) + + + ???????(&D) + + + ???????(&I) + + + ????????(&E) + + + ヘルプ(&H) + + + ???????(&A)... + + + ????????? + + + ?????????(&D) + + + GPL???(&G)... + + + ReadMe(&R)... + + + ????????????? + + + ???Tip(&T)... + + + 目次(&H) + + + Web + + + プロジェクト(&P) + + + ????????(&O)... + + + 現在のプロジェクトをビルド + + + ?????????????????????? + + + ???????????????????????????(???????) + + + ??????????????????????????????? +???????????? + + + ??????? + + + ??(&R) + + + ????????????????????(?????????) + + + ??(&S) + + + ?????????????(&C) + + + ???????????????????????? + + + ??(&F)... + + + ????(&N) + + + ?????????(&S) + + + ??(&G) + + + ??????????(&M) + + + ?????????? + + + 次のブックマーク(&X) + + + 次のブックマークへ移動します + + + ????????(&P) + + + ?????????????? + + + 置換(&R)... + + + ブックマークの挿入/削除(&T) + + + ????????????????????????? + + + ツール(&T) + + + ??????(&C) + + + ????????????????? +???????: + + + + ???????: + + + ?????????? + + + ????... + + + ???GUID???(&G) + + + オプション(&P)... + + + Quick XMLドキュメント + + + ?????????? + + + ??(&V) + + + デバッグ(&D) + + + フルスクリーン(&F) + + + ?????? + + + ????? + + + ???? + + + スタートページを表示(&S) + + + ツール(&T) + + + ウィンドウ(&W) + + + 次(&N) + + + 前(&P) + + + 分割(&S) + + + ??: + + + ?????????????????????????????????????????? + + + ??: + + + ???: + + + ??????? + + + 選択範囲をコメント化 + + + コピー(&C) + + + ????(&T) + + + ファイルモード + + + インデント + + + ????(&P) + + + ????? + + + 選択範囲を非コメント化 + + \ No newline at end of file diff --git a/data/resources/StringResources.kr.resx b/data/resources/StringResources.kr.resx index 9bc19d94fa..7808cfdd22 100644 --- a/data/resources/StringResources.kr.resx +++ b/data/resources/StringResources.kr.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ちょっとくらいのわがままは、大目に見てね。 + 정보 @@ -5098,9 +5101,6 @@ SharpDevelop 2는 리소스를 다른 방법으로 컴파일합니다: 리소스 그래픽 단위 - - 기본 보고서 설정 - 보고서 모델 @@ -5134,15 +5134,6 @@ SharpDevelop 2는 리소스를 다른 방법으로 컴파일합니다: 리소스 사용가능한 필드 - - 스키마 (.xsd) 파일의 경로 - - - 결과 저장 (스키마와 데이터) - - - 결과 저장 (스키마만) - 질의 결과 보이기 @@ -6263,7 +6254,4 @@ SharpDevelop 2는 리소스를 다른 방법으로 컴파일합니다: 리소스 이 부분의 주석 해제 - - ちょっとくらいのわがままは、大目に見てね。 - \ No newline at end of file diff --git a/data/resources/StringResources.nl.resx b/data/resources/StringResources.nl.resx index 14b1480cdb..a5f7c2f4ae 100644 --- a/data/resources/StringResources.nl.resx +++ b/data/resources/StringResources.nl.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Deze bron is niet in gebruik. Het doel is om vertalingsdatabase te testen en heeft een 'line break' + Info... @@ -2650,6 +2653,9 @@ Wilt u het nieuwe bestand toevoegen aan project ${CurrentProjectName}? Standaard waarden voor VB Opties: + + Code formatteren + Instellingen @@ -5730,6 +5736,9 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie Voeg referentie toe + + Service referentie toevoegen + Web referentie toevoegen @@ -6484,9 +6493,6 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze. Grafische eenheid - - Basis rapport instellingen - Rapport model @@ -6535,15 +6541,6 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze. Beschikbare velden - - Pad naar schema (.xsd) bestand - - - Resultaat opslaan (Schema en gegevens) - - - Resultaat opslaan (Alleen schema) - Toon resultaat van de opvraging @@ -6608,6 +6605,9 @@ De hulpbron bestanden zijn hernoemd/verplaatst op de beschreven wijze. Oplossing openen + + Verwijder van de lijst met recente projecten + Startpagina @@ -7774,7 +7774,4 @@ Startfout: Regiocommentaar verwijderen - - Deze bron is niet in gebruik. Het doel is om vertalingsdatabase te testen en heeft een 'line break' - \ No newline at end of file diff --git a/data/resources/StringResources.no.resx b/data/resources/StringResources.no.resx index 15253445af..41a19068c0 100644 --- a/data/resources/StringResources.no.resx +++ b/data/resources/StringResources.no.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Denne ressursen er ikke i bruk. Formålet er å teste oversettingsdatabasen, og har +et linjeskift + Om @@ -5838,9 +5842,6 @@ SharpDevelop 2 kompilerer ressurser annerledes: ressursnavnet er ikke bare filna Grafikkenhet - - Grunnleggende rapportinnstillinger - Rapportmodell @@ -5874,15 +5875,6 @@ SharpDevelop 2 kompilerer ressurser annerledes: ressursnavnet er ikke bare filna Tilgjengelige felter - - Sti til skjema (.xsd) fil - - - Lagre resultat (skjema og data) - - - Lagre resultat (kun skjema) - Vis spørreresultater @@ -7047,8 +7039,4 @@ SharpDevelop 2 kompilerer ressurser annerledes: ressursnavnet er ikke bare filna Fjern kommentarer - - Denne ressursen er ikke i bruk. Formålet er å teste oversettingsdatabasen, og har -et linjeskift - \ No newline at end of file diff --git a/data/resources/StringResources.pl.resx b/data/resources/StringResources.pl.resx index a0d27a95f7..ed874cd0aa 100644 --- a/data/resources/StringResources.pl.resx +++ b/data/resources/StringResources.pl.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Ten zasób nie jest używany. Jego przeznaczeniem jest testowanie bazy tłumaczeń i posiada +łamanie wiersza + O Menadżerze Dodatków @@ -4585,9 +4589,6 @@ Pliki zasobów zostały odpowiednio nazwane/przeniesione. Jednostka Graficzna - - Bazowe ustawienia raportu - Model Raportu @@ -4621,15 +4622,6 @@ Pliki zasobów zostały odpowiednio nazwane/przeniesione. Dostępne Pola - - Ścieżka do Pliku Schematu Pliku (.xsd) - - - Zapisz Rezultat (Schemat i Dane) - - - Zapisz Rezultat (tylko Schemat) - Pokaż rezultat Zapytania @@ -5661,8 +5653,4 @@ Błąd podczas uruchamiania: Odkomentuj region - - Ten zasób nie jest używany. Jego przeznaczeniem jest testowanie bazy tłumaczeń i posiada -łamanie wiersza - \ No newline at end of file diff --git a/data/resources/StringResources.pt-br.resx b/data/resources/StringResources.pt-br.resx index 50a9a3b664..fdb9ec7c3c 100644 --- a/data/resources/StringResources.pt-br.resx +++ b/data/resources/StringResources.pt-br.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Este recurso não está sendo utilizado. O seu proposito é testar o banco de dados de traduções e tem uma quebra de linha + Sobre @@ -228,6 +231,33 @@ Formato de arquivo desconhecido. + + Instalar do arquivo... + + + Repositorio: + + + Pesquisar: + + + Mostrar adicionais instalados + + + Você não pode desinstalar o Gerenciador de Adicionais porque você precisa dele para reinstalar os adicionais! + + + Repositório de adicionais do SharpDevelop + + + Criado por: + + + Dependências: + + + Baixados: + Esse arquivo contem novas linhas inconsistentes. @@ -5080,9 +5110,6 @@ Use somente letras, dígitos, espaço, "." ou "_" são permitidos. Unidade Gráfica - - Configurações de relatório básicas - Modelo de relatório @@ -5110,15 +5137,6 @@ Use somente letras, dígitos, espaço, "." ou "_" são permitidos. Campos Disponíveis - - Caminho para o arquivo Schema (.xsd) - - - Salvar resultado (Schema e Dados) - - - Salva resultado (apenas o Schema) - Exibir resultado da consulta @@ -6199,7 +6217,4 @@ Use somente letras, dígitos, espaço, "." ou "_" são permitidos. Desfazer comentário - - Este recurso não está sendo utilizado. O seu proposito é testar o banco de dados de traduções e tem uma quebra de linha - \ No newline at end of file diff --git a/data/resources/StringResources.pt.resx b/data/resources/StringResources.pt.resx index 9019ccad6c..5712762704 100644 --- a/data/resources/StringResources.pt.resx +++ b/data/resources/StringResources.pt.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Este recurso não é utilizado. A sua finalidade é testar a base de dados de traduções + Sobre @@ -4722,9 +4725,6 @@ Os ficheiros de recursos foram renomeados/movidos em conformidade. Unidade Gráfica - - Parâmetros base do relatório - Modelo de Relatório @@ -4752,15 +4752,6 @@ Os ficheiros de recursos foram renomeados/movidos em conformidade. Campos Disponíveis - - Caminho para o Ficheiro de Esquema (.xsd) - - - Guardar Resultado (Esquema e Dados) - - - Guardar Resultado (Só esquema) - Mostrar resultado do inquérito @@ -5846,7 +5837,4 @@ O erro no início foi: Desfazer comentário - - Este recurso não é utilizado. A sua finalidade é testar a base de dados de traduções - \ No newline at end of file diff --git a/data/resources/StringResources.resx b/data/resources/StringResources.resx index c6d41f1639..d9f7fd02b7 100644 --- a/data/resources/StringResources.resx +++ b/data/resources/StringResources.resx @@ -1729,6 +1729,9 @@ Examples: "120", "MainClass", "Main.cs, 120". Italic + + Underlined + Export highlighting colors @@ -3789,6 +3792,10 @@ Please configure the NAnt executable's location in the SharpDevelop Options.Could not find type definition at the cursor position. Error message when using Search>Find Base Classes when the cursor is not on a type reference. + + Could not find type definition or type member at the cursor position. + Error message when using Search>Find Base Classes when the cursor is not on a type reference or type member. + Send Line to Ruby Console @@ -6324,7 +6331,7 @@ Removed the end part of the original message ", reason '${Message}'" since this Update bitmap ... - Text for the link label that make it possible to update the stored bitmap + Text for the button that makes it possible to update the stored bitmap Do you really want to delete the selected resource(s)? @@ -6473,6 +6480,9 @@ Removed the end part of the original message ", reason '${Message}'" since this Base classes of ${Name} + + Base members of ${Name} + The operation cannot be performed because your source code contains errors: @@ -6525,6 +6535,9 @@ Removed the end part of the original message ", reason '${Message}'" since this Find base classes + + Find base symbols + Find &derived classes @@ -6843,17 +6856,14 @@ The resources files have been renamed/moved accordingly. Base settings - Report Type + Report Type : - File Name + File Name : Graphics Unit - - Basic report settings - Report Model @@ -6867,10 +6877,10 @@ The resources files have been renamed/moved accordingly. Push Data - Report Name + Report Name : - Report Type + Report Type : Select the GroupColumn @@ -6902,17 +6912,6 @@ The resources files have been renamed/moved accordingly. Available Fields - - Path to Schema (.xsd) File - - - Save Result (Schema and Data) - Save displayed Data to *.xsd File - - - Save Result (Schema only) - Save only the Schema to *.xsd File - Show Query result @@ -8182,4 +8181,269 @@ Error while starting: This resource is not being used. Its purpose is to test the translation database and has a line break + + Tooltip settings + + + Insert selected code completion entry by typing the following characters: + + + Only insert selected code completion entry by typing <Tab> or <Enter>. + + + Choose exceptions you want the debugger to break on + + + Break on + + + Full exception name + + + Choose exceptions + + + Break on handled ${ExceptionName} + + + Solution + + + Project + + + All opened files + + + File + + + Namespace + + + Class/Module + + + Update icon ... + Text for the button that makes it possible to update the stored icon + + + Can't load resource from file: {0} + + + Add &boolean entry + + + Filter: + + + Update cursor ... + Text for the button that makes it possible to update the stored cursor + + + Search For Issues... + + + Automatically fix issues if possible + + + Service References + + + Reformat + + + Reset + + + Run on Build + + + Filenames: + + + Columns: + + + Ctrl + + + Shift + + + Alt + + + Win + + + Clear console + + + Delete history + + + <Text was truncated because it was too long> + + + Building project ${Name} is not supported. + + + Services: + + + Operations: + + + Manage Packages... + + + Restore Packages + + + Package Management + + + Package Sources + + + Package Management Console + + + Code inspection + + + Formatting + + + Use Up/Down to move to another location. +Press Enter to select the location. +Press Esc to cancel this operation. + + + Client + + + Generate asynchronous operations + + + Public + + + Internal + + + Access level for generated classes: + + + Welcome to the SharpReport Wizard + + + Basic report settings + + + Classes in selected Project + + + Page Layout + + + No project selected, please enter FieldNames + + + <Create ${HandlerName}> + + + Git Options + + + No Git installation found. + + + (automatically detected) + + + 'git.exe' was not found in the selected directory! + + + Select Git path + + + Reset Git path + + + Git Path + + + Press "Alt" to enter Container + + + Assembly Info + + + Assembly version: + + + Company: + + + Copyright: + + + Description: + + + File version: + + + GUID: + + + Make assembly COM-visible + + + Neutral language: + + + Product: + + + Title: + + + Trademark: + + + Assembly info file was not found. Please ensure that the project contains assembly info file. + + + CLS compliant + + + Default alias: + + + Informational version: + + + JIT optimization + + + JIT tracking + + + New GUID + + + One of the assembly info values is incorrect. + + + None + + + WPF Editor + + + Enable App.xaml parsing + \ No newline at end of file diff --git a/data/resources/StringResources.ro.resx b/data/resources/StringResources.ro.resx index a65b6bdfaf..8b5383444c 100644 --- a/data/resources/StringResources.ro.resx +++ b/data/resources/StringResources.ro.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Această resursă nu este utilzată. Scopul ei este de a testa traducerile şi conţine un retur de car + + Despre @@ -2881,18 +2885,12 @@ Toate modificările se vor pierde. Modulul Grafic - - Configurare raport simplu - [Ştergeţi acest text şi introduceţi un şir SQL valid] Câmpuri disponibile - - Cale către fişier schemă (.xsd) - Arată Rezultatele Interogării @@ -3794,8 +3792,4 @@ Eroare la pornire: Regiune necomentată - - Această resursă nu este utilzată. Scopul ei este de a testa traducerile şi conţine un retur de car - - \ No newline at end of file diff --git a/data/resources/StringResources.ru.resx b/data/resources/StringResources.ru.resx index 6b347fe561..d2ff9e4dae 100644 --- a/data/resources/StringResources.ru.resx +++ b/data/resources/StringResources.ru.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Эта строка нигде не используется. Она нужна для тестирования базы данных переводов, а также в ней есть +перенос строки + О Менеджере Плагинов @@ -172,13 +176,13 @@ Плагин станет недоступным после перезапуска SharpDevelop - Вы не можете отключить Менеджер Плагинов. Он необходим для переподключения Плагинов! + Вы не можете отключить Менеджер Плагинов. Он необходим для переподключения плагинов! - Нельзя устанавливать плагины внутри папки ${ProductName},поскольку они являются предустановленными по умолчанию. + Нельзя устанавливать плагины внутри папки ${ProductName}, поскольку они являются предустановленными по умолчанию. - Отменяет деинсталляцию выделенных плагинов. + Отменяет удаление выделенных плагинов. Отменяет установку выделенных плагинов. @@ -209,7 +213,7 @@ Скачайте их из Интернета, нажмите 'Установить плагин' и выберите скачаный файл, чтобы установить его. - Открыть Web-сайт + Открыть Веб-сайт Опции @@ -232,18 +236,30 @@ Установить из архива... + + Репозиторий: + Поиск: Показать предустановленные плагины + + Показывать нестабильные версии + - Вы не можете деинсталлировать Менеджер плагинов, поскольку он понадобится для инсталляции плагинов! + Вы не можете удалить Менеджер Плагинов, поскольку он понадобится для инсталляции плагинов! + + + Репозиторий плагинов SharpDevelop Создатель: + + Зависимости: + Загрузки: @@ -266,7 +282,7 @@ Рейтинг: - Пожаловаться: + Пожаловаться Версия: @@ -274,8 +290,18 @@ Прочитать Пользовательское соглашение + + Следующие плагины зависят от "{0}": +{1} +Они прекратят работу после отключения этого плагина! Вы действительно хотите продолжить? + + + Пакету "{0}" для работы требуется по крайней мере один дополнительный пакет: +{1} +Приложение постарается загрузить и установить их. Вы хотите продолжить? + - В выбранном объекте не содержится правильного SharpDevelop плагина. + В выбранном пакете не содержится правильного плагина SharpDevelop. Принять @@ -283,12 +309,29 @@ Отказаться + + Нажимая на кнопку "Принимаю", Вы соглашаетесь с условиями лицензии для указанного пакета. +Если Вы не согласны с условиями лицензии, нажмите кнопку "Отказываю". + + + Нажимая на кнопку "Принимаю", Вы соглашаетесь с условиями лицензии для перечисленных пакетов. +Если Вы не согласны с условиями лицензии, нажмите кнопку "Отказываю". + + + Следующий пакет требует принятия лицензии: + + + Следующие пакеты требуют принятия лицензии: + Лицензионное соглашение Добавить + + Автоматически проверять обновления + Сместить вниз @@ -307,6 +350,12 @@ Плагины + + Разное + + + Репозитории + Следующие установленные плагины зависят от "{0}": @@ -314,6 +363,15 @@ Они перестанут работать, если удалить данный плагин! Вы уверены, что хотите продолжить? + + Плагины SharpDevelop|*.sdaddin;*.addin|Все файлы|*.* + + + Щелкните сюда, чтобы посмотреть обновления + + + Доступны обновления для SharpDevelop + Доступно @@ -323,9 +381,54 @@ Обновления + + В этом файле используется несколько разных символов переноса + + + Используются разные символы переноса + + + Исправить + + + Ошибка: + + + Следующий + + + Предыдущий + + + Использовать регулярные выражения + Показать диаграмму классов + + Удалить историю + + + Файл 'git.exe' не найден в выбранном каталоге! + + + Установка Git не найдена. + + + Укажите путь к Git + + + Путь к Git + + + Сброс пути к Git + + + Настройки Git + + + (обнаружено автоматически) + Для выполнения этого действия должна быть установлена TortoiseGit. @@ -344,11 +447,23 @@ Режим справки + + Не удалось запустить Help Library Manager, так как каталог справки не выбран/не установлен. Пожалуйста, проверьте настройки (Инструменты -> Параметры -> Инструменты -> Microsoft Help Viewer). + + + Не удалось найти Help Library Manager. Для использования контекстной помощи в SharpDevelop, необходимо скачать и установить Microsoft Windows SDK 7.1. + + + Не удалось найти Help Library Manager. Пожалуйста, удостоверьтесь в том, что он был корректно установлен. + Установленные справочные каталоги + + Запустить Help Library Manager + - Микрософт "Help Viewer" + Microsoft Help Viewer Вы запросили автономную возможность в сетевом режиме справки. Требуется сменить режим, чтобы воспользоваться этой возможностью. @@ -389,6 +504,15 @@ Система счисления + + Десятичная + + + Шестнадцатеричная + + + Восьмеричная + Подогнать по ширине @@ -422,6 +546,21 @@ Заголовок + + Консоль управления пакетами + + + Управление пакетами... + + + Восстановить пакеты + + + Источники пакетов + + + Управление пакетами + Результат @@ -432,10 +571,10 @@ Все процедуры для {0} - Выбранная сессия профайлинга SharpDevelop создана в более новой версии SharpDevelop и не может быть открыта. + Выбранная сессия профилирования создана в более новой версии SharpDevelop и не может быть открыта. - SharpDevelop сессия профайлинга + Сессия профилирования SharpDevelop Проект не может стартовать, потому что выполняемый файл не найден. Пожалуйста проверьте, что проект и все его зависимости корректны! @@ -444,13 +583,13 @@ Проект не найден. Отмена ... - Проект не может стартовать. Вы хотите профилировать StartUp проект решения вместо этого? + Этот проект не может запускаться. Вы хотите профилировать запускаемый проект решения? Подготовка к анализу ... - Не удалось зарегистрировать профайлер в реестре COM. Нельзя запустить профайлинг! + Не удалось зарегистрировать профайлер в реестре COM. Не удалось запустить профилирование! Не удалось убрать регистрацию профайлера в реестре COM! @@ -462,7 +601,10 @@ Объединить рекурсивные вызовы. - Не профилировать внутренние вызовы dotNET. + Не профилировать внутренние вызовы .NET. + + + Собирать данные только в конце сессии. Начать сбор данных немедленно после начала сессии. @@ -477,13 +619,13 @@ События трассировки - Профайлинг + Профилирование Профилировать текущий проект - Выберите стартовый файл для профайлинга + Выберите исполняемый файл для профилирования Неправильные данные, пожалуйста повторите! @@ -492,17 +634,17 @@ Аргументы командной строки: - Выберите путь выполнимой программы для профилирования. + Выберите путь до программы для профилирования. Дополнительно можно указать рабочий каталог и аргументы командной строки. - Путь к выполнимому файлу: + Путь к исполняемому файлу: - Старт профайлинга + Старт профилирования - Выполнимый файл для профайлинга + Исполняемый файл для профилирования Рабочий каталог: @@ -598,7 +740,19 @@ Старт с профайлером - Искать.. + Поиск ... + + + Добавить setter + + + Выберите поля, для которых вы хотите создать свойства: + + + Реализовать INotifyPropertyChanged + + + Создать свойства Извлечь в отдельный метод @@ -625,7 +779,7 @@ Извлекаемый исходный текст в {0} не поддерживается! - Вставка конструктора + Вставить конструктор Добавить проверку на null @@ -639,6 +793,12 @@ Переменная + + Ввести метод {0} в {1} + + + Переопределить Equals() и GetHashCode() + Добавить интерфейс {0} @@ -648,8 +808,23 @@ Добавить перегрузку ${otherMethod} + + Окружить #region + + + Переопределить ToString() + - Выберите поля, которые хотите использовать при выполнении ToString(): + Выберите поля, которые хотите использовать для реализации ToString(): + + + Разрешить атрибут: {0} + + + Разрешить метод расширения {0} + + + Проверить текущий проект с помощью StyleCop Проверить с помощью StyleCop @@ -658,34 +833,37 @@ Анализ исходного кода - Добавить в список отклоненных + Добавить в ignore список Аннотировать - Ветвь/ярлык + Branch/tag - Файл/папка не может быть скопирован, так как он в состоянии подверсии '{0}'. + Файл/папка не может быть скопирован, так как он в SVN статусе '{0}'. - Файл/папка не может быть перемещён, так как он в состоянии подверсии '{0}'. + Файл/папка не может быть перемещён, так как он в SVN статусе '{0}'. + + + Файл/папка не может быть удален, так как он в SVN статусе '{0}'. Проверить на изменения - Получить + Checkout Почистить - Совершить + Commit - Создать отрывок + Создать патч Удалить каталог @@ -694,7 +872,7 @@ Разность - Править противоречия + Править конфликты Ошибка удаления ${File} @@ -709,7 +887,7 @@ История - '{0}' был удалён из чёрного списка. + '{0}' был удалён из ignore списка. Заблокировать @@ -718,7 +896,7 @@ Считать противоречие разрешенным - Объединить + Merge Автоматическое добавление новых файлов @@ -742,13 +920,19 @@ Переместить - Перестать игнорировать + Удалить из ignore списка + + + Файл был перемещен, вы действительно хотите удалить его? - Броузер хранилища + Repository browser - Вернуть + Revert + + + Файл бы изменен. Вы действительно хотите удалить его? Граф ревизий @@ -764,16 +948,16 @@ Вы должны сохранить эти файлы перед началом операции. - Переключить + Switch Для этого действия требуется TortoiseSVN - Обновить + Update - Обновить до версии + Update до ревизии Благодарим Вас за участие! Вы всё ещё можете отказаться с помощью настроек SharpDevelop. @@ -781,15 +965,42 @@ Я хотел бы принимать участие - собирать и передавать данные об использовании + + Вы всё ещё можете согласиться с помощью настроек SharpDevelop. + + + Я не хочу участвовать + + + Нам нужна Ваша помощь! Для того чтобы улучшить SharpDevelop нам нужно знать какими возможностями Вы чаще всего пользуетесь. SharpDevelop может собирать эту информацию и загружать автоматически. + + + Политика конфиденциальности + + + Показать собранные данные + + + Сбор данных об использовании + + + Позволить SharpDevelop выводить тип, основываясь на инициализаторе. + Редактировать колонки и строки таблицы Извлечь свойства как стиль + + Не выбран правильный элемент! + Имя свойства/события + + Для выбранного элемента управления уже назначен стиль. Вы хотите заменить этот стиль вновь созданным? + Имя стиля: @@ -803,22 +1014,22 @@ Удалить отступы - Удалить ненужные атрибуты + Удалить лишние атрибуты - <новый event handler> + <новый обработчик события> - Завершение кода + Автодополнение кода Цвет для события: - Шаблон имени для event handler: + Шаблон имени для обработчика события: - Выберите цвета, которые должны использоваться в XAML подсветке: + Выберите цвета, которые должны использоваться в подсветке XAML: Подсветка @@ -833,11 +1044,17 @@ Цвет свойства: - Переключиться на код после вставки нового event handler + Переключаться на код после добавления обработчика события XAML + + Использовать завершение для расширения разметки + + + Использовать расширенную подсветку + Файл не может быть записан в текущей кодировке ${encoding} без потери данных. @@ -866,6 +1083,9 @@ Версия: + + Привести + Копировать объект @@ -938,6 +1158,9 @@ Выполняющиеся COM объекты + + Избранные/недавние библиотеки типов + Библиотеки типов @@ -972,13 +1195,13 @@ Другое - Показать имена основных классов + Показать имена базовых классов Показать - Показать члены объекта в категории основного класса + Показать члены объекта в категории базового класса Только открытые члены @@ -1001,15 +1224,24 @@ Событие + + События, добавленные в журнал + Журнал событий Инкремент + + Вы не логируете никакие события. Для того чтобы начать логировать, выберите объект или событие на панели; далее, либо правый клик мышкой, либо используйте меню Действия для включения логирования. + Параметры + + Остановить всё журналирование + Остановить журналирование @@ -1058,6 +1290,9 @@ Пожалуйста, выберите Узел Дерева + + Вы должны выбрать узел в каком-либо дереве; поиск начнется с этого узла + Имя @@ -1103,6 +1338,12 @@ Версия + + Автоматически получать COM свойства + + + Получить активные COM-объекты при запуске + Панели @@ -1220,10 +1461,10 @@ Integers в hex - Члены основного класса + Члены базового класса - Имена основных классов + Имена базовых классов События @@ -1255,6 +1496,9 @@ выберите объект + + (разделять строки пробелами) + значение @@ -1300,6 +1544,30 @@ Ожидание запуска приложения + + Анализ качества кода + + + Автоматически форматировать код + + + (по умолчанию) + + + (глобально) + + + Вы уверены, что хотите сбросить все заданные ранее настройки форматирования? + + + (проект) + + + Сбросить к: + + + (решение) + Вставка ссылки на явный метод; чтобы вставить новую заглушку метода ещё раз нажмите клавишу TAB или Enter. @@ -1309,6 +1577,17 @@ Вставить анонимный метод с параметрами. + + <Создать ${HandlerName}> + + + Используйте стрелки "Вверх/Вниз" для перемещения к другой позиции. +Нажмите Enter для выбора позиции. +Нажмите Esc для отмены операции. + + + Столбцы: + О SharpDevelop @@ -1330,6 +1609,27 @@ Версия + + Операции: + + + Сервисы: + + + Внутренний + + + Публичный + + + Уровень доступа для генерируемых классов: + + + Генерировать асинхронные операции + + + Клиент + последние файлы @@ -1415,9 +1715,27 @@ Курсив + + Подчёркнутый + + + Экспорт цветов подсветки + + + Импорт цветов подсветки + + + Эта версия настроек не поддерживается! + + + Существующие настройки будут сброшены, а затем импортирован выбранный файл. Вы хотите продолжить? + Значение + + Сбросить на настройки по умолчанию + Пример @@ -1513,7 +1831,7 @@ Выберите директорию поиска - проект целеком + проект целиком решение целиком @@ -1704,6 +2022,12 @@ Очистить + + Автодополнять код после ввода следующий символов: + + + Автодополнять код только при нажатии <Tab> или <Enter>. + Показать список автодополнения при начале ввода @@ -1717,11 +2041,23 @@ Эта опция полностью отключит автодополнение кода: - компоненты + элементов Запоминать + + Настройки подсказок + + + Ссылки в подсказках указывают на + + + определение в коде + + + документацию (если доступна) + Показать ранее использованные @@ -1731,6 +2067,9 @@ Показать подсказку при наборе вызова метода + + Показывать автодополнение после ключевых слов + Показать подсказку, если указатель мыши над выражением @@ -1761,15 +2100,87 @@ Использовать полные имена типов + + Форматирование + + + Проверка кода + Кодирование Отладка + + Запрашивать аргументы и рабочий каталог при запуске исполняемого файла. + + + Останавливаться на первой выполняемой линии. + + + Выбрать исключения + + + Включить декомпилятор + + + Разрешить операцию "Изменить и продолжить" + + + Полное имя исключения + + + Остановиться на + + + Выберите исключения, на которые будет реагировать отладчик + + + Исключения + + + Пауза на обработанных исключениях. + + + Пошаговая обработка + + + Декомпилировать код без отладочной информации + + + Использовать 'Just My Code' для пошаговой обработки + + + Перешагивать через все свойства + + + Перешагивать через код, отмеченный атрибутами отладчика + + + Перешагивать через свойства для доступа к полям + + + Перешагивать через код без отладочной информации + + + Перешагивать через однострочные свойства + + + Отключить JIT-оптимизацию + + + Отключить NGEN-оптимизацию + Символы + + Места размещения файлов символов: + + + Отладка без исходников + Заголовок @@ -1777,7 +2188,7 @@ Язык - Редактировать стандартные заголовки + Стандартные заголовки Общие @@ -1824,8 +2235,11 @@ Переносить длинные строки + + Параметры построения и запуска + - Неверный путь к указанному проекту + Указан неверный путь к проекту. Загружать предыдущее решение при запуске @@ -1834,7 +2248,7 @@ Проекты и решения - Количество проектов при параллельном построении: + Количество проектов при параллельной сборке: Расположение проекта по умолчанию: @@ -1845,20 +2259,23 @@ Установки + + Показать список ошибок, если сборка проекта завершилась с ошибками + - В работе: + При запуске: - Построение изменённых проектов и зависимых от них проектов + Собрать изменённые проекты и проекты, зависимые от них Собрать только изменённые проекты - Не построен + Ничего не собирать - Построить все проекты + Собрать все проекты Текущий язык интерфейса: @@ -1923,6 +2340,9 @@ Вырезать/копировать всю строку, если ничего не выделено + + Включить виртуальные пробелы + Прятать курсор мыши во время набора текста @@ -1960,7 +2380,10 @@ Размер табуляции - Автоматическая вставка шаблонов + Автоматическая вставка шаблона + + + Использовать "умные" отступы Автодополнение кода @@ -1968,14 +2391,17 @@ Сглаживать шрифты + + Включить маркер изменений + - Включить автозавершение кода + Включить автодополнение кода Включить двойную буферизацию - Включить свертку + Включить сворачивание Выбор шрифта @@ -1996,7 +2422,7 @@ Изменять размер шрифта колесом мыши - Показывать панель "быстрого" браузера классов + Показывать панель быстрого браузера классов Шрифт: @@ -2013,14 +2439,20 @@ Показать линию каретки + + Включить анимации + - Показывать конец строки + Показывать символ завершения строки Подсвечивать соответствующие фигурные скобки + + Подсвечивать текущую строку + - Выделенные символы + Подсвечивать символы Показывать горизонтальную линейку @@ -2041,11 +2473,14 @@ Нет - Маркеры и линейки + Маркеры Маркеры и линейки + + Линейки + Показывать пробелы @@ -2053,7 +2488,7 @@ Показывать символы табуляции - Подчеркивать ошибки + Подчёркивать ошибки Показывать вертикальную линейку @@ -2091,6 +2526,9 @@ Выберите папку, в которой будет создана сборка + + Ссылки на сервисы + Подсветка @@ -2116,7 +2554,10 @@ Манифест приложения: - Нет внедрённых манифестов + Не встраивать + + + Встроить по умолчанию Файлы Manifest @@ -2145,6 +2586,69 @@ Файл ресурсов Win32: + + Данные сборки + + + Файл AssemblyInfo.cs не найден. Убедитесь в том, что проект содержит файл с данными сборки. + + + Версия сборки: + + + Соответствие спецификации CLS + + + Компания: + + + Копирайт: + + + Псевдоним: + + + Описание: + + + Версия файла: + + + GUID: + + + Одно из значений данных сборки указано неверно. + + + Информативная версия: + + + JIT-оптимизация + + + JIT-отслеживание + + + Сборка видима для COM + + + Нейтральный язык: + + + Новый GUID + + + не указано + + + Продукт: + + + Наименование: + + + Торговая марка: + Дополнительно @@ -2163,6 +2667,9 @@ Выравнивание файла: + + Создать сборку сериализации: + Выкл. @@ -2175,12 +2682,24 @@ Выходной путь: + + Зарегистрировать для COM-взаимодействия + + + Подавлять предупреждения: + Целевой процессор: Любой процессор + + Any CPU (предпочтительно 32-разрядн.) + + + Any CPU (предпочтительно 64-разрядн.) + 64-битный процессор Intel Itanium @@ -2193,6 +2712,9 @@ Целевая версия Framework: + + Трактовать предупреждения как ошибки + Все @@ -2209,22 +2731,22 @@ Документация &XML: - Построение событий + События сборки проекта - Событие командной строки после сборки: + Команды, выполняемые после сборки проекта: - Событие командной строки перед сборкой: + Команды, выполняемые перед сборкой проекта: - Выполнить события после построения: + Выполнить команды после сборки проекта: Компиляция - Разрешить незащищённый код + Разрешить небезопасный код Проверка на арифметическое переполнение/незаполнение @@ -2244,9 +2766,27 @@ Удалить проверку переполнения integer + + Значения по умолчанию для параметров VB: + + + Форматирование кода + Конфигурация + + Зависимая от конфигурации + + + Изменение конфигурации сохранит текущие значения. Продолжить? + + + Имена файлов: + + + Запускать при сборке + Отладка @@ -2262,6 +2802,9 @@ Настройки запуска + + Запуск внешней программы: + Запустить проект @@ -2277,11 +2820,14 @@ Только файлы .pdb + + Панели настроек для данного типа проекта не установлены. + Платформа - Платформозависимое + Зависимая от платформы Пожалуйста, введите правильный номер. @@ -2311,10 +2857,10 @@ Всегда - По обновлению выходных файлов проекта при сборке. + Когда обновились выходные файлы проекта - По удачной сборке + Когда сборка успешно выполнена Выбрать папку @@ -2329,7 +2875,10 @@ Выберите строгое имя для файла ключа: - Подписывание ВОдинЩелчок + Подпись ClickOnce + + + Подпись ClickOnce приложения пока не реализована. Подсказка к паролю: @@ -2374,9 +2923,9 @@ Точное имя для подписи - С помощью маленькой кнопки перед каждой устанавливаемой настройкой, вы можете выбрать место для хранения настроек. -Зависимые от конфигурации средства настройки могут иметь различные значения для каждой конфигурации (Debug/Release). -Зависимость от конфигурации означает то, что настройка может иметь различные значения для каждой платформы. + С помощью маленькой кнопки перед каждой устанавливаемой настройкой, Вы можете выбрать место для хранения настроек. +Настройки, зависимые от конфигурации, могут иметь различные значения для каждой конфигурации (Debug/Release). +Зависимость от платформы означает то, что настройка может иметь различные значения для каждой платформы. Вы также можете хранить настройки в файле .user-file вместо файла проекта, поэтому каждый разработчик может использовать своё значение, избегая конфликтов в системах управления версиями. @@ -2403,14 +2952,20 @@ Создать новый класс: + + Метод не может быть создан напрямую, так как исходный код для класса не доступен. Пожалуйста, укажите статический класс, в котором будет создан метод расширения. + Внедрение метода Использовать существующий класс: + + Автоматически исправлять проблемы, если возможно + - Броузер сборок .NET + Браузер сборок .NET Добавить ссылку @@ -2514,6 +3069,9 @@ Добавить + + Дополнительно + < Назад @@ -2638,7 +3196,7 @@ Пожалуйста, подождите... - Предпросмотр + Предварительный просмотр Вопрос @@ -2658,12 +3216,27 @@ Заменить + + Сбросить + Повтор Выбрать все + + Alt + + + Ctrl + + + Shift + + + Win + Маленькие значки @@ -2674,7 +3247,7 @@ Строка - Перерисовать + Обновить Предупреждение @@ -2722,7 +3295,7 @@ Текстовый редактор - Текстовый редактор (выберите кодировку) + Текстовый редактор (с выбором кодировки) Встроенный веб-браузер @@ -2776,7 +3349,7 @@ Найти неиспользуемые ключи ресурсов - Ключ + Клавиатура Ключ реестра: @@ -2838,6 +3411,9 @@ SharpDevelop не может найти FxCop. Пожалуйста, выберите в настройках SharpDevelop установочную папку FxCop + + Не удалось прочитать файл лога FxCop: + Mono не установлена. @@ -2850,20 +3426,23 @@ Анализ кода + + Проверить текущий проект с помощью FxCop + - Проверить FxCop-ом + Проверить с помощью FxCop - Выбранные папки не содержат полностью установленной FxCop. + Выбранные папки не содержат полностью установленный FxCop. - Выберите путь FxCop + Укажите путь к FxCop FxCop был найден в указанной папке: - FxCop не может быть найден. Установите FxCop и щёлкните на 'Выберите путь к FxCop' чтобы сообщить SharpDevelop расположение установленного FxCop. + FxCop не найден. Установите FxCop и щёлкните на 'Укажите путь к FxCop' чтобы сообщить SharpDevelop расположение установленного FxCop. Путь FxCop @@ -2871,12 +3450,18 @@ Добавить/Удалить правило сборки + + Не удалось найти FxCop - Убедитесь, что FxCop установлен. + Выбрать папку, содержащую правило сборки: Включить анализатор кода (определение константы CODE_ANALYSIS) + + Загрузка доступных правил... + При компиляции запустить анализ кода (определить константу CODE_ANALYSIS) @@ -2896,7 +3481,7 @@ Запуск FxCop - Подавить сообщение + Сообщение при подавлении Покрытый код @@ -2904,9 +3489,15 @@ Непокрытый код + + Частично покрытый код + Столбец + + Содержимое + Параметры экрана @@ -2916,17 +3507,20 @@ Конец строки + + Файл с результатами покрытия кода не создан: + - Цвета сокрытия кода + Цвета - Отображаемые компоненты: + Отображаемые элементы: - Фон компоненты: + Фон элемента: - Цвет компонента: + Цвет элемента: ААБбВвЭэЮюЯя @@ -2938,7 +3532,7 @@ Включить - Выполнение прикрытия кода... + Выполнение покрытия кода... Показать область видимости кода @@ -2950,10 +3544,10 @@ Показать количество посещений - Включение сокрытия кода + Включить подсветку для покрытия кода - Счётчик посещений + Число посещений Описание @@ -2976,6 +3570,9 @@ Связать конкретные модули .NET + + Генерировать отладочную информацию + Расположение файлов библиотек. @@ -2985,9 +3582,18 @@ Препроцессор + + Определить переменную препроцессора + Расположение заголовочных файлов + + Сбросить все переменные препроцессора + + + Сбросить следущие переменные препроцессора + Символ @@ -3015,8 +3621,11 @@ XML-документ + + Не удалось найти NAnt '{0}'. Пожалуйсте укажите путь к NAnt в настройках SharpDevelop. + - Построение NAnt остановлено. + Сборка проекта NAnt остановлена. Проект не содержит файла '.build'. @@ -3090,6 +3699,9 @@ Остановить NAnt + + Нет запускаемого проекта для отладки. + Тесты @@ -3147,6 +3759,12 @@ Отправить в консоль Python + + Не удалось найти тип '{0}'. Возможно не добавлена ссылка на сборку. + + + Не удалось найти определение типа или члена типа на месте курсора. + В месте нахождения курсора не обнаружено определение типа. @@ -3169,26 +3787,32 @@ Из C# в VB.NET - Макет отладки + Расположение окон для отладки + + + Расположение окон по умолчанию <Правка> - Добавить макет + Добавить расположение окон Править список определяемых пользователем макетов: - Правка макетов + Правка расположений окон - Обычный макет + Обычное расположение окон <Сбросить значения (По умолчанию)> + + Вы уверены, что хотите сбросить расположение окон на настройки по умолчанию? Это не затронет другие расположения окон. + Преобразовать @@ -3199,7 +3823,7 @@ Результаты преобразования - ${ErrorCount} ошибка(ок) преобразования ${FileName}: + Количество ошибок преобразования ${FileName}: ${ErrorCount} Сначала исправьте ошибки в исходном коде (только правильный исходный код может быть преобразован). @@ -3208,7 +3832,7 @@ ${FileName} не преобразован: - При разборе найдено ${ErrorCount} ошибок(ки) + Количество ошибок при разборе: ${ErrorCount} Преобразователь проекта SharpDevelop @@ -3243,6 +3867,12 @@ Невозможно создать PrintDocument + + Файл, защищённый от записи, уже существует в данном каталоге. + + + Для проекта данного типа не установлен обработчик. + Файл проекта не найден. @@ -3253,7 +3883,7 @@ Невозможно прочитать описание веб-службы. Url='{0}' - Компоненты решения + Элементы решения Решение @@ -3274,6 +3904,9 @@ Файл сохранен + + Выделить файл окне проектов + Из VB.NET в C# @@ -3298,6 +3931,12 @@ Искать в обратном порядке: + + {0} не является корректной .NET-сборкой. + + + Сборка {0} недоступна или удалена. + Ошибка загрузки информации завершения кода для ${Assembly} из ${Filename}: @@ -3310,6 +3949,12 @@ Выйти из SharpDevelop + + В SharpDevelop возникло необработанное исключение. Это непредусмотренное поведение, поэтому мы просим Вас помочь нам в улучшении работы SharpDevelop, сообщив об этой ошибке команде SharpDevelop. + + + Как эффективно сообщить об ошибке. У нас есть интернет-форум для присылаемых пользователями SharpDevelop отчётов об ошибках и их отслеживания. Сообщение об ошибке уже скопировано в буфер обмена и готово для вставки в отчёт. Кроме того, чтобы уменьшить количество вопросов со стороны разработчиков, просим Вас дополнительно предоставить нам как можно более подробную пошаговую процедуру для воспроизведения этой ошибки. + Вы действительно хотите выйти из SharpDevelop? Несохранённые изменения будут потеряны! @@ -3424,12 +4069,18 @@ Главная + + Создавать обработчики событий в стиле Visual Studio + Параметры сетки Высота + + Разрешить редактирование подсказок на месте + Использовать оптимизацию кода @@ -3467,22 +4118,22 @@ Ширина - Вставьте комментарий "TODO" в обработчики новых событий + Добавлять комментарий "TODO" в обработчики новых событий - Связывание свойства (быстрее для небольшого числа свойств, но значительно хуже для большого числа свойств) + Присваивание значений (подходит для небольшого количества свойств) - Локализационная модель по умолчанию + Модель локализации по умолчанию - Разрешить локализационной модели существование неизменяемых форм + Не менять модель локализации для существующих форм Модель локализации - Свойство отражения (медленнее во время выполнения для нескольких свойств, но значительно лучше при большом числе свойств, особенно со многими значениями по умолчанию) + Рефлексия (подходит для большого числа свойств, особенно со значениями по умолчанию) Дизайнер форм @@ -3508,8 +4159,11 @@ Не удалось загрузить дизайнер. Проверьте исходный код на наличие ошибок, а также доступность всех ссылок. + + При попытке записи содержимого дизайнера произошла одна или несколько ошибок. Это может быть следствием необработанной исключительной ситуации в пользовательском/стороннем компоненте на форме/элементе управления. + - Не могу загрузить библиотеку компонента боковой панели. + Не удалось загрузить библиотеку компонентов боковой панели. Компоненты Windows Forms будут недоступны, настройте боковую панель вручную. (щелчок правой кнопкой мыши на категории боковой панели->Настроить боковую панель) @@ -3525,6 +4179,9 @@ Назад + + Привязка + Добавить веб-ссылку @@ -3537,6 +4194,12 @@ Перейти + + Пространство имен содержит недопустимые символы. Пространство имен может содержать только буквы, цифры и символы подчеркивания. + + + Имя ссылки содержит неверные символы. + Пространство имён: @@ -3568,7 +4231,7 @@ Значение - Доступность веб-служб + Доступные веб-службы Присоединить @@ -3648,7 +4311,10 @@ Имя пользователя: - Контур + Структура документа + + + У данного документа нет структуры. Загрузка... @@ -3669,16 +4335,25 @@ Действие сборки - Действие сборки этого файла + Действие сборки для этого файла Копировать в выходную папку + + Указывает, должен ли файл копироваться в выходную папку + Настраиваемый инструмент + + Указывает инструмент, используемый для преобразования файла в поток вывода. + - Настроить инструмент Пространства имён + Пространство имён настраиваемого инструмента + + + Указывает пространство имён, добавляемое в поток вывода настраиваемым инструментом. Полный путь к файлу. @@ -3692,12 +4367,21 @@ Синонимы + + Список псевдонимов, разделённых запятой. Используйте псевдонимы, если Вы ссылаетесь на сборки с конфликтами имён классов и пространств имён, например, в разных версиях одной сборки. + Культура Культура поддерживается ссылкой + + Встроить типы COM-взаимодействия + + + Указывает, должны ли определённые в ссылочной сборке типы COM-взаимодействия встраиваться в целевую сборку. + Локальная копия @@ -3761,12 +4445,21 @@ Загрузка ${Filename}... + + Закрыть решение + - Держать старое решение открытым + Оставить старое решение открытым Перезагрузить решение + + Файлы решения были изменены другой прогаммой. + + + Настройки форматирования для решения + Преобразовать выбранные проекты в: @@ -3796,6 +4489,9 @@ Хотите ли вы обновить проект до версии ${NewToolsVersion} MSBuild? Данный проект не может бть открыт без процедуры ибновления. + + Обновить до MSBuild ${NewToolsVersion} + Это решение было создано с помощью предыдущей версии SharpDevelop. Возможно, вы захотите, преобразовать его так, чтобы использовать новый язык или новые возможности framework'a. @@ -3813,31 +4509,34 @@ Покрытие кода - Создать выходной XML файл + Создавать XML-файл с результатами - Пометить каждый тест + Отмечать каждый тест - Теневая копия + Теневое копирование сборок - Показать логотип + Показывать логотип - Показать прогресс + Показывать прогресс - Запустить тесты в отдельном потоке + Запускать тесты в отдельном потоке - Запустить все тесты с прикрытием кода + Запустить все тесты с покрытием кода + + + Запустить в панели модульных тестов Запустить тесты в текущем проекте - Запустить с сокрытием кода + Запустить с покрытием кода Запуск с отладкой @@ -3848,6 +4547,48 @@ Тест + + Не удалось запустить юнит-тесты. Не удалось найти файл '{0}'. + + + Веб + + + Приложение уже существует. + + + Создать виртуальную папку + + + Отключить настройки веб-сервера + + + Не удалось обнаружить локальный сервер IIS или IIS Express. + + + Рабочий процесс ASP.NET/IIS (Express) ({0}) не найден. + + + Порт сервера: + + + Url проекта: + + + Веб-сервер + + + Не удалось подключиться отладчиком к процессу. + + + Использовать веб-сервер IIS Express + + + Использовать локальный веб-сервер IIS + + + Виртуальная папка создана. + Добавить расширения @@ -3870,11 +4611,14 @@ Культуры: - Подавлять ICE: + Подавлять коды ICE: Считать предупреждения ошибками: + + Путь к дополнениям WiX MSBuild: + Целевой путь WiX: @@ -3916,7 +4660,10 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Добавить файлы... - Не удаётся найти файлы установщика. Файлы WiX содержат ошибки. + Не удалось найти файлы установщика. Файлы WiX содержат ошибки. + + + Не удалось найти ни одного элемента TARGETDIR Directory или DirectoryRef. Либо эти элементы отсутствуют, либо документ WiX не предназначен для WiX 3.0 и пространство имён не равно "http://schemas.microsoft.com/wix/2006/wi". Файл WiX (.wxs) не найден в проекте '{0}'. @@ -3990,6 +4737,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Шрифты + + Локальные данные приложения + Мои рисунки @@ -4047,6 +4797,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Расширение .NET Framework + + WiX не установлен. Пожалуйста, скачайте WiX с сайта http://wixtoolset.org/ + Различия не обнаружены. @@ -4065,6 +4818,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Расширение Visual Studio + + Просмотр эскизов дизайнера WPF + Копировать @@ -4072,7 +4828,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Вырезать - Контур + Структура документа Вставить @@ -4134,6 +4890,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Использовать вкладки + + Показывать атрибуты в свёрнутом элементе + Показать комментарий к схеме @@ -4215,6 +4974,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Пространства имён + + Найдено 0 совпадений по XPath запросу. + Префикс @@ -4230,9 +4992,30 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< XPath: + + Совпадение + Вывод XSLT + + Не удалось найти ILSpy в указанном месте, или у SharpDevelop недостаточно прав для доступа к нему. + + + Путь к ILSpy не указан. + + + Открыть ILSpy + + + Требуется наличие ILSpy. Если у Вас его ещё нет, Вы можете бесплатно скачать его здесь: + + + Полный путь к ILSpy.exe + + + Изменить путь к ILSpy + Невозможно загрузить конфигурацию внешнего инструмента @@ -4243,16 +5026,19 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Ошибка загрузки шаблона проекта: - Построение должно быть завершено перед закрытием SharpDevelop. + Процесс сборки проекта должен быть завершён до закрытия SharpDevelop. - Построение было отменено. + Сборка проекта была отменена. Сборка не выполнена. - Построение успешно завершено. + Сборка проекта успешно завершена. + + + Сборка проекта ${Name} не поддерживается. Сборка начата. @@ -4267,7 +5053,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Компиляция - Построение сборки COM interop... + Создание сборки COM-взаимодействия... Выполнить: ${Script} @@ -4279,7 +5065,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Выполнение главной компиляции... - Сборка завершена: ошибок: ${Errors}, предупреждений ${Warnings} + Сборка завершена -- ошибок: ${Errors}, предупреждений: ${Warnings} Пропущено ${Name} (со стороны SharpDevelop не было изменений) @@ -4290,6 +5076,18 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Вы действительно хотите отменить изменения? + + локальная переменная + + + пространство имен + + + параметр + + + перегружает + Сохранить текущие изменения? @@ -4326,12 +5124,21 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Закладки + + Добавить в рабочее пространство + Назад Базовые типы + + Показать других членов + + + Показать P&rivate членов + Показать ссылки проекта @@ -4341,6 +5148,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Показывать открытые члены + + Настройки окна классов + Очистить историю поиска @@ -4356,6 +5166,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Ничего не найдено. + + Открыть сборку + + + Открыть сборку из файла... + + + Открыть сборку из GAC... + + + Открыть в обозревателе классов + + + Поиск в окне классов + + + Рабочая область {0} + Классы @@ -4365,18 +5193,39 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Показывать вывод из: + + Перенос текста + + + Добавить выражение для наблюдения + Точки останова Стек вызовов + + Вы не можете переключать функции во время отладки. + + + Вы не можете переключиться на функцию, символы которой не доступны. + + + Вы не можете переключиться на функцию, отладочная информация которой не доступна. Либо перекомпилируйте её с отладочной информацией, либо включите опцию "Декомпилировать код, если символы не доступны" в настройках. + [Внешние методы] + + Переключатель функции + Язык + + Модуль + Показать имена аргументов @@ -4386,20 +5235,35 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Показывать внешние методы + + Показать номера строк + + + Показать имена модулей + - Вопрос + Спросить Прервать - Стоп-точка + Точка останова + + + Сработала точка останова! + + + Сработала точка останова на строке {0} в {1}. + + + Сработала точка останова на строке {0} в {1} так как {2} Условие - Состояние + Условие Продолжить @@ -4407,6 +5271,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Убрать точку останова + + Редактировать условие... + Включить точку останова @@ -4428,12 +5295,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Консоль + + Отладить исполняемый файл + Прервать + + Остановиться на ${ExceptionName} + Продолжить + + Не удалось перехватить исключение. Выполнение отлаживаемой программы не может быть продолжено и свойства не могут быть вычислены. + + + Не удалось перехватить обработанное исключение. Отладочные символы недоступны для источника исключения. + Скрыть подробности об Исключении @@ -4446,11 +5325,14 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< как {0} в {1}:строка {2} + + Исключения {0} было выброшено: + Показать подробности об Исключении - Прервать + Остановить Исключение @@ -4470,6 +5352,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Время + + Показать/Скрыть кнопки для изменения масштаба + Локальные переменные @@ -4477,7 +5362,10 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Локальные переменные - Основной класс + Базовый класс + + + Вы не можете видеть значение локальных переменных, если отладчик запущен. Невозможно преобразовать {0} в {1} @@ -4491,6 +5379,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Копировать значение в буфер обмена + + Имя + Закрытые члены @@ -4500,6 +5391,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Частные члены + + Private Static члены + Показать полный текст ошибки... @@ -4509,6 +5403,42 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Статичные члены + + Тип + + + Значение + + + Память + + + Адрес {0} не найден! + + + Размер в байтах: + + + Перейти к адресу: + + + Следующий виртуальный адрес + + + Отладка или программа не запущены! + + + Предыдущий виртуальный адрес + + + Чтение памяти от {0} до {1} - размер {2}. + + + Обновить текущий адрес + + + Не удалось прочитать память по адресу {0} размером {1}. + Загруженные модули @@ -4551,11 +5481,14 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Установить текущий оператор + + Вы действительно хотите остановить отладку? + Отсоединить от процесса или завершить его? - Нити + Нити (потоки) Вы не можете замораживать или размораживать потоки пока работает отладчик. @@ -4563,9 +5496,15 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Невозможно сделать шаг, так как отсутствует активная выбранная функция + + Вы не можете переключиться на поток с недоступным фреймом исполнения. + Вы не можете переключать потоки пока включён отладчик. + + Вы не можете переключиться на поток в декомпилированном коде без включения декомпилятора. + Заморозить @@ -4594,10 +5533,13 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Переключатель потоков - Наблюдатель + Наблюдение - Добавить Наблюдателя + Добавить наблюдение + + + Введите выражения для наблюдения: Неправильное расширение: {0} @@ -4609,7 +5551,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Удалить все - Удалить наблюдателя + Удалить наблюдение Просмотр определения @@ -4618,19 +5560,22 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Ошибки - ${TaskService.Errors} ошибок + Количество ошибок: ${TaskService.Errors} + + + Включить отображение ошибок в списке. - ${TaskService.Messages} предупреждений + ${TaskService.Messages} сообщений - Выберите сообщения, отображаемые в списке. + Включить отображение сообщений в списке. ${TaskService.Warnings} предупреждений - Выберите предупреждения, отображаемые в списке. + Включить отображение предупреждений в списке. CD @@ -4663,7 +5608,10 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Справка - Контур + Структура документа + + + У данного документа нет структуры. Вывод @@ -4674,6 +5622,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Отладка + + <Текст был усечён, так как был очень длинным> + Проекты @@ -4701,6 +5652,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< в + + <нет проекта> + ${Count} совпадения(ий) @@ -4716,6 +5670,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< По файлам + + Разделить по проектам + + + Разделить по проектам и файлам + Показать последние результаты поиска @@ -4725,6 +5685,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Список задач + + Все открытые файлы + + + Класс/Модуль + + + Файл + + + Пространство имён + + + Проект + + + Решение + Инструменты @@ -4746,6 +5724,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Развернуть список текущих проблем + + Развернуть список текущих игнорируемых + Дерево @@ -4762,7 +5743,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Выгружает тестируемые сбоки, отменяет автозагрузку. - Прейти к определению + Перейти к определению Добавить ссылку на nunit к выбранному проекту @@ -4791,6 +5772,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Проверка варианта '${TestCase}' не удалась. + + Тест '${TestCase}' не был запущен. + Загрузить сборку... @@ -4818,6 +5802,33 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Открыть папку в Проводнике + + Открыть командную строку в этой папке + + + выберите целевой фреймворк + + + Не удалось найти инструменты Portable Class Library. + + + Подмножество .NET Portable + + + Необходимо выбрать два или более фреймворка. + + + Выбранный профиль: + + + Выбрать профиль Portable Library + + + Для установки инструментов Portable Class Library без установки Visual Studio, необходимо скачать файл (PortableLibraryTools.exe) и запустить его из командной строки с ключом /buildmachine. + + + Свернуть всё + Добавить существующие файлы @@ -4845,6 +5856,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Добавить ссылку + + Добавить ссылку на сервис + Добавить веб-ссылку @@ -4881,20 +5895,26 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Существующее... + + Существующий элемент как зависимый... + - Существующий проект + Существующий проект... - Построить документацию с NDoc + Построить документацию из XML-комментариев - Вам нужно отредактировать настройки сборки проекта для создания файла документaции xml. + Вам нужно отредактировать настройки сборки проекта для создания файла XML-документaции. Нужны для сборки проекта. + + Файл XML-документации не существует, сначала необходимо скомпилировать проект + - Генерация документации в формате XML требует установленного 'Sandcastle Help File Builder'. + Создание документации из XML-комментариев требует установленного 'Sandcastle Help File Builder'. Экспорт в HTML @@ -4918,11 +5938,14 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Новое... - Новый проект + Новый проект... Новая папка решения + + Этот проект не является веб-проектом. + Открыть @@ -4941,8 +5964,14 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Запустить проект + + Запустить проект без отладки + - Использовать как StartUp проект + Назначить проект запускаемым + + + Просмотр в браузере Новая папка @@ -5064,30 +6093,63 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Нецифровой символ + + Непробельный символ + + + Небуквенный символ + + + Нежадная звезда + Символ пробела Граница слова + + Буквенный символ + Обновить изображение... + + Обновить курсор ... + + + Обновить иконку ... + Действительно хотите удалить выбраные ресурсы? Удалить ресурс + + Фильтр: + Невозможно загрузить ресурс + + Не удалось загрузить ресурс из файла: {0} + + + Ошибка: Генератор кода ресурсов пропустил файл "{0}", так как сгенерированный класс конфликтует с существующим классом "{1}". + Генератор кода ресурсов: невозможно создать свойство для ресурса '{0}'. + + Комментарий + Содержание + + Добавить логическое значение + Добавить файлы... @@ -5097,9 +6159,18 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Копировать имя ресурса + + Редактировать комментарий + + + Введите новый текст комменария: + Переименовать + + Показать как Hex дамп + Тип @@ -5109,6 +6180,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Все файлы (*.*) + + Все известные расширения + Файлы сборок (*.exe;*.dll) @@ -5173,7 +6247,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Файлы проектов Visual Basic - XML файлы (*.xml) + XML-файлы (*.xml) Файлы схем XML (*.xsd) @@ -5194,7 +6268,13 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Поток добавлен! - Основные классы ${Name} + Базовые классы для ${Name} + + + Базовый член ${Name} + + + Действие не может быть выполнено, так как ваш код содержит ошибки: Элемент не может быть переименован, поскольку он не определён в пользовательском коде. @@ -5203,7 +6283,13 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Элемент в позиции каретки не может быть переименован. - Классы получаются из ${Name} + Классы, наследуемые от ${Name} + + + Вставить из буфера обмена... + + + Буфер обмена пуст Преобразовать в автосвойство @@ -5233,13 +6319,16 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Извлечь интерфейс - Найти основные классы + Найти базовые классы + + + Найти базовые символы - Найти полученные классы + Найти наследуемые классы - Найти полученные символы + Найти наследуемые символы Поиск ссылок... @@ -5251,10 +6340,10 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Найти ссылки - Поиск ссылок + Найти ссылки - Перейти в основной класс + Перейти в базовый класс Перейти к основе @@ -5262,6 +6351,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Перейти к свойству + + Реализовать методы абстрактного класса + + + Реализовать интерфейс + Реализовать интерфейс (явно) @@ -5274,12 +6369,18 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Имена должны начинаться с буквы или символа подчёркивания. + + Невозможно выполнить поиск ссылок пока все файлы не будут загружены. + Переместить класс в файл '${FileName}' Перегрузки ${Name} + + Часть класса ${Name} + Ссылки на ${Name} @@ -5311,7 +6412,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Буфер обмена - Тэги документации C# + Теги документации C# Общие @@ -5320,7 +6421,7 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Лицензии - Нет доступных для текущего документа инструментов. + Нет доступных инструментов для текущего документа. XSLT @@ -5328,12 +6429,21 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Все известные форматы проектов + + Текущая версия SharpDevelop не может загружать проекты, созданные в Visual Studio .NET 2003 (или ранее). Попробуйте использовать SharpDevelop 3.2 для преобразования в современный формат или создайте новый проект, использую существующие исходные файлы. + Не удалось сохранить {0}:\n{1} Невозможно сохранить файл решения {0}. Он помечен как "Только для чтения". + + Не удалось сохранить {0}: +{1} + +Убедитесь, что запись в этот файл возможна. + В проекте существуют файлов ресурсов. SharpDevelop 2 иначе компилировал ресурсы: имя ресурса содержит не только имя файла, но и префикс корневого пространства имён, и имя папки. @@ -5351,7 +6461,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Не получилось считать файл решения Microsoft формата {0}. - Базы данных + База данных Отчёты SharpDevelop @@ -5371,6 +6481,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Вставить поле + + Показать превью + Видимость раздела @@ -5380,6 +6493,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Разработка + + Подробно + Нижний колонтитул страницы @@ -5401,6 +6517,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Это неправильный отчёт, созданный с помощью 'SharpReport'. + + Не удалось прочитать файл, файл повреждён (некорректный формат) + Доступные поля @@ -5470,12 +6589,21 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес DataRow + + Отчётность - Функции + Номер страницы Сегодня + + Нижний колонтитул группы + + + Заголовок группы + Изображение @@ -5488,6 +6616,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Прямоугольник + + Таблица + Надпись @@ -5497,21 +6628,24 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Тип отчёта + + Основные настройки отчёта + Имя файла Графические единицы - - Основные установки отчёта - Модель отчёта Форма листа + + Вытягивать данные + Продвинуть данные @@ -5521,6 +6655,24 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Тип отчёта + + Выберите столбец для группировки + + + Группировка + + + Верстка списком + + + Верстка для отчета + + + Табличная верстка + + + Расположение на странице + Перемещаемая модель данных @@ -5536,18 +6688,18 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Доступные поля - - Путь к файлу схемы (.xsd) - - - Сохранение результата (схема и данные) + + Проект не выбран, пожалуйста введите имена полей - - Сохранить результат (только схему) + + Классы в выбранном проекте Показать результат запроса + + Добро пожаловать в мастер SharpReport + &Добавить закладку @@ -5608,6 +6760,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Открыть решение + + Удалить проект из списка недавних + Стартовая страница @@ -5620,6 +6775,12 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Ст ${Line} Кол ${Column} Сим ${Character} + + длина ${Rows} * ${Cols} (${Total}) + + + длина ${Length} + Разное @@ -5635,8 +6796,14 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Конфигурация элемента + + Класс, который наследуется от ConfigurationElementCollection + - Конфигурация коллекции элементов + Коллекция элементов конфигурации + + + Класс, реализующий раздел конфигурации (ConfigurationSection) Конфигурация раздела @@ -5653,6 +6820,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Пустой файл + + Объявление нового класса исключения. + Исключение @@ -5704,6 +6874,24 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Файл сборки NAnt + + Создает представление и соответствующую модель представления для модуля PRISM. + + + Представление и модель представления PRISM (Unity) + + + Создаёт модель представления для модуля PRISM. + + + Модель представления PRISM (Unity) + + + Создаёт представление для модуля PRISM. + + + Представление PRISM (Unity). + Добавить '#if TEST ... #endif' @@ -5740,17 +6928,53 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Пустой файл ресурсов + + Этот класс обеспечивает лёгкий доступ к хранимым свойствам. + + + Параметры плагина + + + Пустая команда меню для #D. + + + Команда меню + + + Панель настроек #D. + + + Панель настроек + + + Команда, которая может быть использована в различных целях. + + + Простая Команда + + + Содержимое панели #D. + + + Пустая Панель + + + Содержимое представления #D (например, текстовый редактор или редактор ресурсов). + + + Пустое Представление + - Класс следующий патерну Singleton. + Класс, следующий шаблону проектирования "Одиночка" (Singleton). - Singleton-класс + Одиночка Объявление структуры включает реализацию Equals() и GetHashCode(). - Struct + Структура Объявление структуры, включая Equals() и GetHashCode(). @@ -5765,16 +6989,16 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Создаёт пустой текстовый файл. - Создаёт базовый unit test. + Создаёт базовый модульный тест. - Unit Test + Модульный тест Настраиваемый веб-элемент управления - Веб-элемент управления ASP.net + Веб-элемент управления ASP.NET Веб-форма: страница .aspx с отделённым кодом @@ -5782,6 +7006,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Веб-форма ASP.NET + + Создает веб-обработчик ASP.NET с отделённым кодом. + Веб-обработчик ASP.NET @@ -5830,6 +7057,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Пустой фрагмент файла для WiX + + Пустой файл фрагмента WiX + Создаёт пустой диалог установки. @@ -5854,14 +7084,17 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Пустой проект Мастера установки + + Создаёт файл app.config для Вашего приложения. Если проект является исполняемым файлом, MSBuild переименует файл в appname.exe.config. + Файл App.Config - Пустой XML файл + Пустой XML-файл - Создаёт пустой XML файл. + Создаёт пустой XML-файл. Создать пустую форму XML @@ -5911,6 +7144,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Пустой проект + + Проект для создания приложения Glade#. + Glade#-приложение @@ -5920,6 +7156,30 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Gtk#-приложение + + Библиотека, которая может быть использована в приложениях Windows, Silverlight, Windows Phone и Xbox. + + + Portable Class Library + + + Создает небольшое PRISM-приложение с загрузчиком и инфраструктурой. + + + Приложение PRISM - маленькое (Unity) + + + Создаёт PRISM-приложение вместе с загрузчиком и инфраструктурой. + + + Приложение PRISM (Unity) + + + Создать модуль PRISM, вместе с соотвествующими View и ViewModel + + + Модуль PRISM (Unity) + Проект для создания MSI-инсталлятора. @@ -5968,6 +7228,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Проект веб-страницы ASP.net + + Проект для создания веб-службы ASP.NET + Веб-служба ASP.NET @@ -5978,10 +7241,10 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Windows-приложение - Проект для создания сервиса windows. + Проект для создания службы Windows. - Сервис Windows + Служба Windows Создаёт простое приложение WPF. @@ -6080,7 +7343,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Не удалось выполнить действие, поскольку отлаживаются некоторые процессы. - Невозможно запустить отладчик SharpDevelop, так как ядро отладчика включено. Для выключения ядра отладчика, удалите ключ "/debug" из файла Boot.ini и перезапустите свой компьютер. + Невозможно запустить отладчик SharpDevelop, так как включен отладчик ядра. Для выключения отладчика ядра, удалите ключ "/debug" из файла Boot.ini и перезапустите свой компьютер. Отладка программ .NET Framework 1.0 не поддерживается. @@ -6097,6 +7360,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Удалить все точки останова + + Запустить последнюю сборку + Запустить без отладчика @@ -6104,13 +7370,22 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Запускает программу без присоединённого отладчика - Шаг в + Войти + + + Войти - Шаг вперёд + Выйти - Шаг вперёд + Выйти + + + Перешагнуть + + + Перешагнуть Остановить процесс @@ -6119,7 +7394,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Останавливает текущий процесс и завершает отладку - Вкл/выкл. контрольную точку + Вкл/выкл. точку останова Правка @@ -6143,7 +7418,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Удалить выделенный текст - Свертка + Сворачивание Показывать только определения @@ -6256,6 +7531,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Создать новый файл + + Проект... + Решение... @@ -6272,7 +7550,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Проект/Решение... - Открыть проект/объединение + Открыть проект/решение Печать @@ -6305,7 +7583,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Сохранить как... - Сохранить с декодированием... + Сохранить с кодировкой... Формат @@ -6463,6 +7741,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Параметры проекта... + + Рефакторинг + Собрать текущий проект @@ -6507,7 +7788,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Перейти к... - Прейти на парную скобку + Перейти на парную скобку Инкрементный поиск @@ -6530,6 +7811,9 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Обратный последовательный поиск + + Поиск проблемных мест... + Переключить закладку @@ -6559,7 +7843,7 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Вставить цвет... - Вставьте новый GUID + Вставить новый GUID Параметры... @@ -6607,13 +7891,13 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Разделить - Сделано в SharpDevelop. + Создано в SharpDevelop. Дата: - Для изменения этого шаблона используйте Сервис | Настройка | Кодирование | Правка стандартных заголовков. + Для изменения этого шаблона используйте меню "Инструменты | Параметры | Кодирование | Стандартные заголовки". Время: @@ -6645,11 +7929,10 @@ SharpDevelop 2 иначе компилировал ресурсы: имя рес Рефакторинг + + Переформатировать + Раскомментировать - - Эта строка нигде не используется. Она нужна для тестирования базы данных переводов, а также в ней есть -перенос строки - \ No newline at end of file diff --git a/data/resources/StringResources.se.resx b/data/resources/StringResources.se.resx index df91d64d81..c76935ead9 100644 --- a/data/resources/StringResources.se.resx +++ b/data/resources/StringResources.se.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Den här resursen används inte. Dess syfte är att testa översättningsdatabasen och har en linjebrytning. + Om SharpDevelop @@ -229,6 +232,122 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Okänt filformat: + + Installera från arkivfil... + + + Sök: + + + Visa förinstallerade AddIns + + + Du kan inte avinstallera AddInManager eftersom denna behövs för att på nytt installera AddIns! + + + Skapad av: + + + Beroenden: + + + Nerladdningar: + + + Filens namn: + + + Installerad version: + + + Senast uppdaterad: + + + Mer information: + + + Senaste version: + + + Omdöme: + + + Rapportera missbruk + + + Version: + + + Visa licensavtal + + + Följande AddIns är beroende av "{0}": + +{1} + +Dessa kommer att sluta fungera om detta AddIn avaktiveras! Är du säker på att du vill fortsätta? + + + Jag &Accepterar + + + Jag av&böjer + + + Licensavtal + + + Lägg till + + + Kontrollera automatiskt om det finns uppdateringar + + + Flytta ner + + + Flytta upp + + + Namn: + + + Ta bort + + + Källa: + + + AddIns + + + Allmänt + + + Följande AddIns är beroende av "{0}": + +{1} + +Dessa kommer att sluta fungera om detta AddIn tas bort! Är du säker på att du vill fortsätta? + + + SharpDevelop AddIns|*.sdaddin;*.addin|Alla filer|*.* + + + Klicka här för att se uppdateringarna. + + + Uppdateringar till SharpDevelop finns tillgängliga + + + Tillgängliga + + + Installerade + + + Uppdateringar + Den här filen innehåller inkonsekvent information (newlines). @@ -269,7 +388,7 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Hjälp bibliotek - Hjälpläge + Välj hjälpinställningar Kunde inte starta Hjälp bibliotekshanteraren på grund av att katalog inte är installerad eller vald. Vänligen kontrollera dina inställningar (se Verktyg>Inställningar>Microsoft Help Viewer) @@ -299,7 +418,13 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Visa hjälp - Använd extern hjälp + Använd extern hjälpvisare + + + Jag vill använda lokal hjälp + + + Jag vill använda online-baserad hjälp Antal bytes per rad @@ -310,6 +435,9 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Data + + Förskjutning + Numeriskt system @@ -364,9 +492,39 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Alla funktioner för {0} + + Den valda SharpDevelop-profileringssessionen skapades av en nyare version av SharpDevelop och kan därför inte öppnas. + + + SharpDevelop-profileringssession + + + Detta projekt kunde inte startas eftersom den exekverbara filen inte kunde hittas. Kontrollera att projektet och dess beroenden är korrekt byggda! + + + Hittade inget projekt som kan startas. Avbryter... + + + Förbereder för analys... + + + Kunde inte registrera profileraren i COM-registret. Profileringen kan inte påbörjas! + + + Kunde inte avregistrera profileraren från COM-registret! + Profil + + Kombinera rekursiva anrop. + + + Profilera inte interna anropa hos .NET. + + + Samla data endast vid sessionens slut. + Börja insamling av data direkt efter att sessionen har startat. @@ -376,9 +534,18 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Storlek av temporär data fil. + + Spåra händelser + Profilering + + Profilera nuvarande projekt + + + Välj en exekverbar att profilera + Ogiltigt data, vänligen försök igen! @@ -388,12 +555,18 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Starta profilering + + Profilera exekverbar + Samla data Stäng ner + + Kontrollfönster för profileraren + Antal anrop @@ -403,9 +576,15 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Kopiera markerat + + Hitta anrop för valda funktioner + Gå till definition + + Ange som rot/Slå ihop + Visa funktioner @@ -439,15 +618,33 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Tid: + + Analyserare av profileringssession + Topp 20 + + Uppdaterar vy, vänligen vänta... + + + Kör med profilerare + Söker... + + Lägg till Setter + Välj de fält som du vill skapa egenskaper för: + + Implementera INotifyPropertyChanged + + + Skapa egenskaper + Extrahera funktion @@ -469,9 +666,18 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Introducera funktion {0} i {1} + + Åsidosätt Equals() och GetHashCode() + Lägg till interface {0} + + Lägg till åsidosättande av ${otherMethod} + + + Åsidosätt ToString() + Kontrollera nuvarande projekt med StyleCop @@ -583,9 +789,18 @@ Ladda hem ett tillägg från Internet och klicka sedan på 'Installera Tillägg' Tack för din medverkan! Du kan alltid gå ur genom att ändra inställningarna.i SharpDevelop. + + Jag vill delta - samla och skicka användningsdata + + + Jag vill inte delta + Visa insamlad data + + Ta bort marginal + Händelsefärg: @@ -644,9 +859,15 @@ Du kan specificera ett startcommando i projektinställningarna. Avregistrera TypeLib + + Misslyckades med att bifoga till processen {0}. + Process + + Bifoga + Kan inte hitta typen @@ -767,6 +988,9 @@ Du kan specificera ett startcommando i projektinställningarna. &Öppna + + Token för publik nyckel + Version @@ -869,6 +1093,12 @@ Du kan specificera ett startcommando i projektinställningarna. Väntar på att applikationen skall starta. Ifall applikationen inte startar (eller om du tröttnar på att vänta) så kan du avbryta genom att klicka på Avbryt. + + Är du säker på att du vill återställa alla tidigare angivna formateringsinställningar? + + + Återställ till: + Infoga anonyma metoder utan parametrar. @@ -1227,7 +1457,7 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Detaljinställningar för kodkomplettering - Följande inställningar är programspråksberoende, varför inställningarna kan variera mellan resp. språk. + Följande inställningar är språkberoende, vissa inställningar är inte tillgängliga för vissa språk. Använd följande inställning för att avaktivera kodkomplettering: @@ -1238,6 +1468,9 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Spara + + Dokumentation (om tillgänglig) + Förhandsvälj nyligen använda medlemmar @@ -1302,7 +1535,7 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Redigera Standardrubriker - Generella + Allmänt Skapa &alltid säkerhetskopia @@ -1548,11 +1781,14 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Ingen - Markörer och linjaler + Markörer Markörer och linjaler + + Linjaler + Visa &blanksteg @@ -1638,7 +1874,7 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Projektinformation - &Rot namespace: + &Rotnamnrymd: &Startobjekt: @@ -1737,7 +1973,7 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? Tillåt &osäker kod - Generell + Allmänt Referera inte till &mscorlib.dll @@ -1806,7 +2042,7 @@ Vill du lägga till den nya filen till projektet ${CurrentProjectName}? &Lägg till importering - &Namespace: + &Namnrymd: Publicera @@ -1997,6 +2233,9 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek &Lägg till + + Avancerad + < Tillbaka @@ -2090,6 +2329,9 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Flytta &Upp + + Ej tillämpbar + Namn @@ -2207,6 +2449,9 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek XML redigerare + + Välj vilket program som du vill öppna denna fil med: + Standard @@ -2264,9 +2509,21 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Boo tolkare + + SharpDevelop kan inte hitta FxCop. Välj installationsmapp för FxCop i SharpDevelops inställningar. + + + Kan inte läsa loggfilen för FxCop: + Mono är inte installerad. + + Kör kodanalys... + + + Okänd version av vald Mono Framework + Kodanalys @@ -2291,6 +2548,9 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Kunde inte hitta FxCop - kontrollera att FxCop finns installerad. + + Laddar tillgängliga regler... + Du kan specificera sökvägen till FxCop under inställningarna för SharpDevelop. @@ -2306,6 +2566,9 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Kör FxCop på + + Visa inte meddelande + Kodtäckning @@ -2315,9 +2578,15 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Kolumn + + Innehåll + Slutkolumn + + Radslut + Ingen resultatfil för kodtäckning genererades: @@ -2369,6 +2638,21 @@ Du kan även välja att lagra inställningen i .user-filen istället för projek Ytterligare inställningar + + Länkskapare + + + Länka ytterligare filer + + + Länka specifika .NET-moduler + + + Biblioteksfilernas placeringar + + + Bädda in .NET-resursfil + Preprocessor @@ -2666,6 +2950,9 @@ Alla ändringar kommer att förloras. Vill du verkligen avsluta SharpDevelop? Alla ändringar som inte sparats kommer att förloras! + + Rapportera fel till SharpDevelop-teamet + Tack för att du hjälper oss att göra SharpDevelop till ett bättre program. @@ -2685,7 +2972,7 @@ Alla ändringar kommer att förloras. Sökväg - Namespace + Namnrymd K&omponenter att lägga till @@ -2721,7 +3008,7 @@ Alla ändringar kommer att förloras. Konfigurera Verktygsfält - Namespace + Namnrymd &Ny @@ -2763,7 +3050,7 @@ Alla ändringar kommer att förloras. markera metoden InitializeComponents i kodvyn som endast läsbar - Generell + Allmänt Rutsystemets egenskaper @@ -2771,6 +3058,9 @@ Alla ändringar kommer att förloras. &Höjd + + Använd optimerad kodgenerering + Rutsystemets Inställningar @@ -2844,13 +3134,13 @@ Inga komponenter för WindowsFormer kommer att vara tillgängliga, var god konfi Gå till - Namespace innehåller ogiltiga tecken. Ett namespace kan endast innehålla bokstäver, siffror eller underscore tecken. + Namnrymden innehåller ogiltiga tecken. En namnrymd kan endast innehålla tecken som består av bokstäver, siffror eller understreck. Referensnamnet innehåller ogiltiga tecken. - &Namespace: + &Namnrymd: Parametrar @@ -2972,13 +3262,16 @@ Endast bokstäver, siffror, mellanslag, '.' eller '_' får användas. Specificerar om filen skall kopieras till utdatamappen - Anpassa verktyg + Anpassningsverktyg Specificerar verktyget som konverterar filen till utdatat. - Namespace för anpassa verktyg + Namnrymd för anpassningsverktyget + + + Specificerar namnrymden som anpassningsverktyget placerar utdata i. Fullständig sökväg till filen. @@ -3043,6 +3336,9 @@ Endast bokstäver, siffror, mellanslag, '.' eller '_' får användas. Konvertera valda &projekt till: + + Kompilatorversion + &Konvertera @@ -3149,6 +3445,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Lägg till filer... + + Installationspaket + Kunde inte hitta '{0}' i {1} @@ -3218,6 +3517,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö WiX bibliotek + + Inga skillnader upptäckta. + WIX projekt @@ -3303,10 +3605,10 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Schemata - Det gick inte att lägga till schemat. Namespace '{0}' existerar redan. + Det gick inte att lägga till schemat. Namnrymden '{0}' existerar redan. - Schema '{0}' saknar ett namespace (mål). + Schema '{0}' saknar en namnrymd som mål. XML Schemata @@ -3344,6 +3646,12 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö XML träd + + Namnrymd + + + Namnrymd + Prefix @@ -3392,6 +3700,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Vill du verkligen kassera dina ändringar? + + namnrymd + Vill du spara ändringarna? @@ -3968,6 +4279,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö XML dokumentationsfilen existerar inte, du måste kompilera projektet först. + + För att skapa dokumentation från XML-kommentarer så krävs att 'Sandcastle Help File Builder' är installerad. + HTML-e&xport @@ -4062,7 +4376,7 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Multilinje - Namespace + Namnrymd Publik synlig @@ -4235,6 +4549,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Operationen kunde inte utföras på grund av att källkoden innehåller fel: + + Skapa &Getter + Skapa OnEvent-metod @@ -4298,6 +4615,9 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö Flytta klassen till filen '${FileName}' + + Åsidosättanden av ${Name} + Referenser till ${Name} @@ -4329,7 +4649,7 @@ Gå till 'Inställningar->Visuell stil' och ändra den nuvarande språkmiljö C# Dokumentations Taggar - Generell + Allmänt Licenser @@ -4526,9 +4846,6 @@ Resursfilerna har därför bytt namn/flyttats enligt ovan. Grafikenhet - - Grundläggande rapportinställningar - Rapportmodell @@ -4571,15 +4888,6 @@ Resursfilerna har därför bytt namn/flyttats enligt ovan. Tillgängliga fält - - Sökväg till schema (.xsd) fil - - - Spara resultat (schema och data) - - - Spara resultat (endast schema) - Visa sökresultat @@ -5660,7 +5968,4 @@ Resursfilerna har därför bytt namn/flyttats enligt ovan. Avkommentera region - - Den här resursen används inte. Dess syfte är att testa översättningsdatabasen och har en linjebrytning. - \ No newline at end of file diff --git a/data/resources/StringResources.tr.resx b/data/resources/StringResources.tr.resx index 1bf40d0bba..bc6416fde2 100644 --- a/data/resources/StringResources.tr.resx +++ b/data/resources/StringResources.tr.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Bu kaynak kullanılamıyor. Amacı, çeviri veritabanını test etmek ve bir satır kesmesi var. + Hakkında @@ -160,7 +163,7 @@ Bu eklenti iki kez kurulmuş. Lütfen birini kaldırın. - Eklentinin Eklenti Yöneticisi tarafindan kullanılmasi için bir kimliği olmalıdır. + Eklenti Eklenti Yöneticisi tarafından kullanılabilmesi için bir <kimlik> sahibi olmalıdır. Eklenti SharpDevelop yeniden başlatıldığında kaldırılacak. @@ -229,6 +232,158 @@ Bilinmeyen dosya biçimi: + + Arşivden yükle... + + + Depo: + + + Ara: + + + Önyüklü eklentileri göster + + + Önsürümleri göster + + + Eklentileri yeniden yüklemeden, eklenti yöneticisini kaldıramazsınız! + + + SharpDevelop Eklenti Arşivi + + + Düzenleyen: + + + Bağımlılıklar: + + + İndirilenler: + + + Dosya adı: + + + Yüklü sürüm: + + + Son güncelleme: + + + Daha fazla bilgi + + + Yeni sürüm: + + + Değerlendirme: + + + Uygunsuzluğu bildir + + + Sürüm: + + + Lisans Koşulları: + + + Kurulu Eklenti, "{0}"'a bağlıdır: + +{1} + +Eklenti devre dışı olduktan sonra durabilir! Devam etmek istediğinizden emin misiniz? + + + Paket "{0}", ilave pakete ihtiyaç duymaktadır: + +{1} + +Uygulama, onları da indirip yüklemek için çalışacak. Devam etmek istiyor musunuz? + + + Seçili paket geçerli SharpDevelop Eklentisi içermiyor. + + + &Kabul et + + + &Reddet + + + "Kabul et" butonuna tıklayarak paket için lisans şartlarını kabul ediyorsunuz. +Eğer lisans şartlarını kabul etmiyorsanız "Reddet" butonuna tıklayın. + + + "Kabul et" butonuna tıklayarak yukarıda listelenen paketler için lisans şartlarını kabul ediyorsunuz. +Eğer lisans şartlarını kabul etmiyorsanız "Reddet" tıklayın. + + + Aşağıdaki paket için bir lisans koşulunu kabul gerekiyor: + + + Aşağıdaki paketler için lisans koşullarını kabul etmeniz gerekli: + + + Lisans Koşulları + + + Ekle + + + Güncellemeleri otomatik kontrol et + + + Aşağı Taşı + + + Yukarı Taşı + + + Ad: + + + Kaldır + + + Kaynak: + + + Eklenti + + + Genel + + + Depolar + + + "{0}", aşağıdaki yüklü Eklentiye bağlı: + +{1} + +Eklenti kaldırıldıktan sonra çalışması durabilir! Devam etmek istediğinizden emin misiniz? + + + SharpDevelop Eklentileri|*.sdaddin;*.addin|All files|*.* + + + Güncellemeleri görmek için buraya tıklayın. + + + SharpDevelop için yararlanılabilir güncelleştirmeler + + + Yararlanılabilir + + + Yüklü + + + Güncellemeler + Bu dosya tutarsız satırlar içeriyor. @@ -253,6 +408,9 @@ Sınıf Şemasını Göster + + Geçmişi sil + Bu işlem için TortoiseGit yüklü olmalıdır. @@ -269,11 +427,14 @@ Yardım Kitaplığı - Yardım Modu + Yardım Tercihi Ayarı Seçili veya yüklü bir yardım kataloğu olmadığından, Kütüphane Yöneticisi Yardımı başlatılamıyor. Yardım ayarlarınızı kontrol ediniz(Araçlar> Seçenekler> Araçlar> Microsoft Yardım Görüntüleyici). + + Yardım Kitaplığı Yöneticisi bulunamadı. SharpDevelop yardım özelliğini kullanmak için Microsoft Windows SDK 7.1 indirin ve kurun. + Kütüphane Yöneticisi Yardımı bulunamadı. Yüklemeyi kontrol edin. @@ -302,7 +463,7 @@ Yardımı Göster - Harici yardımı kullan + Harici yardım görüntüleyici kullan Yerel yardımı kullanmak istiyorum @@ -367,6 +528,21 @@ Başlık + + Paket yönetim konsolu + + + Paketleri yönet... + + + Paketleri geri yükle + + + Paket kaynakları + + + Paket yönetimi + Sonuç @@ -1382,6 +1558,30 @@ Bir ActiveX / COM nesnesi oluşturmak / değiştirmek için, nesne ağacı veya Kod Kalite Analizi + + Kodu otomatik biçimlendir + + + (varsayılan) + + + (global) + + + Ön ayarlı seçim biçimlendirilmemiş! + + + Tüm öntanımlı biçimlendirme seçeneklerini sıfırlamak istediğinizden emin misiniz? + + + (proje) + + + Sıfırla: + + + (Çözüm) + Açık yönteme referans ekleyin; yeni yöntem eklemek için tab veya enter tuşuna tekrar basın. @@ -1391,6 +1591,9 @@ Bir ActiveX / COM nesnesi oluşturmak / değiştirmek için, nesne ağacı veya Parametreli anonim yöntem yerleştir. + + Kolonlar: + SharpDevelop Hakkında @@ -1412,6 +1615,12 @@ Bir ActiveX / COM nesnesi oluşturmak / değiştirmek için, nesne ağacı veya Sürüm + + İşlemler: + + + Servisler: + son dosyalar @@ -1498,6 +1707,9 @@ Satır numaraları, sınıf yada dosya adları girebilirsiniz. İtalik + + Altı çizili + Renk vurgulamayı dışa aktar @@ -1802,6 +2014,12 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Önbelleği temizle + + Basılı karaktere bağlı kalarak seçili kod tamamlamayı ekle: + + + Sadece <Tab> veya <Enter> tuşuna basarak seçili kod tamamlama öğersi ekle. + Bir karakter eklendiğinde tamamlama listesini göster @@ -1823,6 +2041,18 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Kaydet + + İpucu ayarları + + + Araçipuçları linkler gitmeli + + + Kod tanımı + + + Belgeler (varsa) + Son kullanılan üyeleri öncelikli seç @@ -1871,12 +2101,30 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Hata ayıklama + + Bağımsız değişkenleri ve yürütülebilir lansman üzerinde çalışan dizini iste. + + + Yürütmenin ilk satırında ara ver. + + + İstisnaları seçiniz + Tekrar derlemeyi etkinleştir Düzenle ve Devam eti Etkinleştir + + Tam istisna adı + + + Hata ayıklayıcıyı duraklat + + + Hata ayıklayıcının durmasını istediğiniz istisna tiplerini seçiniz + İstisnalar @@ -1919,6 +2167,9 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Sembol ve kaynak kodu yolları: + + Kaynak Ayıklama Olmadan + Başlık @@ -2186,6 +2437,9 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Eşleşen parantezleri vurgula + + Geçerli satırı vurgulayın + Sembolleri vurgula @@ -2264,6 +2518,9 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Derlemenin oluşturulacağı dizini seçin. + + Servis referansları + Vurgu @@ -2447,6 +2704,9 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? VB Seçenekleri için varsayılan değerler: + + Kod biçimlendirme + Yapılandırma @@ -2456,6 +2716,12 @@ Yeni dosyayı, ${CurrentProjectName} projesine eklemek istiyor musunuz? Yapılandırmayı değiştirmek mevcut değerleri kaydeder. Devam edilsin mi? + + Dosya isimleri: + + + Derledikten sonra çalıştır. + Hata Ayıkla @@ -2633,6 +2899,9 @@ Ayrıca bir ayarı proje dosyası yerine kullanıcı dosyası(.user-file) içind Mevcut sınıfı kullan: + + Mümkünse hataları otomatik olarak düzelt + .NET Derleme Tarayıcısı @@ -2885,12 +3154,27 @@ Ayrıca bir ayarı proje dosyası yerine kullanıcı dosyası(.user-file) içind Değiştir + + Yeniden başlat + Yeniden Dene Hepsini Seç + + Alt + + + Ctrl + + + Shift + + + Win + Küçük Simgeler @@ -3152,9 +3436,15 @@ Ayrıca bir ayarı proje dosyası yerine kullanıcı dosyası(.user-file) içind Kapsanmamış Kod + + Kod Kısmen Kapalı + Kolon + + İçerik + Gösterim Seçenekleri @@ -3421,6 +3711,9 @@ Lütfen SharpDevelop Seçeneklerinden NAnt çalıştırılabilir dosyasının ye '{0}' türü bulunamıyor. Bir derleme bilgisi eksik olabilir mi? + + Kursorün bulunduğu pozisyonda tip tanımı veya tip üyesi bulunamadı + Seçilen eleman sınıfsız veya geçersiz bir üye, bu yüzden türetilmemiş semboller gösterilebilir. @@ -3596,6 +3889,12 @@ Not: Bu işlem özel düzenlemelerinizi etkilemez. Artan Ters Arama: + + {0} geçerli bir .NET derlemesi değil. + + + {0} erişilebilir değil ya da artık yok. + ${Filename} dosyasından ${Assembly} için kod tamamlama bilgisi yükleme hatası: @@ -4128,6 +4427,9 @@ Sadece harf,rakam, boşluk, '.' yada '_' kullanabilirsiniz. Bu çözüm dışarıdan değiştirildi. + + Çözüm Biçimlendirme Seçenekleri + Seçilen projeleri dönüştür: @@ -4472,6 +4774,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< .NET Framework Uzantısı + + WİX yüklü değil. Lütfen http://wixtoolset.org/ adresinden indirin. + Fark bulunamadı @@ -4493,6 +4798,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Visual Studio Uzantısı + + WPF Tasarımcısı Küçük Resim Görünümü + Kopyala @@ -4709,6 +5017,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Derleme başarılı oldu. + + ${Name} projesinin derlenmesi desteklenmemektedir. + Derleme başladı. @@ -4793,6 +5104,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Sık Kullanılanlar + + Çalışma alanına ekle + Geri @@ -4832,9 +5146,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Arama sonucu olumsuz. + + Derleme aç + + + Dosyadan derleme aç... + + + GAC'dan derleme aç... + + + Sınıf Tarayıcıda Aç + Sınıf Görünümü Arama + + {0} Çalışma alanı + Sınıflar @@ -4847,6 +5176,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Sözcük Kaydırmaya Geç + + İzleme ifadesi ekle + DuraksamaNoktaları @@ -4943,9 +5275,15 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Konsol + + Çalıştırılabilir ayıkla + Kesme + + ${ExceptionName} öngörülen istisna durumunda duraklat + Devam @@ -5273,6 +5611,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Hata Ayıkla + + Metin çok uzun olduğundan kısaltılmıştır. + Projeler @@ -5300,6 +5641,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< deki + + <proje yok> + ${Count} tane bulundu @@ -5315,6 +5659,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Dosya başına + + Proje başına + + + Proje ve dosya başına + Liste modu aramayı seç @@ -5327,6 +5677,24 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Görev Listesi + + Açık olan tüm dosyalarda + + + Sınıf/Modül + + + Dosya + + + Ad alanı + + + Proje + + + Çözüm + Araçlar @@ -5480,6 +5848,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Referans Ekle + + Servis Referansı Ekle + Web Referansı Ekle @@ -5735,24 +6106,42 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Resmi güncelle... + + İmleci güncelle ... + + + İkonu güncelle ... + Seçili kaynağı silmek istediğinizden emin misiniz? Kaynağı sil + + Filtre: + Kaynak yüklenemiyor + + Kaynak dosyadan {0} yüklenemedi. + Hata: Kaynak kodu üreteci "{0}" kaynak dosyasını atladı, çünkü oluşturulan sınıf mevcut sınıf "{1}" ile çakışıyor. Kaynak kod üreteci: '{0}' kaynağı için hiçbir kaynak özelliği oluşturamıyor. + + Yorum + İçerik + + Boolean giriş & ekle + Dosyaları ekle... @@ -5762,6 +6151,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Kaynak adı kopyala + + Yorumu düzenle + + + Kaynak yorumunuz için yeni metin giriniz: + Yeniden adlandır @@ -5867,6 +6262,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< ${Name} Temel sınıfları + + ${Name} temel üyesidir + Bu işlem yerine getirilemez çünkü kaynak kodlarınızda hata var: @@ -5879,6 +6277,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< ${Name} 'den türeme sınıflar + + Pano halkasından yapıştır... + + + Pano halkası boş + Otomatik özelliği dönüştür @@ -5909,6 +6313,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< Temel sınıfları bul + + Temel semboleri bul + Türetilmiş sınıfları bul @@ -5963,6 +6370,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFXCompiler, WixNetFxExtension< ${Name} geçersiz kıl + + ${Name} parçaları + ${Name} referansları @@ -6210,15 +6620,15 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. Rapor Türü + + Temel rapor ayarları + Dosya Adı Grafik Birim - - Temel rapor ayarları - Rapor Modeli @@ -6252,6 +6662,9 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. Tablo Düzeni + + Sayfa düzeni + Veri Modeli Çek @@ -6267,18 +6680,18 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. Mevcut Alanlar - - (.xsd) şema dosyası yolu + + Proje seçili değildir,lütfen alan adlarını giriniz - - Sonuçları Kaydet (Şema ve Veriler) - - - Sonuçları Kaydet(Sadece şema) + + Seçili projedeki sınıflar Sorgu Sonucunu Göster + + SharpReport sihirbazına hoşgeldiniz + Sekme Ekle @@ -6339,6 +6752,9 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. Çözüm Aç + + Son projeler listesinden kaldır + Başlangıç Sayfası @@ -6351,6 +6767,12 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. satır ${Line} sütun ${Column} ${Character} + + Uzunluk ${Rows} * ${Cols}(${Total}) + + + Uzunluk ${Length} + Çeşitli @@ -7380,6 +7802,9 @@ Kaynak dosyaları buna göre yeniden adlandırıldı/taşındı. Artan Aramayı Geri Al + + Sorunları araştır... + Yer imlerini ters çevir @@ -7495,10 +7920,10 @@ Başlatma hatası: Yeniden Düzenleme + + Tekrar formatla + Bölgeyi yorumlama - - Bu kaynak kullanılamıyor. Amacı, çeviri veritabanını test etmek ve bir satır kesmesi var. - \ No newline at end of file diff --git a/data/resources/StringResources.zh.resx b/data/resources/StringResources.zh.resx index 94040e1397..32296edf17 100644 --- a/data/resources/StringResources.zh.resx +++ b/data/resources/StringResources.zh.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 该资源不被使用.它仅仅用来测试翻译数据库. + 关于 @@ -6018,9 +6021,6 @@ SharpDevelop 编译资源时发现不对应:资源名称不是文件名,而 图形单元 - - 基本报表设置 - 报表模型 @@ -6069,15 +6069,6 @@ SharpDevelop 编译资源时发现不对应:资源名称不是文件名,而 有效字段 - - Schema文件(.xsd)的路径 - - - 保存结果(Schema和数据) - - - 保存结果(仅Schema) - 显示查询结果 @@ -7241,7 +7232,4 @@ SharpDevelop 编译资源时发现不对应:资源名称不是文件名,而 设为非注释区 - - 该资源不被使用.它仅仅用来测试翻译数据库. - \ No newline at end of file diff --git a/data/resources/languages/LanguageDefinition.xml b/data/resources/languages/LanguageDefinition.xml index 6df07f1a16..dd41db243e 100644 --- a/data/resources/languages/LanguageDefinition.xml +++ b/data/resources/languages/LanguageDefinition.xml @@ -14,9 +14,9 @@ - + - + diff --git a/data/templates/file/CSharp/CSharp.Exception.xft b/data/templates/file/CSharp/CSharp.Exception.xft index ac825703d8..fdaa09aed9 100644 --- a/data/templates/file/CSharp/CSharp.Exception.xft +++ b/data/templates/file/CSharp/CSharp.Exception.xft @@ -28,7 +28,7 @@ using System.Runtime.Serialization; namespace ${StandardNamespace} { /// - /// Desctiption of ${ClassName}. + /// Description of ${ClassName}. /// public class ${ClassName} : Exception, ISerializable { diff --git a/data/templates/file/VB/VB.Exception.xft b/data/templates/file/VB/VB.Exception.xft index 77c92f1eca..8bced5fe62 100644 --- a/data/templates/file/VB/VB.Exception.xft +++ b/data/templates/file/VB/VB.Exception.xft @@ -27,7 +27,7 @@ Imports System.Runtime.Serialization Namespace ${StandardNamespace} ''' - ''' Desctiption of ${ClassName}. + ''' Description of ${ClassName}. ''' Public Class ${ClassName} Inherits Exception diff --git a/doc/copyright.txt b/doc/copyright.txt index 0a3757d176..882708041c 100644 --- a/doc/copyright.txt +++ b/doc/copyright.txt @@ -1,4 +1,4 @@ -Copyright 2002-2014 by +Copyright 2002-2015 by AlphaSierraPapa, Christoph Wille Vordernberger Strasse 27/8 diff --git a/doc/license.txt b/doc/license.txt index 90c31d266e..82a70fab68 100644 --- a/doc/license.txt +++ b/doc/license.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2002-2014 AlphaSierraPapa +Copyright (c) 2002-2015 AlphaSierraPapa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/samples/XamlDesigner/App.xaml.cs b/samples/XamlDesigner/App.xaml.cs index 6a9be5c98c..5d9484dadf 100644 --- a/samples/XamlDesigner/App.xaml.cs +++ b/samples/XamlDesigner/App.xaml.cs @@ -31,9 +31,16 @@ namespace ICSharpCode.XamlDesigner private static bool internalLoad = false; private static string lastRequesting = null; - + Assembly AppDomain_CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { + var assList = AppDomain.CurrentDomain.GetAssemblies(); + var loaded = assList.FirstOrDefault(x => x.FullName == args.Name); + if (loaded != null) + { + return loaded; + } + if (internalLoad) return null; @@ -48,7 +55,7 @@ namespace ICSharpCode.XamlDesigner ass = Assembly.Load(args.Name); } catch (Exception) { } - + if (ass == null && args.RequestingAssembly != null) { lastRequesting = args.RequestingAssembly.Location; var dir = Path.GetDirectoryName(args.RequestingAssembly.Location); @@ -68,7 +75,7 @@ namespace ICSharpCode.XamlDesigner } internalLoad = false; - + return ass; } diff --git a/samples/XamlDesigner/Document.cs b/samples/XamlDesigner/Document.cs index 21a28e35e5..705c1046de 100644 --- a/samples/XamlDesigner/Document.cs +++ b/samples/XamlDesigner/Document.cs @@ -11,6 +11,7 @@ using System.Xml; using ICSharpCode.WpfDesign; using ICSharpCode.WpfDesign.Designer.Services; using System.Diagnostics; +using ICSharpCode.WpfDesign.XamlDom; namespace ICSharpCode.XamlDesigner { @@ -153,9 +154,9 @@ namespace ICSharpCode.XamlDesigner } } - OutlineNode outlineRoot; + IOutlineNode outlineRoot; - public OutlineNode OutlineRoot { + public IOutlineNode OutlineRoot { get { return outlineRoot; } @@ -196,7 +197,7 @@ namespace ICSharpCode.XamlDesigner void UpdateXaml() { var sb = new StringBuilder(); - using (var xmlWriter = XmlWriter.Create(sb)) { + using (var xmlWriter = new XamlXmlWriter(sb)) { DesignSurface.SaveDesigner(xmlWriter); Text = XamlFormatter.Format(sb.ToString()); } diff --git a/samples/XamlDesigner/DocumentView.xaml b/samples/XamlDesigner/DocumentView.xaml index 06f45a450f..760bb699b9 100644 --- a/samples/XamlDesigner/DocumentView.xaml +++ b/samples/XamlDesigner/DocumentView.xaml @@ -13,10 +13,10 @@ + Visibility="{Binding InDesignMode, Converter={StaticResource CollapsedWhenFalse}}"/> \ No newline at end of file diff --git a/samples/XamlDesigner/DocumentView.xaml.cs b/samples/XamlDesigner/DocumentView.xaml.cs index fad8fa09f4..755ba648d1 100644 --- a/samples/XamlDesigner/DocumentView.xaml.cs +++ b/samples/XamlDesigner/DocumentView.xaml.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.XamlDesigner InitializeComponent(); Document = doc; - Shell.Instance.Views[doc] = this; + Shell.Instance.Views[doc] = this; //uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged); Document.Mode = DocumentMode.Design; @@ -52,7 +52,15 @@ namespace ICSharpCode.XamlDesigner try { uxTextEditor.ScrollTo(error.Line, error.Column); uxTextEditor.CaretOffset = uxTextEditor.Document.GetOffset(error.Line, error.Column); - } catch (ArgumentException) { + + int n = 0; + char chr; + while ((chr = uxTextEditor.Document.GetCharAt(uxTextEditor.CaretOffset + n)) != ' ' && chr != '.' && chr != '<' && chr != '>' && chr != '"') + { n++; } + + uxTextEditor.SelectionLength = n; + } + catch (ArgumentException) { // invalid line number } } diff --git a/samples/XamlDesigner/ErrorListView.xaml b/samples/XamlDesigner/ErrorListView.xaml index fa661fa0e3..158a26f25e 100644 --- a/samples/XamlDesigner/ErrorListView.xaml +++ b/samples/XamlDesigner/ErrorListView.xaml @@ -2,15 +2,22 @@ xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Services="clr-namespace:ICSharpCode.WpfDesign.Designer.Services;assembly=ICSharpCode.WpfDesign.Designer"> - - - - - - - - + + + + + + + + + + + + diff --git a/samples/XamlDesigner/ExtensionMethods.cs b/samples/XamlDesigner/ExtensionMethods.cs index ff09256e1d..3c582b0adc 100644 --- a/samples/XamlDesigner/ExtensionMethods.cs +++ b/samples/XamlDesigner/ExtensionMethods.cs @@ -1,3 +1,21 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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.Collections.Generic; using System.Linq; diff --git a/samples/XamlDesigner/Shell.cs b/samples/XamlDesigner/Shell.cs index 2f1a0abe41..fad5178762 100644 --- a/samples/XamlDesigner/Shell.cs +++ b/samples/XamlDesigner/Shell.cs @@ -30,7 +30,7 @@ namespace ICSharpCode.XamlDesigner //public Toolbox Toolbox { get; set; } //public SceneTree SceneTree { get; set; } - public PropertyGrid PropertyGrid { get; internal set; } + public IPropertyGrid PropertyGrid { get; internal set; } //public ErrorList ErrorList { get; set; } public ObservableCollection Documents { get; private set; } diff --git a/samples/XamlDesigner/Toolbox.cs b/samples/XamlDesigner/Toolbox.cs index d4880827a7..c25b4f3972 100644 --- a/samples/XamlDesigner/Toolbox.cs +++ b/samples/XamlDesigner/Toolbox.cs @@ -70,7 +70,7 @@ namespace ICSharpCode.XamlDesigner { AddAssembly(Environment.ExpandEnvironmentVariables(path), false); } - catch (Exception ex) + catch (Exception) { } } } @@ -78,7 +78,7 @@ namespace ICSharpCode.XamlDesigner static bool IsControl(Type t) { - return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(FrameworkElement)); + return !t.IsAbstract && !t.IsGenericTypeDefinition && t.IsSubclassOf(typeof(UIElement)) && t.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null) != null; } } diff --git a/samples/XamlDesigner/XamlDesigner.sln b/samples/XamlDesigner/XamlDesigner.sln index e4a9c002ca..08bd78a71d 100644 --- a/samples/XamlDesigner/XamlDesigner.sln +++ b/samples/XamlDesigner/XamlDesigner.sln @@ -1,7 +1,9 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -# SharpDevelop 5.0 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +# SharpDevelop 5.1 +VisualStudioVersion = 12.0.20827.3 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamlDesigner", "XamlDesigner.csproj", "{27DA2B5C-2AAA-4478-AB00-3E184273C241}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "..\..\src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}" diff --git a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml index bb65181853..87e26df0f7 100644 --- a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml +++ b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml @@ -7,12 +7,11 @@ + HorizontalAlignment="Center" TextWrapping="Wrap" /> + Style="{x:Static core:GlobalStyles.ButtonStyle}" /> diff --git a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs index 8129f06798..d620fdec43 100644 --- a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs +++ b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanel.xaml.cs @@ -276,7 +276,7 @@ namespace ICSharpCode.CodeAnalysis private void ChangeRuleAssembliesButtonClick( object sender, RoutedEventArgs e) { var stringListDialog = new StringListEditorDialog(); - stringListDialog.BrowseForDirectory = true; + stringListDialog.ShowBrowse = true; stringListDialog.TitleText = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}"); stringListDialog.LoadList(GetRuleAssemblyList(false)); stringListDialog.ShowDialog(); diff --git a/src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResultsReader.cs b/src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResultsReader.cs index b53be5572f..9f5bdde79b 100644 --- a/src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResultsReader.cs +++ b/src/AddIns/Analysis/CodeCoverage/Project/Src/CodeCoverageResultsReader.cs @@ -52,8 +52,9 @@ namespace ICSharpCode.CodeCoverage CodeCoverageResults ReadCodeCoverageResults(string fileName) { - TextReader reader = fileSystem.OpenText(FileName.Create(fileName)); - return new CodeCoverageResults(reader); + using (TextReader reader = fileSystem.OpenText(FileName.Create(fileName))) { + return new CodeCoverageResults(reader); + } } public IEnumerable GetMissingResultsFiles() diff --git a/src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs b/src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs index fdd2a97d49..805ac8e593 100644 --- a/src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs +++ b/src/AddIns/Analysis/CodeCoverage/Project/Src/OpenCoverApplication.cs @@ -104,7 +104,7 @@ namespace ICSharpCode.CodeCoverage string GetArguments() { // IMPORTANT: https://github.com/sawilde/opencover/wiki/Usage - arguments = new StringBuilder("-register:user "); + arguments = new StringBuilder("-register:user -mergebyhash "); AppendTarget(); AppendTargetWorkingDirectory(); diff --git a/src/AddIns/Analysis/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs b/src/AddIns/Analysis/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs index b60ff8f777..aafd3f7464 100644 --- a/src/AddIns/Analysis/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs +++ b/src/AddIns/Analysis/CodeCoverage/Project/Src/RunTestWithCodeCoverageCommand.cs @@ -119,13 +119,18 @@ namespace ICSharpCode.CodeCoverage void DisplayCodeCoverageResults(CodeCoverageResultsReader coverageResultsReader) { - foreach (CodeCoverageResults result in coverageResultsReader.GetResults()) { + foreach (CodeCoverageResults result in GetResults(coverageResultsReader)) { DisplayCodeCoverageResults(result); } foreach (string missingFile in coverageResultsReader.GetMissingResultsFiles()) { DisplayNoCodeCoverageResultsGeneratedMessage(missingFile); } } + + IEnumerable GetResults(CodeCoverageResultsReader coverageResultsReader) + { + return SD.MainThread.InvokeIfRequired(() => coverageResultsReader.GetResults().ToList()); + } void DisplayCodeCoverageResults(CodeCoverageResults results) { diff --git a/src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs b/src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs index 68fffe4340..001f04105e 100644 --- a/src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs +++ b/src/AddIns/Analysis/CodeCoverage/Test/Testing/OpenCoverApplicationTests.cs @@ -163,7 +163,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing ProcessStartInfo processStartInfo = openCoverApp.GetProcessStartInfo(); string expectedCommandLine = - "-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + + "-register:user -mergebyhash -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + "-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " + "-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " + "-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " + @@ -187,7 +187,7 @@ namespace ICSharpCode.CodeCoverage.Tests.Testing ProcessStartInfo processStartInfo = openCoverApp.GetProcessStartInfo(); string expectedCommandLine = - "-register:user -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + + "-register:user -mergebyhash -target:\"d:\\sharpdevelop\\bin\\Tools\\NUnit\\nunit-console-x86.exe\" " + "-targetdir:\"c:\\projects\\MyTests\\bin\\Debug\" " + "-targetargs:\"\\\"c:\\projects\\MyTests\\bin\\Debug\\MyTests.dll\\\" /noxml\" " + "-output:\"c:\\projects\\MyTests\\OpenCover\\coverage.xml\" " + diff --git a/src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs b/src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs index 00c55cadd0..c2799de1c2 100644 --- a/src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs +++ b/src/AddIns/Analysis/CodeQuality/Reporting/BaseReport.cs @@ -18,6 +18,7 @@ using System; using System.Collections.Generic; +using ICSharpCode.Reporting.Interfaces; using ICSharpCode.Reporting.Items; @@ -41,6 +42,6 @@ namespace ICSharpCode.CodeQuality.Reporting protected List FileNames {get;private set;} - public ReportSettings ReportSettings {get;set;} + public IReportSettings ReportSettings {get;set;} } } diff --git a/src/AddIns/Analysis/UnitTesting/Model/TestProjectBase.cs b/src/AddIns/Analysis/UnitTesting/Model/TestProjectBase.cs index 741a9407a7..3d3f70453e 100644 --- a/src/AddIns/Analysis/UnitTesting/Model/TestProjectBase.cs +++ b/src/AddIns/Analysis/UnitTesting/Model/TestProjectBase.cs @@ -42,7 +42,7 @@ namespace ICSharpCode.UnitTesting IProject project; Dictionary topLevelTestClasses = new Dictionary(); - public TestProjectBase(IProject project) + protected TestProjectBase(IProject project) { if (project == null) throw new ArgumentNullException("project"); diff --git a/src/AddIns/Analysis/UnitTesting/Test/NUnit/NUnitTestResultFailureTestFixture.cs b/src/AddIns/Analysis/UnitTesting/Test/NUnit/NUnitTestResultFailureTestFixture.cs index 27ae8c569b..5c6e5b0e4b 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/NUnit/NUnitTestResultFailureTestFixture.cs +++ b/src/AddIns/Analysis/UnitTesting/Test/NUnit/NUnitTestResultFailureTestFixture.cs @@ -18,7 +18,6 @@ using System; using ICSharpCode.NRefactory.TypeSystem; -using ICSharpCode.SharpDevelop; using ICSharpCode.UnitTesting; using NUnit.Framework; diff --git a/src/AddIns/Analysis/UnitTesting/TestRunner/TestResultsReader.cs b/src/AddIns/Analysis/UnitTesting/TestRunner/TestResultsReader.cs index f3bc984cb3..08e94b2d77 100644 --- a/src/AddIns/Analysis/UnitTesting/TestRunner/TestResultsReader.cs +++ b/src/AddIns/Analysis/UnitTesting/TestRunner/TestResultsReader.cs @@ -61,8 +61,10 @@ namespace ICSharpCode.UnitTesting public void Dispose() { - reader.Dispose(); - namedPipe.Dispose(); + if (reader != null) + reader.Dispose(); + if (namedPipe != null) + namedPipe.Dispose(); } public event EventHandler TestFinished; diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin b/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin index 8f012b7a71..2b878a57fb 100644 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin +++ b/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.addin @@ -130,7 +130,7 @@ - + diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj b/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj index a6d3b5fd9d..95273c0e26 100644 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj +++ b/src/AddIns/BackendBindings/AspNet.Mvc/Project/AspNet.Mvc.csproj @@ -134,14 +134,9 @@ - - - - - @@ -285,6 +280,11 @@ ICSharpCode.AvalonEdit False + + {53DCA265-3C3C-42F9-B647-F72BA678122B} + ICSharpCode.NRefactory.CSharp + False + {3B2A5653-EC97-4001-BB9B-D90F1AF2C371} ICSharpCode.NRefactory diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs index 4401cdb541..1ab287f0cb 100644 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs +++ b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpCompletionBinding.cs @@ -16,27 +16,149 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//using System; -//using ICSharpCode.SharpDevelop.Editor; -//using ICSharpCode.SharpDevelop.Editor.CodeCompletion; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpCompletionBinding : DefaultCodeCompletionBinding -// { -// public RazorCSharpCompletionBinding() -// { -// } -// -// public override CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch) -// { -// if (ch == '.') { -// new RazorCSharpDotCompletionDataProvider().ShowCompletion(editor); -// return CodeCompletionKeyPressResult.Completed; -// } else if (ch == '(') { -// return base.HandleKeyPress(editor, ch); -// } -// return CodeCompletionKeyPressResult.None; -// } -// } -//} +using System; +using System.IO; +using System.Web.Razor; +using ICSharpCode.NRefactory; +using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory.CSharp.Resolver; +using ICSharpCode.NRefactory.CSharp.TypeSystem; +using ICSharpCode.NRefactory.Editor; +using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.NRefactory.TypeSystem.Implementation; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Editor; +using ICSharpCode.SharpDevelop.Editor.CodeCompletion; + +namespace ICSharpCode.AspNet.Mvc.Completion +{ + public class RazorCSharpCompletionBinding : ICodeCompletionBinding + { + public bool HandleKeyPressed(ITextEditor editor, char ch) + { + if (ch == '.') { + var binding = CreateBinding(editor); + return binding.HandleKeyPressed(editor, ch); + } + return false; + } + + public bool CtrlSpace(ITextEditor editor) + { + return false; + } + + public CodeCompletionKeyPressResult HandleKeyPress(ITextEditor editor, char ch) + { + // We use HandleKeyPressed instead. + return CodeCompletionKeyPressResult.None; + } + + ICodeCompletionBinding CreateBinding(ITextEditor editor) + { + return SD.LanguageService.GetLanguageByExtension(".cs") + .CreateCompletionBinding(FindExpressionToComplete(editor), CreateContext(editor)); + } + + string FindExpressionToComplete(ITextEditor editor) + { + int endOffset = editor.Caret.Offset; + int startOffset = endOffset; + while (startOffset > 0 && IsValidCharacter(editor.Document.GetCharAt(startOffset - 1))) + startOffset--; + return editor.Document.GetText(startOffset, endOffset - startOffset); + } + + bool IsValidCharacter(char ch) + { + return Char.IsLetterOrDigit(ch) || + (ch == '.') || + (ch == '_'); + } + + ICodeContext CreateContext(ITextEditor editor) + { + var compilation = SD.ParserService.GetCompilationForFile(editor.FileName); + var project = SD.ProjectService.FindProjectContainingFile(editor.FileName); + + var resolveContext = new SimpleTypeResolveContext(compilation.MainAssembly); + + var currentTypeDefinition = new DefaultUnresolvedTypeDefinition(project.RootNamespace, Path.GetFileNameWithoutExtension(editor.FileName)); + ITypeReference baseTypeReference = new GetClassTypeReference("System.Web.Mvc", "WebViewPage", 1); + baseTypeReference = new ParameterizedTypeReference(baseTypeReference, new[] { FindModelType(editor) }); + currentTypeDefinition.BaseTypes.Add(baseTypeReference); + + var currentMethod = new DefaultUnresolvedMethod(currentTypeDefinition, "__ContextStub__"); + currentMethod.ReturnType = KnownTypeReference.Void; + currentTypeDefinition.Members.Add(currentMethod); + + var currentResolvedTypeDef = new DefaultResolvedTypeDefinition(resolveContext, currentTypeDefinition); + + var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent; + + var currentFile = new CSharpUnresolvedFile(); + + currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc"); + currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc.Ajax"); + currentFile.RootUsingScope.AddSimpleUsing("System.Web.Mvc.Html"); + currentFile.RootUsingScope.AddSimpleUsing("System.Web.Routing"); + + currentFile.TopLevelTypeDefinitions.Add(currentTypeDefinition); + + if (projectContent != null) { + compilation = projectContent.AddOrUpdateFiles(currentFile).CreateCompilation(SD.ParserService.GetCurrentSolutionSnapshot()); + } + + var context = new CSharpTypeResolveContext(compilation.MainAssembly, + currentFile.RootUsingScope.Resolve(compilation), + currentResolvedTypeDef, + currentMethod.CreateResolved(resolveContext.WithCurrentTypeDefinition(currentResolvedTypeDef))); + return new CSharpResolver(context); + } + + ITypeReference FindModelType(ITextEditor editor) + { + ParserResults results = ParseTemplate(editor.Document); + string typeName = GetModelTypeName(results); + if (string.IsNullOrWhiteSpace(typeName)) + return KnownTypeReference.Object; + return new CSharpParser().ParseTypeReference(typeName) + .ToTypeReference(NameLookupMode.BaseTypeReference); + } + + ParserResults ParseTemplate(ITextSource textBuffer) + { + var host = new RazorEngineHost(new CSharpRazorCodeLanguage()); + var engine = new RazorTemplateEngine(host); + return engine.ParseTemplate(textBuffer.CreateReader()); + } + + string GetModelTypeName(ParserResults results) + { + var visitor = new RazorCSharpParserModelTypeVisitor(); + results.Document.Accept(visitor); + return visitor.ModelTypeName; + } + } + + static class NRUtils + { + /// Does not support type arguments! + public static void AddSimpleUsing(this UsingScope scope, string fullName) + { + if (scope == null) + throw new ArgumentNullException("scope"); + string[] parts = fullName.Trim().Split('.'); + TypeOrNamespaceReference reference = null; + foreach (var part in parts) { + if (reference != null) { + reference = new MemberTypeOrNamespaceReference(reference, part, EmptyList.Instance); + } else { + reference = new SimpleTypeOrNamespaceReference(part, EmptyList.Instance); + } + } + + scope.Usings.AddIfNotNull(reference); + } + } +} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpDotCompletionDataProvider.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpDotCompletionDataProvider.cs deleted file mode 100644 index e5a321335d..0000000000 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpDotCompletionDataProvider.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpDotCompletionDataProvider : DotCodeCompletionItemProvider -// { -// } -//} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpExpressionFinder.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpExpressionFinder.cs deleted file mode 100644 index 11aae7c710..0000000000 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpExpressionFinder.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpExpressionFinder : IExpressionFinder -// { -// public RazorCSharpExpressionFinder() -// { -// } -// -// public ExpressionResult FindExpression(string text, int offset) -// { -// int position = offset - 1; -// while (position > 0 && IsValidCharacter(text[position])) { -// position--; -// } -// position++; -// string expression = text.Substring(position, offset - position); -// return new ExpressionResult(expression); -// } -// -// bool IsValidCharacter(char ch) -// { -// return Char.IsLetterOrDigit(ch) || -// (ch == '.') || -// (ch == '_'); -// } -// -// public ExpressionResult FindFullExpression(string text, int offset) -// { -// return ExpressionResult.Empty; -// } -// -// public string RemoveLastPart(string expression) -// { -// return expression; -// } -// } -//} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs index e45bc69574..a5cc0ea8be 100644 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs +++ b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpModelTypeLocater.cs @@ -16,34 +16,34 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//using System; -//using System.Web.Razor; -//using ICSharpCode.SharpDevelop; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpModelTypeLocater -// { -// public RazorCSharpModelTypeLocater(ITextBuffer textBuffer) -// { -// ParserResults results = ParseTemplate(textBuffer); -// ModelTypeName = GetModelTypeName(results); -// } -// -// ParserResults ParseTemplate(ITextBuffer textBuffer) -// { -// var host = new RazorEngineHost(new CSharpRazorCodeLanguage()); -// var engine = new RazorTemplateEngine(host); -// return engine.ParseTemplate(textBuffer.CreateReader()); -// } -// -// string GetModelTypeName(ParserResults results) -// { -// var visitor = new RazorCSharpParserModelTypeVisitor(); -// results.Document.Accept(visitor); -// return visitor.ModelTypeName; -// } -// -// public string ModelTypeName { get; private set; } -// } -//} +using System; +using System.Web.Razor; +using ICSharpCode.NRefactory.Editor; + +namespace ICSharpCode.AspNet.Mvc.Completion +{ + public class RazorCSharpModelTypeLocater + { + public RazorCSharpModelTypeLocater(ITextSource textBuffer) + { + ParserResults results = ParseTemplate(textBuffer); + ModelTypeName = GetModelTypeName(results); + } + + ParserResults ParseTemplate(ITextSource textBuffer) + { + var host = new RazorEngineHost(new CSharpRazorCodeLanguage()); + var engine = new RazorTemplateEngine(host); + return engine.ParseTemplate(textBuffer.CreateReader()); + } + + string GetModelTypeName(ParserResults results) + { + var visitor = new RazorCSharpParserModelTypeVisitor(); + results.Document.Accept(visitor); + return visitor.ModelTypeName; + } + + public string ModelTypeName { get; private set; } + } +} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpParser.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpParser.cs deleted file mode 100644 index cce64fb643..0000000000 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpParser.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -//using ICSharpCode.SharpDevelop; -//using ICSharpCode.SharpDevelop.Dom; -//using ICSharpCode.SharpDevelop.Dom.CSharp; -//using ICSharpCode.SharpDevelop.Project; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpParser : IParser -// { -// public RazorCSharpParser() -// { -// } -// -// public string[] LexerTags { get; set; } -// -// public LanguageProperties Language { -// get { return LanguageProperties.CSharp; } -// } -// -// public IExpressionFinder CreateExpressionFinder(string fileName) -// { -// return new RazorCSharpExpressionFinder(); -// } -// -// public bool CanParse(string fileName) -// { -// return Path.GetExtension(fileName).Equals(".cshtml", StringComparison.OrdinalIgnoreCase); -// } -// -// public bool CanParse(IProject project) -// { -// return project.Language == "C#"; -// } -// -// public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent) -// { -// var modelTypeLocater = new RazorCSharpModelTypeLocater(fileContent); -// return new RazorCompilationUnit(projectContent) { -// ModelTypeName = modelTypeLocater.ModelTypeName -// }; -// } -// -// public IResolver CreateResolver() -// { -// return new RazorCSharpResolver(); -// } -// } -//} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpResolver.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpResolver.cs deleted file mode 100644 index 1ce97c8dc5..0000000000 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCSharpResolver.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -//using ICSharpCode.NRefactory.TypeSystem; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCSharpResolver : IResolver -// { -// NRefactoryResolver resolver = new NRefactoryResolver(LanguageProperties.CSharp); -// -// public ResolveResult Resolve(ExpressionResult expressionResult, ParseInformation parseInfo, string fileContent) -// { -// ParseInformation parseInfoWithWebViewPageClass = CreateParseInformationWithWebViewPageClass(parseInfo); -// expressionResult.Region = GetRegionInMiddleOfWebViewPageClass(); -// return resolver.Resolve(expressionResult, parseInfoWithWebViewPageClass, fileContent); -// } -// -// ParseInformation CreateParseInformationWithWebViewPageClass(ParseInformation parseInfo) -// { -// RazorCompilationUnit compilationUnit = RazorCompilationUnit.CreateFromParseInfo(parseInfo); -// AddDefaultUsings(compilationUnit); -// AddWebViewPageClass(compilationUnit); -// return new ParseInformation(compilationUnit); -// } -// -// void AddDefaultUsings(ICompilationUnit compilationUnit) -// { -// AddUsing("System.Web.Mvc", compilationUnit); -// AddUsing("System.Web.Mvc.Ajax", compilationUnit); -// AddUsing("System.Web.Mvc.Html", compilationUnit); -// AddUsing("System.Web.Routing", compilationUnit); -// } -// -// void AddUsing(string name, ICompilationUnit compilationUnit) -// { -// DefaultUsing defaultUsing = CreateUsing(name, compilationUnit.ProjectContent); -// compilationUnit.UsingScope.Usings.Add(defaultUsing); -// } -// -// DefaultUsing CreateUsing(string namespaceName, IProjectContent projectContent) -// { -// var defaultUsing = new DefaultUsing(projectContent); -// defaultUsing.Usings.Add(namespaceName); -// return defaultUsing; -// } -// -// void AddWebViewPageClass(RazorCompilationUnit compilationUnit) -// { -// DefaultClass webViewPageClass = CreateWebViewPageClass(compilationUnit); -// compilationUnit.Classes.Add(webViewPageClass); -// } -// -// DefaultClass CreateWebViewPageClass(RazorCompilationUnit compilationUnit) -// { -// var webViewPageClass = new DefaultClass(compilationUnit, "RazorWebViewPage") { -// Region = new DomRegion(1, 0, 3, 0) -// }; -// IReturnType modelType = GetModelReturnType(compilationUnit); -// AddWebViewPageBaseClass(webViewPageClass, modelType); -// return webViewPageClass; -// } -// -// IReturnType GetModelReturnType(RazorCompilationUnit compilationUnit) -// { -// IClass modelType = GetClassIfTypeNameIsNotEmpty(compilationUnit.ProjectContent, compilationUnit.ModelTypeName); -// if (modelType != null) { -// return modelType.DefaultReturnType; -// } -// return new DynamicReturnType(compilationUnit.ProjectContent); -// } -// -// IClass GetClassIfTypeNameIsNotEmpty(IProjectContent projectContent, string modelTypeName) -// { -// if (!String.IsNullOrEmpty(modelTypeName)) { -// return projectContent.GetClass(modelTypeName, 0); -// } -// return null; -// } -// -// void AddWebViewPageBaseClass(DefaultClass webViewPageClass, IReturnType modelType) -// { -// IClass webViewPageBaseClass = webViewPageClass.ProjectContent.GetClass("System.Web.Mvc.WebViewPage", 1); -// if (webViewPageBaseClass != null) { -// IReturnType returnType = GetWebViewPageBaseClassReturnType(webViewPageBaseClass, modelType); -// webViewPageClass.BaseTypes.Add(returnType); -// } -// } -// -// IReturnType GetWebViewPageBaseClassReturnType(IClass webViewPageBaseClass, IReturnType modelType) -// { -// var typeArguments = new List(); -// typeArguments.Add(modelType); -// return new ConstructedReturnType(webViewPageBaseClass.DefaultReturnType, typeArguments); -// } -// -// DomRegion GetRegionInMiddleOfWebViewPageClass() -// { -// return new DomRegion(2, 0, 2, 0); -// } -// } -//} diff --git a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCompilationUnit.cs b/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCompilationUnit.cs deleted file mode 100644 index 9672f4df56..0000000000 --- a/src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/Completion/RazorCompilationUnit.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory.TypeSystem; -//using ICSharpCode.SharpDevelop.Parser; -// -//namespace ICSharpCode.AspNet.Mvc.Completion -//{ -// public class RazorCompilationUnit : DefaultCompilationUnit -// { -// public RazorCompilationUnit(IProjectContent projectContent) -// : base(projectContent) -// { -// } -// -// public static RazorCompilationUnit CreateFromParseInfo(ParseInformation parseInformation) -// { -// return new RazorCompilationUnit(parseInformation.CompilationUnit.ProjectContent) { -// ModelTypeName = GetModelTypeName(parseInformation.CompilationUnit) -// }; -// } -// -// static string GetModelTypeName(ICompilationUnit compilationUnit) -// { -// var originalRazorCompilationUnit = compilationUnit as RazorCompilationUnit; -// if (originalRazorCompilationUnit != null) { -// return originalRazorCompilationUnit.ModelTypeName; -// } -// return String.Empty; -// } -// -// public string ModelTypeName { get; set; } -// } -//} diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin index c9bea23cba..11db4687c6 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin @@ -115,6 +115,9 @@ + @@ -148,11 +151,11 @@ insertafter = "Highlighting" label = "C#"> @@ -165,7 +168,7 @@ @@ -179,12 +182,9 @@ - - - @@ -224,11 +224,8 @@ - - - @@ -248,7 +245,6 @@ - @@ -283,7 +279,6 @@ - @@ -305,7 +300,6 @@ - @@ -334,18 +328,20 @@ + + + + - - @@ -361,7 +357,6 @@ - @@ -371,7 +366,6 @@ - diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj index dbbd1b7739..848785d6fb 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj @@ -78,6 +78,7 @@ + @@ -91,6 +92,7 @@ CSharpSemanticHighlighter.cs + diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd b/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd index 157dc9e717..3e1bba50c7 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Resources/CSharp-Semantic.xshd @@ -32,7 +32,11 @@ + + + + diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs index 48103a5acf..1139a8a51d 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpLanguageBinding.cs @@ -20,12 +20,18 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; +using System.Reflection; using System.Threading; using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit.Highlighting; using ICSharpCode.NRefactory; +using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory.CSharp.Refactoring; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop.Editor.CodeCompletion; +using ICSharpCode.SharpDevelop.Project; using CSharpBinding.Completion; using CSharpBinding.FormattingStrategy; using CSharpBinding.Refactoring; @@ -49,303 +55,88 @@ namespace CSharpBinding this.container.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), new Microsoft.CSharp.CSharpCodeProvider()); } - public override ICodeCompletionBinding CreateCompletionBinding(FileName fileName, TextLocation currentLocation, ICSharpCode.NRefactory.Editor.ITextSource fileContent) + public override ICodeCompletionBinding CreateCompletionBinding(string expressionToComplete, ICodeContext context) { - if (fileName == null) - throw new ArgumentNullException("fileName"); - return new CSharpCompletionBinding(fileName, currentLocation, fileContent); + if (context == null) + throw new ArgumentNullException("context"); + string content = GeneratePartialClassContextStub(context); + const string caretPoint = "$__Caret_Point__$;"; + int caretOffset = content.IndexOf(caretPoint, StringComparison.Ordinal) + expressionToComplete.Length; + SD.Log.DebugFormatted("context used for dot completion: {0}", content.Replace(caretPoint, "$" + expressionToComplete + "|$")); + var doc = new ReadOnlyDocument(content.Replace(caretPoint, expressionToComplete)); + return new CSharpCompletionBinding(context, doc.GetLocation(caretOffset), doc.CreateSnapshot()); } - } - - public class CSharpTextEditorExtension : ITextEditorExtension - { - ITextEditor editor; - IssueManager inspectionManager; - IList contextActionProviders; - CodeManipulation codeManipulation; - CaretReferenceHighlightRenderer renderer; - CodeEditorFormattingOptionsAdapter options; - TextEditorOptions originalEditorOptions; - - public void Attach(ITextEditor editor) - { - this.editor = editor; - inspectionManager = new IssueManager(editor); - codeManipulation = new CodeManipulation(editor); - renderer = new CaretReferenceHighlightRenderer(editor); - - // Patch editor options (indentation) to project-specific settings - if (!editor.ContextActionProviders.IsReadOnly) { - contextActionProviders = AddInTree.BuildItems("/SharpDevelop/ViewContent/TextEditor/C#/ContextActions", null); - editor.ContextActionProviders.AddRange(contextActionProviders); - } - - // Create instance of options adapter and register it as service - var formattingPolicy = CSharpFormattingPolicies.Instance.GetProjectOptions( - SD.ProjectService.FindProjectContainingFile(editor.FileName)); - options = new CodeEditorFormattingOptionsAdapter(editor.Options, formattingPolicy.OptionsContainer); - var textEditor = editor.GetService(); - if (textEditor != null) { - var textViewServices = textEditor.TextArea.TextView.Services; - - // Unregister any previous ITextEditorOptions instance from editor, if existing, register our impl. - textViewServices.RemoveService(typeof(ITextEditorOptions)); - textViewServices.AddService(typeof(ITextEditorOptions), options); - - // Set TextEditor's options to same object - originalEditorOptions = textEditor.Options; - textEditor.Options = options; - } - } - - public void Detach() - { - var textEditor = editor.GetService(); - if (textEditor != null) { - var textView = textEditor.TextArea.TextView; - - // Unregister our ITextEditorOptions instance from editor - var optionsService = textView.GetService(); - if ((optionsService != null) && (optionsService == options)) - textView.Services.RemoveService(typeof(ITextEditorOptions)); - - // Reset TextEditor options, too? - if ((textEditor.Options != null) && (textEditor.Options == options)) - textEditor.Options = originalEditorOptions; - } - - codeManipulation.Dispose(); - if (inspectionManager != null) { - inspectionManager.Dispose(); - inspectionManager = null; - } - if (contextActionProviders != null) { - editor.ContextActionProviders.RemoveAll(contextActionProviders.Contains); - } - renderer.Dispose(); - options = null; - this.editor = null; - } - } - - class CodeEditorFormattingOptionsAdapter : TextEditorOptions, ITextEditorOptions, ICodeEditorOptions - { - CSharpFormattingOptionsContainer container; - readonly ITextEditorOptions globalOptions; - readonly ICodeEditorOptions globalCodeEditorOptions; - public CodeEditorFormattingOptionsAdapter(ITextEditorOptions globalOptions, CSharpFormattingOptionsContainer container) + static string GeneratePartialClassContextStub(ICodeContext context) { - if (globalOptions == null) - throw new ArgumentNullException("globalOptions"); - if (container == null) - throw new ArgumentNullException("container"); - - this.globalOptions = globalOptions; - this.globalCodeEditorOptions = globalOptions as ICodeEditorOptions; - this.container = container; - - CSharpFormattingPolicies.Instance.FormattingPolicyUpdated += OnFormattingPolicyUpdated; - globalOptions.PropertyChanged += OnGlobalOptionsPropertyChanged; - } - - void OnFormattingPolicyUpdated(object sender, CSharpBinding.FormattingStrategy.CSharpFormattingPolicyUpdateEventArgs e) - { - OnPropertyChanged("IndentationSize"); - OnPropertyChanged("ConvertTabsToSpaces"); - } - - void OnGlobalOptionsPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) - { - OnPropertyChanged(e.PropertyName); - } - - #region ITextEditorOptions implementation - - public override int IndentationSize { - get { - return container.GetEffectiveIndentationSize() ?? globalOptions.IndentationSize; - } - } - - public override bool ConvertTabsToSpaces { - get { - return container.GetEffectiveConvertTabsToSpaces() ?? globalOptions.ConvertTabsToSpaces; - } - } - - public bool AutoInsertBlockEnd { - get { - return globalOptions.AutoInsertBlockEnd; - } - } - - public int VerticalRulerColumn { - get { - return globalOptions.VerticalRulerColumn; - } - } - - public bool UnderlineErrors { - get { - return globalOptions.UnderlineErrors; - } - } - - public string FontFamily { - get { - return globalOptions.FontFamily; - } - } - - public double FontSize { - get { - return globalOptions.FontSize; - } - } - - #endregion - - public override bool AllowScrollBelowDocument { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.AllowScrollBelowDocument : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.AllowScrollBelowDocument = value; - } - } - } - - public bool ShowLineNumbers { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.ShowLineNumbers : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.ShowLineNumbers = value; - } - } - } - - public bool EnableChangeMarkerMargin { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.EnableChangeMarkerMargin : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.EnableChangeMarkerMargin = value; - } - } - } - - public bool WordWrap { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.WordWrap : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.WordWrap = value; - } - } - } - - public bool CtrlClickGoToDefinition { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.CtrlClickGoToDefinition : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.CtrlClickGoToDefinition = value; - } - } - } - - public bool MouseWheelZoom { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.MouseWheelZoom : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.MouseWheelZoom = value; - } - } - } - - public bool HighlightBrackets { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.HighlightBrackets : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.HighlightBrackets = value; + var member = context.CurrentMember; + if (member == null) + return ""; + var builder = new TypeSystemAstBuilder(); + MethodDeclaration decl; + if (member.SymbolKind == SymbolKind.Method) { + // If it's a method, convert it directly (including parameters + type parameters) + decl = (MethodDeclaration)builder.ConvertEntity(member); + } else { + // Otherwise, create a method anyways, and copy the parameters + decl = new MethodDeclaration(); + if (member is IParameterizedMember) { + foreach (var p in ((IParameterizedMember)member).Parameters) { + decl.Parameters.Add(builder.ConvertParameter(p)); + } } } + decl.Name = "__DebuggerStub__"; + decl.ReturnType = builder.ConvertType(member.ReturnType); + decl.Modifiers = member.IsStatic ? Modifiers.Static : Modifiers.None; + // Make the method look like an explicit interface implementation so that it doesn't appear in CC + decl.PrivateImplementationType = new SimpleType("__DummyType__"); + decl.Body = GenerateBodyFromContext(builder, context.LocalVariables.ToArray()); + return WrapInType(context.CurrentTypeDefinition, decl).ToString(); } - public bool HighlightSymbol { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.HighlightSymbol : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.HighlightSymbol = value; - } - } - } - - public bool EnableAnimations { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.EnableAnimations : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.EnableAnimations = value; - } - } - } - - public bool UseSmartIndentation { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.UseSmartIndentation : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.UseSmartIndentation = value; - } - } - } - - public bool EnableFolding { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.EnableFolding : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.EnableFolding = value; - } - } + static BlockStatement GenerateBodyFromContext(TypeSystemAstBuilder builder, IVariable[] variables) + { + var body = new BlockStatement(); + foreach (var v in variables) + body.Statements.Add(new VariableDeclarationStatement(builder.ConvertType(v.Type), v.Name)); + body.Statements.Add(new ExpressionStatement(new IdentifierExpression("$__Caret_Point__$"))); + return body; } - public bool EnableQuickClassBrowser { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.EnableQuickClassBrowser : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.EnableQuickClassBrowser = value; + static AstNode WrapInType(ITypeDefinition entity, EntityDeclaration decl) + { + if (entity == null) + return decl; + // Wrap decl in TypeDeclaration + decl = new TypeDeclaration { + ClassType = GetClassType(entity), + Modifiers = Modifiers.Partial, + Name = entity.Name, + Members = { decl } + }; + if (entity.DeclaringTypeDefinition != null) { + // Handle nested types + return WrapInType(entity.DeclaringTypeDefinition, decl); + } + if (string.IsNullOrEmpty(entity.Namespace)) + return decl; + return new NamespaceDeclaration(entity.Namespace) { + Members = { + decl } - } + }; } - public bool ShowHiddenDefinitions { - get { - return (globalCodeEditorOptions != null) ? globalCodeEditorOptions.ShowHiddenDefinitions : default(bool); - } - set { - if (globalCodeEditorOptions != null) { - globalCodeEditorOptions.ShowHiddenDefinitions = value; - } + static ClassType GetClassType(ITypeDefinition entity) + { + switch (entity.Kind) { + case TypeKind.Interface: + return ClassType.Interface; + case TypeKind.Struct: + return ClassType.Struct; + default: + return ClassType.Class; } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs index 8e4765c939..f50df9abb3 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighterVisitor.cs @@ -58,10 +58,10 @@ namespace CSharpBinding //this.defaultTextColor = ???; this.referenceTypeColor = highlighting.GetNamedColor("ReferenceTypes"); this.valueTypeColor = highlighting.GetNamedColor("ValueTypes"); - this.interfaceTypeColor = this.referenceTypeColor; - this.enumerationTypeColor = this.valueKeywordColor; - this.typeParameterTypeColor = this.referenceTypeColor; - this.delegateTypeColor = this.referenceTypeColor; + this.interfaceTypeColor = highlighting.GetNamedColor("InterfaceTypes"); + this.enumerationTypeColor = highlighting.GetNamedColor("EnumTypes"); + this.typeParameterTypeColor = highlighting.GetNamedColor("TypeParameters"); + this.delegateTypeColor = highlighting.GetNamedColor("DelegateType"); this.methodDeclarationColor = this.methodCallColor = highlighting.GetNamedColor("MethodCall"); //this.eventDeclarationColor = this.eventAccessColor = defaultTextColor; //this.propertyDeclarationColor = this.propertyAccessColor = defaultTextColor; diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpTextEditorExtension.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpTextEditorExtension.cs new file mode 100644 index 0000000000..f308877041 --- /dev/null +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpTextEditorExtension.cs @@ -0,0 +1,253 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using ICSharpCode.AvalonEdit; +using CSharpBinding.FormattingStrategy; +using CSharpBinding.Refactoring; +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Editor; +using ICSharpCode.SharpDevelop.Refactoring; +namespace CSharpBinding +{ + public class CSharpTextEditorExtension : ITextEditorExtension + { + ITextEditor editor; + + IssueManager inspectionManager; + + IList contextActionProviders; + + CodeManipulation codeManipulation; + + CaretReferenceHighlightRenderer renderer; + + CodeEditorFormattingOptionsAdapter options; + + TextEditorOptions originalEditorOptions; + + public void Attach(ITextEditor editor) + { + this.editor = editor; + inspectionManager = new IssueManager(editor); + codeManipulation = new CodeManipulation(editor); + renderer = new CaretReferenceHighlightRenderer(editor); + + // Patch editor options (indentation) to project-specific settings + if (!editor.ContextActionProviders.IsReadOnly) { + contextActionProviders = AddInTree.BuildItems("/SharpDevelop/ViewContent/TextEditor/C#/ContextActions", null); + editor.ContextActionProviders.AddRange(contextActionProviders); + } + + // Create instance of options adapter and register it as service + var formattingPolicy = CSharpFormattingPolicies.Instance.GetProjectOptions(SD.ProjectService.FindProjectContainingFile(editor.FileName)); + var textEditor = editor.GetService(); + + if (textEditor != null) { + options = new CodeEditorFormattingOptionsAdapter(textEditor.Options, editor.Options, formattingPolicy.OptionsContainer); + var textViewServices = textEditor.TextArea.TextView.Services; + + // Unregister any previous ITextEditorOptions instance from editor, if existing, register our impl. + textViewServices.RemoveService(typeof(ITextEditorOptions)); + textViewServices.AddService(typeof(ITextEditorOptions), options); + + // Set TextEditor's options to same object + originalEditorOptions = textEditor.Options; + textEditor.Options = options.TextEditorOptions; + } + } + + public void Detach() + { + var textEditor = editor.GetService(); + if (textEditor != null) { + var textView = textEditor.TextArea.TextView; + // Unregister our ITextEditorOptions instance from editor + var optionsService = textView.GetService(); + if ((optionsService != null) && (optionsService == options)) + textView.Services.RemoveService(typeof(ITextEditorOptions)); + // Reset TextEditor options, too? + if ((textEditor.Options != null) && (textEditor.Options == options.TextEditorOptions)) + textEditor.Options = originalEditorOptions; + } + + codeManipulation.Dispose(); + + if (inspectionManager != null) { + inspectionManager.Dispose(); + inspectionManager = null; + } + + if (contextActionProviders != null) { + editor.ContextActionProviders.RemoveAll(contextActionProviders.Contains); + } + + renderer.Dispose(); + options = null; + this.editor = null; + } + } + + class CodeEditorFormattingOptionsAdapter : ITextEditorOptions, INotifyPropertyChanged + { + CSharpFormattingOptionsContainer container; + readonly TextEditorOptions avalonEditOptions; + readonly TextEditorOptions originalAvalonEditOptions; + readonly ITextEditorOptions originalSDOptions; + + public CodeEditorFormattingOptionsAdapter(TextEditorOptions originalAvalonEditOptions, ITextEditorOptions originalSDOptions, CSharpFormattingOptionsContainer container) + { + if (originalAvalonEditOptions == null) + throw new ArgumentNullException("originalAvalonEditOptions"); + if (originalSDOptions == null) + throw new ArgumentNullException("originalSDOptions"); + if (container == null) + throw new ArgumentNullException("container"); + + this.originalAvalonEditOptions = originalAvalonEditOptions; + this.avalonEditOptions = new TextEditorOptions(originalAvalonEditOptions); + this.originalSDOptions = originalSDOptions; + this.container = container; + + // Update overridden options once + UpdateOverriddenProperties(); + + CSharpFormattingPolicies.Instance.FormattingPolicyUpdated += OnFormattingPolicyUpdated; + this.originalAvalonEditOptions.PropertyChanged += OnOrigAvalonOptionsPropertyChanged; + this.originalSDOptions.PropertyChanged += OnSDOptionsPropertyChanged; + } + + void OnFormattingPolicyUpdated(object sender, CSharpBinding.FormattingStrategy.CSharpFormattingPolicyUpdateEventArgs e) + { + // Update editor options from changed policy + UpdateOverriddenProperties(); + + OnPropertyChanged("IndentationSize"); + OnPropertyChanged("IndentationString"); + OnPropertyChanged("ConvertTabsToSpaces"); + } + + void UpdateOverriddenProperties() + { + avalonEditOptions.IndentationSize = container.GetEffectiveIndentationSize() ?? originalSDOptions.IndentationSize; + avalonEditOptions.ConvertTabsToSpaces = container.GetEffectiveConvertTabsToSpaces() ?? originalSDOptions.ConvertTabsToSpaces; + } + + void OnOrigAvalonOptionsPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if ((e.PropertyName != "IndentationSize") && (e.PropertyName != "IndentationString") && (e.PropertyName != "ConvertTabsToSpaces")) { + // Update values in our own TextEditorOptions instance + PropertyInfo propertyInfo = typeof(TextEditorOptions).GetProperty(e.PropertyName); + if (propertyInfo != null) { + propertyInfo.SetValue(avalonEditOptions, propertyInfo.GetValue(originalAvalonEditOptions)); + } + } else { + UpdateOverriddenProperties(); + } + OnPropertyChanged(e.PropertyName); + } + + void OnSDOptionsPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + OnPropertyChanged(e.PropertyName); + } + + public event PropertyChangedEventHandler PropertyChanged; + + void OnPropertyChanged(string propertyName) + { + if (PropertyChanged != null) { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public ICSharpCode.AvalonEdit.TextEditorOptions TextEditorOptions + { + get { + return avalonEditOptions; + } + } + + #region Overridden properties + + public int IndentationSize { + get { + // Get value from own TextEditorOptions instance + return avalonEditOptions.IndentationSize; + } + } + + public string IndentationString { + get { + // Get value from own TextEditorOptions instance + return avalonEditOptions.IndentationString; + } + } + + public bool ConvertTabsToSpaces { + get { + // Get value from own TextEditorOptions instance + return avalonEditOptions.ConvertTabsToSpaces; + } + } + + #endregion + + #region Rest of ITextEditorOptions implementation + + public bool AutoInsertBlockEnd { + get { + return originalSDOptions.AutoInsertBlockEnd; + } + } + + public int VerticalRulerColumn { + get { + return originalSDOptions.VerticalRulerColumn; + } + } + + public bool UnderlineErrors { + get { + return originalSDOptions.UnderlineErrors; + } + } + + public string FontFamily { + get { + return originalSDOptions.FontFamily; + } + } + + public double FontSize { + get { + return originalSDOptions.FontSize; + } + } + + #endregion + + } +} + + diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs index c81f2b3349..69cba35ecd 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs @@ -18,13 +18,13 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using ICSharpCode.Core; using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.Completion; -using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp.Completion; using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; @@ -37,7 +37,7 @@ namespace CSharpBinding.Completion { public class CSharpCompletionBinding : ICodeCompletionBinding { - FileName contextFileName; + ICodeContext context; TextLocation currentLocation; ITextSource fileContent; @@ -46,9 +46,9 @@ namespace CSharpBinding.Completion { } - public CSharpCompletionBinding(FileName contextFileName, TextLocation currentLocation, ITextSource fileContent) + public CSharpCompletionBinding(ICodeContext context, TextLocation currentLocation, ITextSource fileContent) { - this.contextFileName = contextFileName; + this.context = context; this.currentLocation = currentLocation; this.fileContent = fileContent; } @@ -77,7 +77,7 @@ namespace CSharpBinding.Completion if (fileContent == null) { completionContext = CSharpCompletionContext.Get(editor); } else { - completionContext = CSharpCompletionContext.Get(editor, fileContent, currentLocation, contextFileName); + completionContext = CSharpCompletionContext.Get(editor, context, currentLocation, fileContent); } if (completionContext == null) return false; @@ -116,6 +116,7 @@ namespace CSharpBinding.Completion } else { startPos = caretOffset; if (char.IsLetterOrDigit (completionChar) || completionChar == '_') { + if (!CodeCompletionOptions.CompleteWhenTyping) return false; if (startPos > 1 && char.IsLetterOrDigit (completionContext.Document.GetCharAt (startPos - 2))) return false; completionData = cce.GetCompletionData(startPos, false); @@ -129,7 +130,7 @@ namespace CSharpBinding.Completion DefaultCompletionItemList list = new DefaultCompletionItemList(); list.Items.AddRange(FilterAndAddTemplates(editor, completionData.Cast().ToList())); - if (list.Items.Count > 0) { + if (list.Items.Count > 0 && (ctrlSpace || cce.AutoCompleteEmptyMatch)) { list.SortItems(); list.PreselectionLength = caretOffset - startPos; list.PostselectionLength = Math.Max(0, startPos + triggerWordLength - caretOffset); @@ -138,7 +139,7 @@ namespace CSharpBinding.Completion return true; } - if (!ctrlSpace) { + if (CodeCompletionOptions.InsightEnabled && !ctrlSpace) { // Method Insight var pce = new CSharpParameterCompletionEngine( completionContext.Document, diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs index 7d45f6f541..2f4623dcf7 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs @@ -17,17 +17,19 @@ // DEALINGS IN THE SOFTWARE. using System; +using System.Collections.Generic; using System.Diagnostics; +using System.IO; using ICSharpCode.Core; using ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Editor; -using ICSharpCode.SharpDevelop.Project; -using CSharpBinding.Parser; +using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp.Completion; using ICSharpCode.NRefactory.CSharp.TypeSystem; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Editor; +using CSharpBinding.Parser; namespace CSharpBinding.Completion { @@ -35,7 +37,7 @@ namespace CSharpBinding.Completion { public readonly ITextEditor Editor; public readonly IDocument Document; - public readonly CSharpFullParseInformation ParseInformation; + public readonly IList ConditionalSymbols; public readonly ICompilation Compilation; public readonly IProjectContent ProjectContent; public readonly CSharpTypeResolveContext TypeResolveContextAtCaret; @@ -56,40 +58,44 @@ namespace CSharpBinding.Completion if (projectContent == null) return null; - return new CSharpCompletionContext(editor, parseInfo, compilation, projectContent, editor.Document, editor.Caret.Location); + return new CSharpCompletionContext(editor, parseInfo.SyntaxTree.ConditionalSymbols, compilation, projectContent, editor.Document, parseInfo.UnresolvedFile, editor.Caret.Location); } - public static CSharpCompletionContext Get(ITextEditor editor, ITextSource fileContent, TextLocation currentLocation, FileName fileName) + public static CSharpCompletionContext Get(ITextEditor editor, ICodeContext context, TextLocation currentLocation, ITextSource fileContent) { IDocument document = new ReadOnlyDocument(fileContent); - // Don't require the very latest parse information, an older cached version is OK. - var parseInfo = SD.ParserService.Parse(fileName, document) as CSharpFullParseInformation; - if (parseInfo == null) - return null; - - ICompilation compilation = SD.ParserService.GetCompilationForFile(fileName); - var projectContent = compilation.MainAssembly.UnresolvedAssembly as IProjectContent; + var projectContent = context.Compilation.MainAssembly.UnresolvedAssembly as IProjectContent; if (projectContent == null) return null; - return new CSharpCompletionContext(editor, parseInfo, compilation, projectContent, document, currentLocation); + CSharpParser parser = new CSharpParser(); + parser.GenerateTypeSystemMode = false; + + SyntaxTree cu = parser.Parse(fileContent, Path.GetRandomFileName() + ".cs"); + cu.Freeze(); + + CSharpUnresolvedFile unresolvedFile = cu.ToTypeSystem(); + ICompilation compilation = projectContent.AddOrUpdateFiles(unresolvedFile).CreateCompilation(SD.ParserService.GetCurrentSolutionSnapshot()); + + return new CSharpCompletionContext(editor, EmptyList.Instance, compilation, projectContent, document, unresolvedFile, currentLocation); } - private CSharpCompletionContext(ITextEditor editor, CSharpFullParseInformation parseInfo, ICompilation compilation, IProjectContent projectContent, IDocument document, TextLocation caretLocation) + private CSharpCompletionContext(ITextEditor editor, IList conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, CSharpUnresolvedFile unresolvedFile, TextLocation caretLocation) { Debug.Assert(editor != null); - Debug.Assert(parseInfo != null); + Debug.Assert(unresolvedFile != null); Debug.Assert(compilation != null); Debug.Assert(projectContent != null); Debug.Assert(document != null); this.Editor = editor; this.Document = document; - this.ParseInformation = parseInfo; + this.ConditionalSymbols = conditionalSymbols; this.Compilation = compilation; this.ProjectContent = projectContent; - this.TypeResolveContextAtCaret = parseInfo.UnresolvedFile.GetTypeResolveContext(compilation, caretLocation); - this.CompletionContextProvider = new DefaultCompletionContextProvider(document, parseInfo.UnresolvedFile); + this.TypeResolveContextAtCaret = unresolvedFile.GetTypeResolveContext(compilation, caretLocation); + this.CompletionContextProvider = new DefaultCompletionContextProvider(document, unresolvedFile); + this.CompletionContextProvider.ConditionalSymbols.AddRange(conditionalSymbols); } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs index 8fbfc7e3f7..9396dc084c 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionDataFactory.cs @@ -86,8 +86,7 @@ namespace CSharpBinding.Completion ICompletionData ICompletionDataFactory.CreateMemberCompletionData(IType type, IEntity member) { - string typeName = builder.ConvertType(type).ToString(); - return new CompletionData(typeName + "." + member.Name); + return new EnumMemberCompletionData(type, member, builder); } ICompletionData ICompletionDataFactory.CreateLiteralCompletionData(string title, string description, string insertText) @@ -148,7 +147,7 @@ namespace CSharpBinding.Completion IEnumerable ICompletionDataFactory.CreatePreProcessorDefinesCompletionData() { - return completionContext.ParseInformation.SyntaxTree.ConditionalSymbols.Select(def => new CompletionData(def)); + return completionContext.ConditionalSymbols.Select(def => new CompletionData(def)); } ICompletionData ICompletionDataFactory.CreateImportCompletionData(IType type, bool useFullName, bool addForTypeCreation) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpMethodInsight.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpMethodInsight.cs index 33b42b37bd..8fb08c9316 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpMethodInsight.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpMethodInsight.cs @@ -50,7 +50,9 @@ namespace CSharpBinding.Completion public void Show() { window = editor.ShowInsightWindow(items); - window.StartOffset = startOffset; + // Set startOffset so that window always appears below the caret line + var startLocation = editor.Document.GetLocation(startOffset); + window.StartOffset = editor.Document.GetOffset(editor.Caret.Line, startLocation.Column); // closing the window at the end of the parameter list is handled by the CaretPositionChanged event window.EndOffset = editor.Document.TextLength; if (initiallySelectedItem != null) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CompletionData.cs index 7c04f56b9f..d717ebaf7b 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CompletionData.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CompletionData.cs @@ -78,13 +78,14 @@ namespace CSharpBinding.Completion public IImage Image { get; set; } public virtual double Priority { - get { return 0; } + get { return CodeCompletionDataUsageCache.GetPriority(DisplayText, true); } } public virtual void Complete(CompletionContext context) { context.Editor.Document.Replace(context.StartOffset, context.Length, this.CompletionText); context.EndOffset = context.StartOffset + this.CompletionText.Length; + CodeCompletionDataUsageCache.IncrementUsage(DisplayText); } object fancyContent; diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs index 65ea84fc1b..16d627ef43 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EntityCompletionData.cs @@ -37,14 +37,15 @@ namespace CSharpBinding.Completion public EntityCompletionData(IEntity entity) : base(entity.Name) { this.entity = entity; - this.Description = entity.Documentation; this.Image = ClassBrowserIconService.GetIcon(entity); + // don't set this.Description -- we use CreateFancyDescription() instead, + // and accessing entity.Documentation in the constructor is too slow } protected override object CreateFancyDescription() { return new FlowDocumentScrollViewer { - Document = XmlDocFormatter.CreateTooltip(entity, false), + Document = XmlDocFormatter.CreateTooltip(entity, entity is ITypeDefinition), VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs new file mode 100644 index 0000000000..9d0b2c9d33 --- /dev/null +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EnumMemberCompletionData.cs @@ -0,0 +1,52 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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.Linq; +using System.Windows.Controls; +using ICSharpCode.NRefactory.CSharp.Refactoring; +using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Editor; +namespace CSharpBinding.Completion +{ + class EnumMemberCompletionData : CompletionData + { + IType enumType; + + IEntity member; + + public EnumMemberCompletionData(IType enumType, IEntity member, TypeSystemAstBuilder builder) : base(enumType.Name + "." + member.Name) + { + this.enumType = enumType; + this.member = member; + this.Image = ClassBrowserIconService.Const; + this.CompletionText = builder.ConvertType(enumType).ToString() + "." + member.Name; + } + + protected override object CreateFancyDescription() + { + return new FlowDocumentScrollViewer { + Document = XmlDocFormatter.CreateTooltip(member, false), + VerticalScrollBarVisibility = ScrollBarVisibility.Auto + }; + } + } +} + + diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs index 01ab271a64..f5cbfad2df 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/EventCreationCompletionData.cs @@ -19,14 +19,15 @@ using System; using System.Linq; using System.Threading; -using ICSharpCode.SharpDevelop; -using CSharpBinding.Parser; -using CSharpBinding.Refactoring; +using ICSharpCode.Core; using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp.Refactoring; using ICSharpCode.NRefactory.CSharp.Resolver; using ICSharpCode.NRefactory.TypeSystem; +using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Editor.CodeCompletion; +using CSharpBinding.Parser; +using CSharpBinding.Refactoring; namespace CSharpBinding.Completion { @@ -35,46 +36,27 @@ namespace CSharpBinding.Completion /// class EventCreationCompletionData : CompletionData { - IEvent eventDefinition; - string varName; - IType delegateType; - string parameterList; - IUnresolvedMember callingMember; - IUnresolvedTypeDefinition declaringType; - CSharpResolver contextAtCaret; + readonly string handlerName; + readonly ITypeReference delegateTypeReference; + readonly bool isStatic; - public EventCreationCompletionData(string varName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret) + public EventCreationCompletionData(string handlerName, IType delegateType, IEvent evt, string parameterList, IUnresolvedMember callingMember, IUnresolvedTypeDefinition declaringType, CSharpResolver contextAtCaret) { - if (string.IsNullOrEmpty(varName)) { - this.DisplayText = ""; + if (string.IsNullOrEmpty(handlerName)) { + handlerName = (evt != null ? evt.Name : "Handle"); } - else { - this.DisplayText = "Handle" + char.ToUpper(varName[0]) + varName.Substring(1) + (evt != null ? evt.Name : ""); - } - - this.varName = varName; - this.eventDefinition = evt; - this.delegateType = delegateType; - this.parameterList = parameterList; - this.callingMember = callingMember; - this.declaringType = declaringType; - this.contextAtCaret = contextAtCaret; + this.handlerName = handlerName; + this.DisplayText = StringParser.Parse("${res:CSharpBinding.Refactoring.EventCreation.EventHandlerText}", new[] { new StringTagPair("HandlerName", handlerName) }); + this.delegateTypeReference = delegateType.ToTypeReference(); + this.isStatic = callingMember != null && callingMember.IsStatic; } public override void Complete(CompletionContext context) { - var invokeSignature = delegateType.GetMethods(m => m.Name == "Invoke").Single(); var refactoringContext = SDRefactoringContext.Create(context.Editor, CancellationToken.None); + var delegateType = delegateTypeReference.Resolve(refactoringContext.Compilation); + var invokeSignature = delegateType.GetMethods(m => m.Name == "Invoke").Single(); var builder = refactoringContext.CreateTypeSystemAstBuilder(); - string handlerName; - bool isStatic; - if (eventDefinition != null) { - handlerName = eventDefinition.Name; - isStatic = eventDefinition.IsStatic; - } else { - handlerName = varName; - isStatic = callingMember.IsStatic; - } var throwStatement = new ThrowStatement(); var decl = new MethodDeclaration { diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs index e2351811c4..a60836e910 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/TypeCompletionData.cs @@ -35,16 +35,15 @@ namespace CSharpBinding.Completion public TypeCompletionData(IType type) : base(type.Name) { this.type = type; - ITypeDefinition typeDef = type.GetDefinition(); - if (typeDef != null) - this.Description = typeDef.Documentation; this.Image = ClassBrowserIconService.GetIcon(type); + // don't set this.Description -- we use CreateFancyDescription() instead, + // and accessing entity.Documentation in the constructor is too slow } protected override object CreateFancyDescription() { return new FlowDocumentScrollViewer { - Document = XmlDocFormatter.CreateTooltip(type, false), + Document = XmlDocFormatter.CreateTooltip(type), VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs index 723ef18697..3b01520eb9 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs @@ -37,14 +37,19 @@ namespace CSharpBinding public static class ExtensionMethods { public static TextEditorOptions ToEditorOptions(this ITextEditor editor) + { + return ToEditorOptions(editor.Options); + } + + public static TextEditorOptions ToEditorOptions(this ITextEditorOptions options) { return new TextEditorOptions { - TabsToSpaces = editor.Options.ConvertTabsToSpaces, - TabSize = editor.Options.IndentationSize, - IndentSize = editor.Options.IndentationSize, - ContinuationIndent = editor.Options.IndentationSize, - LabelIndent = -editor.Options.IndentationSize, - WrapLineLength = editor.Options.VerticalRulerColumn, + TabsToSpaces = options.ConvertTabsToSpaces, + TabSize = options.IndentationSize, + IndentSize = options.IndentationSize, + ContinuationIndent = options.IndentationSize, + LabelIndent = -options.IndentationSize, + WrapLineLength = options.VerticalRulerColumn }; } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormatter.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormatter.cs index 65bec18aca..92be04e150 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormatter.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormatter.cs @@ -31,11 +31,17 @@ namespace CSharpBinding.FormattingStrategy /// public static void Format(ITextEditor editor, int offset, int length, CSharpFormattingOptionsContainer optionsContainer) { + SyntaxTree syntaxTree = SyntaxTree.Parse(editor.Document); + if (syntaxTree.Errors.Count > 0) { + // Don't format files containing syntax errors! + return; + } + TextEditorOptions editorOptions = editor.ToEditorOptions(); optionsContainer.CustomizeEditorOptions(editorOptions); var formatter = new CSharpFormatter(optionsContainer.GetEffectiveOptions(), editorOptions); formatter.AddFormattingRegion(new DomRegion(editor.Document.GetLocation(offset), editor.Document.GetLocation(offset + length))); - var changes = formatter.AnalyzeFormatting(editor.Document, SyntaxTree.Parse(editor.Document)); + var changes = formatter.AnalyzeFormatting(editor.Document, syntaxTree); changes.ApplyChanges(offset, length); } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs index 2ab802e950..33cf62c387 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingStrategy.cs @@ -94,7 +94,10 @@ namespace CSharpBinding.FormattingStrategy convertTabsToSpaces = effectiveConvertTabsToSpaces.Value; } - return ICSharpCode.AvalonEdit.TextEditorOptions.GetIndentationString(1, indentationSize, convertTabsToSpaces); + if (convertTabsToSpaces) + return new string(' ', indentationSize); + else + return "\t"; } /* NR indent engine (temporarily?) disabled as per #447 diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs index b36677c142..feaeb1c39e 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/FormattingOptionBinding.cs @@ -22,6 +22,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.SharpDevelop; using CSharpBinding.OptionPanels; namespace CSharpBinding.FormattingStrategy @@ -143,9 +144,8 @@ namespace CSharpBinding.FormattingStrategy static void FillBoolComboValues(ComboBox comboBox) { - // TODO Add located resources! - comboBox.Items.Add(new ComboBoxItem { Content = "Yes", Tag = true }); - comboBox.Items.Add(new ComboBoxItem { Content = "No", Tag = false }); + comboBox.Items.Add(new ComboBoxItem { Content = SD.ResourceService.GetString("Global.Yes"), Tag = true }); + comboBox.Items.Add(new ComboBoxItem { Content = SD.ResourceService.GetString("Global.No"), Tag = false }); } static void FillIntComboValues(ComboBox comboBox) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs index 5045d6fc8f..6b68df5d3c 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs @@ -297,9 +297,14 @@ namespace CSharpBinding.FormsDesigner void CreateField(CodeMemberField newField) { - // insert new field below InitializeComponents() - - var bodyRegion = initializeComponents.BodyRegion; + // insert new field below the last field or InitializeComponents() + IField field = null; + if (formClass != null) { + field = formClass.Fields.LastOrDefault(f => string.Equals(f.Region.FileName, + initializeComponents.Region.FileName, + StringComparison.OrdinalIgnoreCase)); + } + var bodyRegion = field != null ? field.BodyRegion : initializeComponents.BodyRegion; DocumentScript script = GetScript(bodyRegion.FileName); string newline = DocumentUtilities.GetLineTerminator(script.OriginalDocument, bodyRegion.BeginLine); string indentation = DocumentUtilities.GetIndentation(script.OriginalDocument, bodyRegion.BeginLine); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs index b7c635c055..981092adf9 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs @@ -24,10 +24,14 @@ using System.Reflection; using System.Windows.Threading; using ICSharpCode.Core; using ICSharpCode.FormsDesigner.Gui.OptionPanels; +using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.CSharp; +using ICSharpCode.NRefactory.Editor; using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.SharpDevelop.Editor; +using ICSharpCode.SharpDevelop.Project; +using ICSharpCode.SharpDevelop.Refactoring; using CSharpBinding.Refactoring; namespace CSharpBinding.FormsDesigner @@ -144,18 +148,28 @@ namespace CSharpBinding.FormsDesigner var primary = loader.GetPrimaryTypeDefinition(); var evtHandler = primary.GetMethods(m => m.Name == methodName, GetMemberOptions.IgnoreInheritedMembers).FirstOrDefault(); if (evtHandler == null) { - generator.InsertEventHandler(primary, methodName, evt, true); - } - else { + var insertionType = GeneralOptionsPanel.InsertTodoComment ? InsertEventHandlerBodyKind.TodoComment : InsertEventHandlerBodyKind.Nothing; + generator.InsertEventHandler(primary, methodName, evt, true, insertionType); + } else { CSharpBinding.Parser.CSharpFullParseInformation parseInfo; var node = evtHandler.GetDeclaration(out parseInfo) as MethodDeclaration; + var fileName = new FileName(evtHandler.Region.FileName); + var fileContentFinder = new ParseableFileContentFinder(); + if (node != null && !node.Body.IsNull) { var location = node.Body.FirstChild.StartLocation; var firstStatement = node.Body.Children.OfType().FirstOrDefault(); - if (firstStatement != null) + + if (firstStatement == null) { + var fileContent = fileContentFinder.Create(fileName); + var document = new ReadOnlyDocument(fileContent); + var offset = document.GetOffset(new TextLocation(location.Line + 1, 1)); + var length = DocumentUtilities.GetWhitespaceAfter(fileContent, offset).Length; + location = new TextLocation(location.Line + 1, length + 1); + } else { location = firstStatement.StartLocation; - // TODO : does not jump correctly... - SD.FileService.JumpToFilePosition(new FileName(evtHandler.Region.FileName), location.Line, location.Column); + } + SD.FileService.JumpToFilePosition(fileName, location.Line, location.Column); } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs index dadf5f5a5a..97e2ebff6a 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs @@ -31,6 +31,7 @@ namespace CSharpBinding.FormsDesigner CSharpFullParseInformation GetPrimaryFileParseInformation(); ICompilation GetCompilation(); IDocument GetDocument(FileName fileName); + /// if lineNumber = 0 no jump is performed, but the active view content changes. void ShowSourceCode(int lineNumber = 0); } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs index afcd34aff9..6d21e0bb23 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs @@ -24,6 +24,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; +using ICSharpCode.NRefactory.Analysis; using CSharpBinding.Parser; using ICSharpCode.AvalonEdit.Document; using ICSharpCode.AvalonEdit.Highlighting; @@ -51,27 +52,46 @@ namespace CSharpBinding /// public class CSharpSymbolSearch : ISymbolSearch { - IProject project; - ICompilation compilation; - FindReferences fr = new FindReferences(); - IList searchScopes; - IList[] interestingFileNames; - int workAmount; - double workAmountInverse; + readonly IProject project; + readonly ICompilation compilation; + readonly FindReferences fr = new FindReferences(); + readonly IList searchScopes; + readonly Dictionary> searchScopesPerFile; + readonly int workAmount; + readonly double workAmountInverse; public CSharpSymbolSearch(IProject project, ISymbol entity) { this.project = project; - searchScopes = fr.GetSearchScopes(entity); compilation = SD.ParserService.GetCompilation(project); - interestingFileNames = new IList[searchScopes.Count]; + var relatedSymbols = GetRelatedSymbols(entity); + if ((relatedSymbols != null) && relatedSymbols.Any()) { + searchScopes = relatedSymbols.SelectMany(e => fr.GetSearchScopes(e)).ToList(); + } else { + searchScopes = fr.GetSearchScopes(entity); + } + + searchScopesPerFile = new Dictionary>(); for (int i = 0; i < searchScopes.Count; i++) { - interestingFileNames[i] = fr.GetInterestingFiles(searchScopes[i], compilation).Select(f => f.FileName).ToList(); - workAmount += interestingFileNames[i].Count; + var thisSearchScope = searchScopes[i]; + var interestingFiles = fr.GetInterestingFiles(thisSearchScope, compilation).Select(f => f.FileName); + foreach (var file in interestingFiles) { + if (!searchScopesPerFile.ContainsKey(file)) + searchScopesPerFile[file] = new List(); + searchScopesPerFile[file].Add(thisSearchScope); + workAmount++; + } } workAmountInverse = 1.0 / workAmount; } + IEnumerable GetRelatedSymbols(ISymbol entity) + { + var typeGraph = new Lazy(() => new TypeGraph(new [] { compilation.MainAssembly })); + var symbolCollector = new SymbolCollector(); + return symbolCollector.GetRelatedSymbols(typeGraph, entity); + } + public double WorkAmount { get { return workAmount; } } @@ -83,38 +103,36 @@ namespace CSharpBinding var cancellationToken = args.ProgressMonitor.CancellationToken; return Task.Run( () => { - for (int i = 0; i < searchScopes.Count; i++) { - IFindReferenceSearchScope searchScope = searchScopes[i]; - object progressLock = new object(); - Parallel.ForEach( - interestingFileNames[i], - new ParallelOptions { - MaxDegreeOfParallelism = Environment.ProcessorCount, - CancellationToken = cancellationToken - }, - delegate (string fileName) { - try { - FindReferencesInFile(args, searchScope, FileName.Create(fileName), callback, cancellationToken); - } catch (OperationCanceledException) { - throw; - } catch (Exception ex) { - throw new ApplicationException("Error searching in file '" + fileName + "'", ex); - } - lock (progressLock) - args.ProgressMonitor.Progress += workAmountInverse; - }); - } + object progressLock = new object(); + Parallel.ForEach( + searchScopesPerFile.Keys, + new ParallelOptions { + MaxDegreeOfParallelism = Environment.ProcessorCount, + CancellationToken = cancellationToken + }, + delegate (string fileName) { + try { + FindReferencesInFile(args, searchScopesPerFile[fileName], FileName.Create(fileName), callback, cancellationToken); + } catch (OperationCanceledException) { + throw; + } catch (Exception ex) { + throw new ApplicationException("Error searching in file '" + fileName + "'", ex); + } + lock (progressLock) + args.ProgressMonitor.Progress += workAmountInverse; + }); }, cancellationToken ); } - void FindReferencesInFile(SymbolSearchArgs args, IFindReferenceSearchScope searchScope, FileName fileName, Action callback, CancellationToken cancellationToken) + void FindReferencesInFile(SymbolSearchArgs args, IList searchScopeList, FileName fileName, Action callback, CancellationToken cancellationToken) { ITextSource textSource = args.ParseableFileContentFinder.Create(fileName); if (textSource == null) return; - if (searchScope.SearchTerm != null) { - if (textSource.IndexOf(searchScope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) < 0) + if (searchScopeList != null) { + if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any( + scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0))) return; } @@ -134,7 +152,7 @@ namespace CSharpBinding } fr.FindReferencesInFile( - searchScope, unresolvedFile, parseInfo.SyntaxTree, compilation, + searchScopeList, unresolvedFile, parseInfo.SyntaxTree, compilation, delegate (AstNode node, ResolveResult result) { if (document == null) { document = new ReadOnlyDocument(textSource, fileName); @@ -154,8 +172,18 @@ namespace CSharpBinding if (highlighter != null) { highlighter.Dispose(); } - if (results.Count > 0) - callback(new SearchedFile(fileName, results)); + if (results.Count > 0) { + // Remove overlapping results + List fixedResults = new List(); + int lastEndOffset = 0; + foreach (var result in results.OrderBy(m => m.StartOffset)) { + if (result.StartOffset >= lastEndOffset) { + fixedResults.Add(result); + lastEndOffset = result.EndOffset; + } + } + callback(new SearchedFile(fileName, fixedResults)); + } } public Task RenameAsync(SymbolRenameArgs args, Action callback, Action errorCallback) @@ -166,32 +194,30 @@ namespace CSharpBinding return Task.Run( () => { bool isNameValid = Mono.CSharp.Tokenizer.IsValidIdentifier(args.NewName); - for (int i = 0; i < searchScopes.Count; i++) { - IFindReferenceSearchScope searchScope = searchScopes[i]; - object progressLock = new object(); - Parallel.ForEach( - interestingFileNames[i], - new ParallelOptions { - MaxDegreeOfParallelism = Environment.ProcessorCount, - CancellationToken = cancellationToken - }, - delegate (string fileName) { - RenameReferencesInFile(args, searchScope, FileName.Create(fileName), callback, errorCallback, isNameValid, cancellationToken); - lock (progressLock) - args.ProgressMonitor.Progress += workAmountInverse; - }); - } + object progressLock = new object(); + Parallel.ForEach( + searchScopesPerFile.Keys, + new ParallelOptions { + MaxDegreeOfParallelism = Environment.ProcessorCount, + CancellationToken = cancellationToken + }, + delegate (string fileName) { + RenameReferencesInFile(args, searchScopesPerFile[fileName], FileName.Create(fileName), callback, errorCallback, isNameValid, cancellationToken); + lock (progressLock) + args.ProgressMonitor.Progress += workAmountInverse; + }); }, cancellationToken ); } - void RenameReferencesInFile(SymbolRenameArgs args, IFindReferenceSearchScope searchScope, FileName fileName, Action callback, Action errorCallback, bool isNameValid, CancellationToken cancellationToken) + void RenameReferencesInFile(SymbolRenameArgs args, IList searchScopeList, FileName fileName, Action callback, Action errorCallback, bool isNameValid, CancellationToken cancellationToken) { ITextSource textSource = args.ParseableFileContentFinder.Create(fileName); if (textSource == null) return; - if (searchScope.SearchTerm != null) { - if (textSource.IndexOf(searchScope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) < 0) + if (searchScopeList != null) { + if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any( + scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0))) return; } @@ -213,7 +239,7 @@ namespace CSharpBinding CSharpAstResolver resolver = new CSharpAstResolver(compilation, parseInfo.SyntaxTree, unresolvedFile); fr.RenameReferencesInFile( - new[] { searchScope }, args.NewName, resolver, + searchScopeList, args.NewName, resolver, delegate (RenameCallbackArguments callbackArgs) { var node = callbackArgs.NodeToReplace; string newCode = callbackArgs.NewNode.ToString(); @@ -249,10 +275,16 @@ namespace CSharpBinding } IDocument changedDocument = new TextDocument(document); var oldVersion = changedDocument.Version; + List fixedResults = new List(); + int lastStartOffset = changedDocument.TextLength + 1; foreach (var result in results.OrderByDescending(m => m.StartOffset)) { - changedDocument.Replace(result.StartOffset, result.Length, result.NewCode); + if (result.EndOffset <= lastStartOffset) { + changedDocument.Replace(result.StartOffset, result.Length, result.NewCode); + fixedResults.Add(result); + lastStartOffset = result.StartOffset; + } } - callback(new PatchedFile(fileName, results, oldVersion, changedDocument.Version)); + callback(new PatchedFile(fileName, fixedResults, oldVersion, changedDocument.Version)); } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs index 047c676cd6..1e87ada3ca 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/Parser.cs @@ -38,7 +38,6 @@ using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Editor.Search; using ICSharpCode.SharpDevelop.Parser; using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.SharpDevelop.Refactoring; namespace CSharpBinding.Parser { @@ -51,38 +50,6 @@ namespace CSharpBinding.Parser return Path.GetExtension(fileName).Equals(".CS", StringComparison.OrdinalIgnoreCase); } - /* - void RetrieveRegions(ISyntaxTree cu, ICSharpCode.NRefactory.Parser.SpecialTracker tracker) - { - for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) { - ICSharpCode.NRefactory.PreprocessingDirective directive = tracker.CurrentSpecials[i] as ICSharpCode.NRefactory.PreprocessingDirective; - if (directive != null) { - if (directive.Cmd == "#region") { - int deep = 1; - for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) { - ICSharpCode.NRefactory.PreprocessingDirective nextDirective = tracker.CurrentSpecials[j] as ICSharpCode.NRefactory.PreprocessingDirective; - if (nextDirective != null) { - switch (nextDirective.Cmd) { - case "#region": - ++deep; - break; - case "#endregion": - --deep; - if (deep == 0) { - cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim(), DomRegion.FromLocation(directive.StartPosition, nextDirective.EndPosition))); - goto end; - } - break; - } - } - } - end: ; - } - } - } - } - */ - public ITextSource GetFileContent(FileName fileName) { return SD.FileService.GetFileContent(fileName); @@ -94,7 +61,6 @@ namespace CSharpBinding.Parser var csharpProject = parentProject as CSharpProject; CSharpParser parser = new CSharpParser(csharpProject != null ? csharpProject.CompilerSettings : null); - parser.GenerateTypeSystemMode = !fullParseInformationRequested; SyntaxTree cu = parser.Parse(fileContent, fileName); cu.Freeze(); @@ -135,7 +101,7 @@ namespace CSharpBinding.Parser int endOffset; int searchOffset = 0; // HACK: workaround for parser bug: uses \n instead of \r\n in comment.Content - string commentContent = document.GetText(commentStartOffset, commentEndOffset - commentStartOffset + 1); + string commentContent = document.GetText(commentStartOffset, Math.Min(commentEndOffset - commentStartOffset + 1, commentEndOffset - commentStartOffset)); do { int start = commentStartOffset + searchOffset; int absoluteOffset = document.IndexOf(match, start, document.TextLength - start, StringComparison.Ordinal); diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs index a341e62b93..a7880dc1d6 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs @@ -66,7 +66,7 @@ namespace CSharpBinding.Refactoring AddAttribute(target.Region, attribute, "return"); } - public override void InsertEventHandler(ITypeDefinition target, string name, IEvent eventDefinition, bool jumpTo) + public override void InsertEventHandler(ITypeDefinition target, string name, IEvent eventDefinition, bool jumpTo, InsertEventHandlerBodyKind bodyKind = InsertEventHandlerBodyKind.ThrowNotImplementedException) { IUnresolvedTypeDefinition match = null; @@ -86,7 +86,10 @@ namespace CSharpBinding.Refactoring var node = context.RootNode.GetNodeAt(last.Region.Begin); var resolver = context.GetResolverStateAfter(node); var builder = new TypeSystemAstBuilder(resolver); - var delegateDecl = builder.ConvertEntity(eventDefinition.ReturnType.GetDefinition()) as DelegateDeclaration; + var invokeMethod = eventDefinition.ReturnType.GetDelegateInvokeMethod(); + if (invokeMethod == null) return; + var importedMethod = resolver.Compilation.Import(invokeMethod); + var delegateDecl = builder.ConvertEntity(importedMethod) as MethodDeclaration; if (delegateDecl == null) return; var throwStmt = new ThrowStatement(new ObjectCreateExpression(context.CreateShortType("System", "NotImplementedException"))); var decl = new MethodDeclaration() { @@ -96,19 +99,34 @@ namespace CSharpBinding.Refactoring throwStmt } }; - var param = delegateDecl.Parameters.Select(p => p.Clone()).OfType().ToArray(); + var param = delegateDecl.Parameters.Select(p => p.Clone()).ToArray(); decl.Parameters.AddRange(param); using (Script script = context.StartScript()) { - // FIXME : will not work properly if there are no members. + int eolLen = 0; if (last == match) { - throw new NotImplementedException(); - // TODO InsertWithCursor not implemented! - //script.InsertWithCursor("Insert event handler", Script.InsertPosition.End, decl).RunSynchronously(); + eolLen = 2; + script.AddTo((TypeDeclaration)node, decl); } else { - // TODO does not jump correctly... script.InsertAfter(node, decl); - editor.JumpTo(throwStmt.StartLocation.Line, throwStmt.StartLocation.Column); + } + switch (bodyKind) { + case InsertEventHandlerBodyKind.TodoComment: + Comment comment = new Comment(" TODO: Implement " + name); + script.Replace(throwStmt, comment); + script.Select(comment); + break; + case InsertEventHandlerBodyKind.Nothing: + var segment = script.GetSegment(throwStmt); + if (script is DocumentScript && eolLen > 0) { + eolLen = ((DocumentScript)script).CurrentDocument.GetLineByOffset(segment.Offset).DelimiterLength; + } + script.RemoveText(segment.Offset, segment.Length - eolLen); + script.Select(segment.Offset, segment.Offset); + break; + case InsertEventHandlerBodyKind.ThrowNotImplementedException: + script.Select(throwStmt); + break; } } } @@ -208,5 +226,10 @@ namespace CSharpBinding.Refactoring script.ChangeModifier(entityDeclaration, entityDeclaration.Modifiers | Modifiers.Virtual); } } + + public override string EscapeIdentifier(string identifier) + { + return "@" + identifier; + } } } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/EditorScript.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/EditorScript.cs index c33d1b6b7c..30099aa233 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/EditorScript.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/EditorScript.cs @@ -18,12 +18,14 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Windows.Threading; using ICSharpCode.AvalonEdit.Editing; using ICSharpCode.AvalonEdit.Snippets; using ICSharpCode.AvalonEdit.Document; +using ICSharpCode.Core; using ICSharpCode.NRefactory; using ICSharpCode.NRefactory.CSharp; using ICSharpCode.NRefactory.CSharp.Refactoring; @@ -32,6 +34,10 @@ using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Editor; +using ICSharpCode.SharpDevelop.Editor.Commands; +using ICSharpCode.SharpDevelop.Editor.Dialogs; +using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.SharpDevelop.Refactoring; using ICSharpCode.SharpDevelop.Workbench; namespace CSharpBinding.Refactoring @@ -75,6 +81,16 @@ namespace CSharpBinding.Refactoring editor.Select(startOffset, endOffset - startOffset); } + public override void Select(int startOffset, int endOffset) + { + editor.Select(Math.Min(startOffset, endOffset), Math.Abs(endOffset - startOffset)); + } + + public override void Select(TextLocation start, TextLocation end) + { + Select(editor.Document.GetOffset(start), editor.Document.GetOffset(end)); + } + public override Task Link(params AstNode[] nodes) { var segs = nodes.Select(node => GetSegment(node)).ToArray(); @@ -102,6 +118,11 @@ namespace CSharpBinding.Refactoring return tcs.Task; } + public override void Rename(ISymbol symbol, string name = null) + { + RenameSymbolCommand.RunRename(symbol, name); + } + public override Task - - Silverlight Application - - -
Loading...
- - -]]> - - - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFApplication.xpt b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFApplication.xpt deleted file mode 100644 index ea99603f8f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFApplication.xpt +++ /dev/null @@ -1,102 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFWindow.xft b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFWindow.xft deleted file mode 100644 index 3c4d9b86a7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Templates/WPFWindow.xft +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py b/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py deleted file mode 100644 index 3510f6fcfa..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtest.py +++ /dev/null @@ -1,95 +0,0 @@ - -import sys -import System.IO - -class SharpDevelopTestProgram: - - def __init__(self): - self._sysPaths = [] - self._testNames = [] - - def run(self): - if self._validateCommandLineArgs(): - self._runTests() - return - - print 'Usage: sdunittest.py test-names-file sys-paths-file test-results-file' - print 'Usage: sdunittest.py @response-file' - print '' - print 'Example response file content: ' - print '/p:"sys/path/1"' - print '/p:"sys/path/2"' - print '/r:"path/to/results-file"' - print 'test-name1' - print 'test-name2' - print 'test-name3' - - def _validateCommandLineArgs(self): - if len(sys.argv) == 4: - self._testNamesFile = sys.argv[1] - self._sysPathFile = sys.argv[2] - self._testResultsFile = sys.argv[3] - self._responseFile = '' - return True - if len(sys.argv) == 2: - return self._getResponseFileName(sys.argv[1]) - return False - - def _getResponseFileName(self, fileName): - if len(fileName) > 0: - if fileName[0] == '@': - self._responseFile = fileName[1:] - return True - return False - - def _runTests(self): - if len(self._responseFile) > 0: - self._readResponseFile() - else: - self._readSysPathsFromFile() - self._readTestNames() - - self._addSysPaths() - - import unittest - import sdtestrunner - - suite = unittest.TestLoader().loadTestsFromNames(self._testNames) - sdtestrunner.SharpDevelopTestRunner(resultsFileName=self._testResultsFile, verbosity=2).run(suite) - - def _readResponseFile(self): - for line in self._readLinesFromFile(self._responseFile): - self._readResponseFileArgument(line) - - def _readResponseFileArgument(self, line): - if line.startswith('/r:'): - line = self._removeQuotes(line[3:]) - self._testResultsFile = line - elif line.startswith('/p:'): - line = self._removeQuotes(line[3:]) - self._sysPaths.append(line) - else: - self._testNames.append(line) - - def _removeQuotes(self, line): - return line.strip('\"') - - def _readLinesFromFile(self, fileName): - #f = codecs.open(fileName, 'rb', 'utf-8') - #return f.readall().splitlines() - return System.IO.File.ReadAllLines(fileName) - - def _readTestNames(self): - self._testNames = self._readLinesFromFile(self._testNamesFile) - - def _readSysPathsFromFile(self): - self._sysPaths = self._readLinesFromFile(self._sysPathFile) - - def _addSysPaths(self): - for path in self._sysPaths: - sys.path.append(path) - - -if __name__ == '__main__': - program = SharpDevelopTestProgram() - program.run() diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py b/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py deleted file mode 100644 index 9fa36d46c3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/TestRunner/sdtestrunner.py +++ /dev/null @@ -1,106 +0,0 @@ - -import codecs -import sys -import time -from unittest import TestResult -from unittest import TextTestRunner -from unittest import _TextTestResult -from unittest import _WritelnDecorator - -class _SharpDevelopTestResultWriter: - def __init__(self, resultsFileName): - self.stream = codecs.open(resultsFileName, "w+", "utf-8-sig") - - def _writeln(self, arg): - self.stream.write(arg) - self.stream.write('\r\n') - - def _writeTestName(self, test): - self._writeln("Name: " + test.id()) - - def _writeTestResult(self, result): - self._writeln("Result: " + result) - - def _writeTestSuccess(self): - self._writeTestResult("Success") - - def _writeTestFailure(self, test, err, testResult): - self._writeTestResult("Failure") - - exctype, value, tb = err - if value != None: - message = self._prefixLinesWithSpaceChar(str(value)) - self._writeln("Message: " + message) - - excInfoString = testResult._exc_info_to_string(err, test) - excInfoString = self._prefixLinesWithSpaceChar(excInfoString) - self._writeln("StackTrace: " + excInfoString) - - def _prefixLinesWithSpaceChar(self, text): - lines = [] - originalLines = text.splitlines() - if len(originalLines) == 0: - return text - - lines.append(originalLines[0] + '\r\n') - - for line in originalLines[1:]: - lines.append(' ' + line + '\r\n') - return ''.join(lines).rstrip() - - def addSuccess(self, test): - self._writeTestName(test) - self._writeTestSuccess() - - def addError(self, test, err, testResult): - self._writeTestName(test) - self._writeTestFailure(test, err, testResult) - - def addFailure(self, test, err, testResult): - self._writeTestName(test) - self._writeTestFailure(test, err, testResult) - -class _SharpDevelopNullTestResultWriter: - def __init__(self): - pass - - def addSuccess(self, test): - pass - - def addError(self, test, err, testResult): - pass - - def addFailure(self, test, err, testResult): - pass - - -class _SharpDevelopTestResult(_TextTestResult): - def __init__(self, stream, descriptions, verbosity, resultWriter): - _TextTestResult.__init__(self, stream, descriptions, verbosity) - self.resultWriter = resultWriter - - def addSuccess(self, test): - self.resultWriter.addSuccess(test) - _TextTestResult.addSuccess(self, test) - - def addError(self, test, err): - self.resultWriter.addError(test, err, self) - _TextTestResult.addError(self, test, err) - - def addFailure(self, test, err): - self.resultWriter.addFailure(test, err, self) - _TextTestResult.addFailure(self, test, err) - - -class SharpDevelopTestRunner(TextTestRunner): - def __init__(self, stream=sys.stderr, resultsFileName=None, descriptions=1, verbosity=1): - self.stream = _WritelnDecorator(stream) - self.descriptions = descriptions - self.verbosity = verbosity - if resultsFileName is None: - self.resultWriter = _SharpDevelopNullTestResultWriter() - else: - self.resultWriter = _SharpDevelopTestResultWriter(resultsFileName) - - def _makeResult(self): - return _SharpDevelopTestResult(self.stream, self.descriptions, self.verbosity, self.resultWriter) diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AssemblyInfo.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/AssemblyInfo.cs deleted file mode 100644 index 19c0fa043d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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; - -using NUnit.Framework; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("PythonBinding.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("PythonBinding.Tests")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("0.3")] - -// Run unit tests on STA thread. -[assembly: RequiresSTA] diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingFromImportCompletionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingFromImportCompletionTests.cs deleted file mode 100644 index 6d2a163276..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingFromImportCompletionTests.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - /// - /// Tests that the From keyword is correctly identified as a - /// importable code completion keyword. - /// - [TestFixture] - public class CodeCompletionBindingFromImportCompletionTests - { - MockTextEditor fakeTextEditor; - TestablePythonCodeCompletionBinding codeCompletionBinding; - - void CreatePythonCodeCompletionBinding() - { - fakeTextEditor = new MockTextEditor(); - codeCompletionBinding = new TestablePythonCodeCompletionBinding(); - } - - [Test] - public void HandleKeyword_KeywordIsFrom_ReturnsTrue() - { - CreatePythonCodeCompletionBinding(); - bool handled = codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); - Assert.IsTrue(handled); - } - - [Test] - public void HandleKeyword_KeywordIsFrom_PythonDotCodeCompletionItemProviderUsedToShowCompletionWindow() - { - CreatePythonCodeCompletionBinding(); - codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); - ITextEditor textEditor = codeCompletionBinding.TextEditorPassedToShowCompletionWindow; - - Assert.AreEqual(fakeTextEditor, textEditor); - } - - [Test] - public void HandleKeyword_KeywordIsFrom_PythonCodeCompletionItemProviderCreated() - { - CreatePythonCodeCompletionBinding(); - codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); - - PythonCodeCompletionItemProvider provider = codeCompletionBinding.KeywordCompletionItemProviderCreated as PythonCodeCompletionItemProvider; - - Assert.IsNotNull(provider); - } - - [Test] - public void HandleKeyword_KeywordIsFrom_PythonCodeCompletionItemProviderPassedToShowCompletionWindow() - { - CreatePythonCodeCompletionBinding(); - codeCompletionBinding.HandleKeyword(fakeTextEditor, "from"); - - AbstractCompletionItemProvider provider = codeCompletionBinding.CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow; - - Assert.AreSame(codeCompletionBinding.KeywordCompletionItemProviderCreated, provider); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTests.cs deleted file mode 100644 index 213282da8a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/CodeCompletionBindingImportCompletionTests.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - /// - /// Tests the code completion after an "import" statement. - /// - [TestFixture] - public class CodeCompletionBindingImportCompletionTests - { - TestablePythonCodeCompletionBinding codeCompletionBinding; - MockTextEditor textEditor; - bool handled; - - public void CreateCompletionBinding() - { - textEditor = new MockTextEditor(); - codeCompletionBinding = new TestablePythonCodeCompletionBinding(); - } - - public void HandlesImportKeyword() - { - CreateCompletionBinding(); - handled = codeCompletionBinding.HandleKeyword(textEditor, "import"); - } - - [Test] - public void HandleKeyword_KeywordIsImport_ReturnsTrue() - { - HandlesImportKeyword(); - Assert.IsTrue(handled); - } - - [Test] - public void HandleKeyword_UnknownKeyword_ReturnsFalse() - { - bool handled = codeCompletionBinding.HandleKeyword(textEditor, "Unknown"); - Assert.IsFalse(handled); - } - - [Test] - public void HandleKeyword_KeywordIsImportInUpperCase_ReturnsTrue() - { - bool handled = codeCompletionBinding.HandleKeyword(textEditor, "IMPORT"); - Assert.IsTrue(handled); - } - - [Test] - public void HandleKeyword_KeywordIsNull_ReturnsFalse() - { - bool handled = codeCompletionBinding.HandleKeyword(textEditor, null); - Assert.IsFalse(handled); - } - - [Test] - public void HandleKeyword_KeywordIsImport_CodeCompletionWindowDisplayed() - { - HandlesImportKeyword(); - Assert.IsTrue(codeCompletionBinding.IsCodeCompletionWindowDisplayed); - } - - [Test] - public void HandleKeyword_KeywordIsImport_TextEditorPassedToShowCompletionWindowMethod() - { - HandlesImportKeyword(); - Assert.AreSame(textEditor, codeCompletionBinding.TextEditorPassedToShowCompletionWindow); - } - - [Test] - public void HandleKeyword_KeywordIsImport_CompletionProviderUsedWhenDisplayingCodeCompletionWindow() - { - HandlesImportKeyword(); - Assert.AreSame(codeCompletionBinding.KeywordCompletionItemProviderCreated, codeCompletionBinding.CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow); - } - - [Test] - public void HandleKeyword_KeywordIsImport_KeywordCompletionDataProviderIsCodeCompletionItemProvider() - { - HandlesImportKeyword(); - CodeCompletionItemProvider provider = codeCompletionBinding.KeywordCompletionItemProviderCreated as CodeCompletionItemProvider; - Assert.IsNotNull(provider); - } - - [Test] - public void ShowCompletionWindow_FakeCompletionItemProviderAndTextEditorPassed_asdf() - { - CreateCompletionBinding(); - FakeCompletionItemProvider provider = new FakeCompletionItemProvider(); - codeCompletionBinding.CallBaseShowCodeCompletionWindow(provider, textEditor); - - Assert.AreEqual(textEditor, provider.TextEditorPassedToShowCompletion); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromDateTimeImportCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromDateTimeImportCompletionTestFixture.cs deleted file mode 100644 index a2a2a368b9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromDateTimeImportCompletionTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class FromDateTimeLibraryImportCompletionTestFixture - { - PythonImportExpression importExpression; - PythonImportModuleResolveResult resolveResult; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - string code = "from datetime import"; - importExpression = new PythonImportExpression(code); - resolveResult = new PythonImportModuleResolveResult(importExpression); - - projectContent = new MockProjectContent(); - } - - [Test] - public void CompletionItemsContainsDateClass() - { - List items = resolveResult.GetCompletionData(projectContent); - IClass c = PythonCompletionItemsHelper.FindClassFromCollection("datetime", items); - Assert.IsNotNull(c); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportDotNetNamespaceCompletionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportDotNetNamespaceCompletionTests.cs deleted file mode 100644 index 686b14dd26..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportDotNetNamespaceCompletionTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class FromImportDotNetNamespaceCompletionTes - { - PythonImportCompletion completion; - MockProjectContent projectContent; - DefaultClass c; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - completion = new PythonImportCompletion(projectContent); - - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - ParseInformation parseInfo = new ParseInformation(unit); - c = new DefaultClass(unit, "Class"); - List namespaceItems = new List(); - namespaceItems.Add(c); - projectContent.AddExistingNamespaceContents("System", namespaceItems); - } - - [Test] - public void GetCompletionItemsFromModule_DotNetSystemLibrary_ReturnsAllClassesFromSystemNamespaceAndAsteriskForImportAll() - { - List items = completion.GetCompletionItemsFromModule("System"); - List expectedItems = new List(); - expectedItems.Add(c); - expectedItems.Add(new NamespaceEntry("*")); - - Assert.AreEqual(expectedItems, items); - } - - [Test] - public void GetCompletionItems_DotNetSystemLibrary_SystemNamespaceSearchedForWhenGetCompletionItemsMethodCalled() - { - completion.GetCompletionItemsFromModule("System"); - string expectedNamespace = "System"; - Assert.AreEqual(expectedNamespace, projectContent.NamespacePassedToGetNamespaceContentsMethod); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportPythonModuleCompletionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportPythonModuleCompletionTests.cs deleted file mode 100644 index 3e14da9a60..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromImportPythonModuleCompletionTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class FromImportPythonModuleCompletionTests - { - PythonImportCompletion completion; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent)); - completion = new PythonImportCompletion(projectContent); - } - - [Test] - public void GetCompletionItemsFromModule_UnknownModule_OnlyImportAllItemsCompletionItemReturned() - { - List items = completion.GetCompletionItemsFromModule("unknown"); - List expectedItems = new List(); - expectedItems.Add(new NamespaceEntry("*")); - Assert.AreEqual(expectedItems, items); - } - - [Test] - public void GetCompletionItemsFromModule_MathModule_ReturnsPiField() - { - List items = completion.GetCompletionItemsFromModule("math"); - IField field = PythonCompletionItemsHelper.FindFieldFromCollection("pi", items); - Assert.IsNotNull(field); - } - - [Test] - public void GetCompletionItemsFromModule_MathModule_LastCompletionItemIsAsterisk() - { - List items = completion.GetCompletionItemsFromModule("math"); - int lastItem = items.Count - 1; - ICompletionEntry lastCompletionItem = items[lastItem]; - NamespaceEntry expectedCompletionItem = new NamespaceEntry("*"); - Assert.AreEqual(expectedCompletionItem, lastCompletionItem); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCompletionTestFixture.cs deleted file mode 100644 index 500522f4a2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCompletionTestFixture.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class FromMathLibraryImportCompletionTestFixture - { - PythonImportExpression importExpression; - PythonImportModuleResolveResult resolveResult; - MockProjectContent projectContent; - List completionItems; - - [SetUp] - public void Init() - { - string code = "from math import"; - importExpression = new PythonImportExpression(code); - resolveResult = new PythonImportModuleResolveResult(importExpression); - - projectContent = new MockProjectContent(); - completionItems = resolveResult.GetCompletionData(projectContent); - } - - [Test] - public void CompletionItemsContainsCosMethodFromMathLibrary() - { - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("cos", completionItems); - Assert.IsNotNull(method); - } - - [Test] - public void CompletionItemsContainsPiPropertyFromMathLibrary() - { - IField field = PythonCompletionItemsHelper.FindFieldFromCollection("pi", completionItems); - Assert.IsNotNull(field); - } - - [Test] - public void CompletionItemsDoesNotContainNonStaticToStringMethod() - { - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("ToString", completionItems); - Assert.IsNull(method); - } - - [Test] - public void CompletionItemsContain__name__() - { - IField field = PythonCompletionItemsHelper.FindFieldFromCollection("__name__", completionItems); - Assert.IsNotNull(field); - } - - [Test] - public void CompletionItemsContain__package__() - { - IField field = PythonCompletionItemsHelper.FindFieldFromCollection("__package__", completionItems); - Assert.IsNotNull(field); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCosMethodCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCosMethodCompletionTestFixture.cs deleted file mode 100644 index 859466e1a1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromMathLibraryImportCosMethodCompletionTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - /// - /// With dot completion if the from import statement has an a identifier then no - /// completion items should be returned. - /// - /// For example pressing '.' after the following should not show any completion items: - /// - /// "from math import cos" - /// - [TestFixture] - public class FromMathLibraryImportCosMethodCompletionTestFixture - { - PythonImportExpression importExpression; - PythonImportModuleResolveResult resolveResult; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - string code = "from math import cos"; - importExpression = new PythonImportExpression(code); - resolveResult = new PythonImportModuleResolveResult(importExpression); - - projectContent = new MockProjectContent(); - } - - [Test] - public void NoCompletionItemsReturned() - { - List items = resolveResult.GetCompletionData(projectContent); - Assert.AreEqual(0, items.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromSysLibraryImportCompletionItemsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromSysLibraryImportCompletionItemsTestFixture.cs deleted file mode 100644 index 3615ea5ba7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/FromSysLibraryImportCompletionItemsTestFixture.cs +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class FromSysLibraryImportCompletionItemsTestFixture - { - PythonImportCompletion completion; - MockProjectContent projectContent; - List completionItems; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent)); - completion = new PythonImportCompletion(projectContent); - completionItems = completion.GetCompletionItemsFromModule("sys"); - } - - [Test] - public void GetCompletionItemsDoesNotReturnPythonHiddenMethods() - { - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("_getframeImpl", completionItems); - Assert.IsNull(method); - } - - [Test] - public void GetCompletionItemsReturns__name__() - { - AssertFieldExists("__name__"); - } - - void AssertFieldExists(string name) - { - IField field = GetFieldFromCompletionItems(name); - Assert.IsNotNull(field, String.Format("Field '{0}' not found in completion items.", name)); - } - - IField GetFieldFromCompletionItems(string name) - { - return PythonCompletionItemsHelper.FindFieldFromCollection(name, completionItems); - } - - [Test] - public void GetCompletionItemsReturns__package__() - { - AssertFieldExists("__package__"); - } - - [Test] - public void GetCompletionItemsReturns__stderr__() - { - AssertFieldExists("__stderr__"); - } - - [Test] - public void GetCompletionItemsReturns__stdin__() - { - AssertFieldExists("__stdin__"); - } - - [Test] - public void GetCompletionItemsReturns__stdout__() - { - AssertFieldExists("__stdout__"); - } - - [Test] - public void GetCompletionItemsReturnsArgv() - { - AssertFieldExists("argv"); - } - - [Test] - public void GetCompletionItemsReturnsBuiltInModuleNames() - { - AssertFieldExists("builtin_module_names"); - } - - [Test] - public void GetCompletionItemsReturnsExecutable() - { - AssertFieldExists("executable"); - } - - [Test] - public void GetCompletionItemsReturnsExecPrefix() - { - AssertFieldExists("exec_prefix"); - } - - [Test] - public void GetCompletionItemsReturnsExitMethod() - { - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("exit", completionItems); - Assert.IsNotNull(method); - } - - [Test] - public void GetCompletionItemsReturnsFlags() - { - AssertFieldExists("flags"); - } - - [Test] - public void GetCompletionItemsReturnsHexVersion() - { - AssertFieldExists("hexversion"); - } - - [Test] - public void GetCompletionItemsReturnsLastType() - { - AssertFieldExists("last_type"); - } - - [Test] - public void GetCompletionItemsReturnsLastValue() - { - AssertFieldExists("last_value"); - } - - [Test] - public void GetCompletionItemsReturnsLastTraceback() - { - AssertFieldExists("last_traceback"); - } - - [Test] - public void GetCompletionItemsReturnsMetaPath() - { - AssertFieldExists("meta_path"); - } - - [Test] - public void GetCompletionItemsReturnsModules() - { - AssertFieldExists("modules"); - } - - [Test] - public void GetCompletionItemsReturnsPath() - { - AssertFieldExists("path"); - } - - [Test] - public void GetCompletionItemsReturnsPathHooks() - { - AssertFieldExists("path_hooks"); - } - - [Test] - public void GetCompletionItemsReturnsPathImporterCache() - { - AssertFieldExists("path_importer_cache"); - } - - [Test] - public void GetCompletionItemsReturnsPs1() - { - AssertFieldExists("ps1"); - } - - [Test] - public void GetCompletionItemsReturnsPs2() - { - AssertFieldExists("ps2"); - } - - [Test] - public void GetCompletionItemsReturnsPy3kWarning() - { - AssertFieldExists("py3kwarning"); - } - - [Test] - public void GetCompletionItemsReturnsDontWriteByteCode() - { - AssertFieldExists("dont_write_byte_code"); - } - - [Test] - public void GetCompletionItemsReturnsStdErr() - { - AssertFieldExists("stderr"); - } - - [Test] - public void GetCompletionItemsReturnsStdIn() - { - AssertFieldExists("stdin"); - } - - [Test] - public void GetCompletionItemsReturnsStdOut() - { - AssertFieldExists("stdout"); - } - - [Test] - public void GetCompletionItemsReturnsVersion() - { - AssertFieldExists("version"); - } - - [Test] - public void GetCompletionItemsReturnsVersionInfo() - { - AssertFieldExists("version_info"); - } - - [Test] - public void GetCompletionItemsReturnsWarnOptions() - { - AssertFieldExists("warnoptions"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetMethodsFromSysLibraryTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetMethodsFromSysLibraryTestFixture.cs deleted file mode 100644 index d76e6fa349..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetMethodsFromSysLibraryTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Modules; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class GetMethodsFromSysLibraryTestFixture - { - SysModuleCompletionItems completionItems; - MethodGroup exitMethodGroup; - MethodGroup displayHookMethodGroup; - MethodGroup setDefaultEncodingMethodGroup; - - [SetUp] - public void Init() - { - PythonStandardModuleType moduleType = new PythonStandardModuleType(typeof(SysModule), "sys"); - completionItems = new SysModuleCompletionItems(moduleType); - exitMethodGroup = completionItems.GetMethods("exit"); - displayHookMethodGroup = completionItems.GetMethods("displayhook"); - setDefaultEncodingMethodGroup = completionItems.GetMethods("setdefaultencoding"); - } - - [Test] - public void TwoExitMethodsReturnedFromGetMethods() - { - Assert.AreEqual(2, exitMethodGroup.Count); - } - - [Test] - public void FirstMethodNameIsExit() - { - Assert.AreEqual("exit", exitMethodGroup[0].Name); - } - - [Test] - public void SecondMethodNameIsExit() - { - Assert.AreEqual("exit", exitMethodGroup[1].Name); - } - - [Test] - public void FirstMethodHasReturnType() - { - Assert.IsNotNull(exitMethodGroup[0].ReturnType); - } - - [Test] - public void SecondMethodHasReturnType() - { - Assert.IsNotNull(exitMethodGroup[1].ReturnType); - } - - [Test] - public void ExitMethodReturnsVoid() - { - IMethod method = exitMethodGroup[0]; - Assert.AreEqual("Void", method.ReturnType.Name); - } - - [Test] - [Ignore("TODO displayhook function replaced by BuiltinFunction field")] - public void DisplayHookMethodDoesNotHaveCodeContextParameter() - { - IMethod method = displayHookMethodGroup[0]; - IParameter parameter = method.Parameters[0]; - Assert.AreEqual("value", parameter.Name); - } - - [Test] - [Ignore("TODO displayhook function replaced by BuiltinFunction field")] - public void DisplayHookMethodReturnsVoid() - { - IMethod method = displayHookMethodGroup[0]; - Assert.AreEqual("Void", method.ReturnType.Name); - } - - [Test] - public void GetDefaultEncodingMethodReturnsString() - { - MethodGroup methodGroup = completionItems.GetMethods("getdefaultencoding"); - IMethod method = methodGroup[0]; - Assert.AreEqual("String", method.ReturnType.Name); - } - - [Test] - public void SetDefaultEncodingMethodDoesNotHaveCodeContextParameter() - { - IMethod method = setDefaultEncodingMethodGroup[0]; - IParameter parameter = method.Parameters[0]; - Assert.AreEqual("name", parameter.Name); - } - - [Test] - public void SetDefaultEncodingMethodDReturnsVoid() - { - IMethod method = setDefaultEncodingMethodGroup[0]; - Assert.AreEqual("Void", method.ReturnType.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetPythonModulesTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetPythonModulesTestFixture.cs deleted file mode 100644 index 65ac83ff22..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetPythonModulesTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Text; -using NUnit.Framework; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests the standard Python module names can be determined - /// for IronPython. - /// - [TestFixture] - public class GetPythonModulesTestFixture - { - List moduleNames; - - [TestFixtureSetUp] - public void SetUpFixture() - { - moduleNames = new PythonStandardModules(); - } - - [Test] - public void ContainsSysModuleName() - { - Assert.Contains(new NamespaceEntry("sys"), moduleNames); - } - - [Test] - public void SysModuleInListOfModulesOnlyOnce() - { - int countOccurrencesOfSysModuleName = 0; - foreach (ICompletionEntry entry in moduleNames) { - if (entry.Name == "sys") { - countOccurrencesOfSysModuleName++; - } - } - Assert.AreEqual(1, countOccurrencesOfSysModuleName); - } - - [Test] - public void ContainsBuiltInModule() - { - Assert.Contains(new NamespaceEntry("__builtin__"), moduleNames, "Module names: " + WriteList(moduleNames)); - } - - [Test] - public void ContainsMathModule() - { - Assert.Contains(new NamespaceEntry("math"), moduleNames); - } - - static string WriteList(List items) - { - StringBuilder text = new StringBuilder(); - foreach (ICompletionEntry item in items) { - text.AppendLine(item.Name); - } - return text.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetTypeForPythonModuleTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetTypeForPythonModuleTestFixture.cs deleted file mode 100644 index bf03b16376..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/GetTypeForPythonModuleTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Modules; -using NUnit.Framework; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class GetTypeForPythonModuleTestFixture - { - PythonStandardModules modules; - PythonStandardModuleType sysModuleType; - - [SetUp] - public void Init() - { - modules = new PythonStandardModules(); - sysModuleType = modules.GetModuleType("sys"); - } - - [Test] - public void GetTypeReturnsNullForUnknownModuleName() - { - Assert.IsNull(modules.GetModuleType("unknown")); - } - - [Test] - public void GetTypeReturnsSysModuleTypeForSysModuleName() - { - Assert.AreEqual(typeof(SysModule), modules.GetModuleType("sys").Type); - } - - [Test] - public void GetModuleTypeReturnsSysModuleTypeForSysModuleName() - { - Assert.AreEqual(typeof(SysModule), sysModuleType.Type); - } - - [Test] - public void GetModuleTypeReturnsSysModuleNameForSysModuleName() - { - Assert.AreEqual("sys", sysModuleType.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportCompletionTestFixture.cs deleted file mode 100644 index e6d695fa7c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportCompletionTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class ImportCompletionTestFixture - { - List completionItems; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent)); - List namespaceItems = new List(); - namespaceItems.Add(new NamespaceEntry("Test")); - projectContent.AddExistingNamespaceContents(String.Empty, namespaceItems); - - PythonImportCompletion completion = new PythonImportCompletion(projectContent); - completionItems = completion.GetCompletionItems(); - } - - [Test] - public void TestNamespaceIsAddedToCompletionItems() - { - Assert.Contains(new NamespaceEntry("Test"), completionItems); - } - - [Test] - public void MathStandardPythonModuleIsAddedToCompletionItems() - { - Assert.Contains(new NamespaceEntry("math"), completionItems); - } - - [Test] - public void NamespacePassedToProjectContentGetNamespaceContentsIsEmptyString() - { - Assert.AreEqual(String.Empty, projectContent.NamespacePassedToGetNamespaceContentsMethod); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportEmptyNamespaceCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportEmptyNamespaceCompletionTestFixture.cs deleted file mode 100644 index 0142898606..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportEmptyNamespaceCompletionTestFixture.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class ImportEmptyNamespaceCompletionTestFixture - { - List completionItems; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(projectContent)); - - PythonImportCompletion completion = new PythonImportCompletion(projectContent); - completionItems = completion.GetCompletionItems(String.Empty); - } - - [Test] - public void StandardMathPythonModuleIsAddedToCompletionItems() - { - Assert.Contains(new NamespaceEntry("math"), completionItems); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportResolveResultReturnsNoCompletionItemsIfExpressionHasIdentifierTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportResolveResultReturnsNoCompletionItemsIfExpressionHasIdentifierTestFixture.cs deleted file mode 100644 index fccab225a8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportResolveResultReturnsNoCompletionItemsIfExpressionHasIdentifierTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class ImportResolveResultReturnsNoCompletionItemsIfExpressionHasIdentifierTestFixture - { - PythonImportExpression importExpression; - PythonImportModuleResolveResult resolveResult; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - string code = "from System import Console"; - importExpression = new PythonImportExpression(code); - resolveResult = new PythonImportModuleResolveResult(importExpression); - - projectContent = new MockProjectContent(); - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - DefaultClass c = new DefaultClass(unit, "Test"); - List namespaceItems = new List(); - namespaceItems.Add(c); - projectContent.AddExistingNamespaceContents("System", namespaceItems); - } - - [Test] - public void ProjectContentGetNamespaceReturnsOneItem() - { - Assert.AreEqual(1, projectContent.GetNamespaceContents("System").Count); - } - - [Test] - public void NoCompletionItemsReturned() - { - List items = resolveResult.GetCompletionData(projectContent); - Assert.AreEqual(0, items.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportSubNamespaceCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportSubNamespaceCompletionTestFixture.cs deleted file mode 100644 index 84993cf595..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/ImportSubNamespaceCompletionTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class ImportSubNamespaceCompletionTestFixture - { - List completionItems; - MockProjectContent projectContent; - - [SetUp] - public void Init() - { - projectContent = new MockProjectContent(); - List namespaceItems = new List(); - namespaceItems.Add(new NamespaceEntry("ICSharpCode.PythonBinding.Test")); - projectContent.AddExistingNamespaceContents("ICSharpCode", namespaceItems); - - PythonImportCompletion completion = new PythonImportCompletion(projectContent); - completionItems = completion.GetCompletionItems("ICSharpCode"); - } - - [Test] - public void TestNamespaceIsAddedToCompletionItems() - { - List expectedItems = new List(); - expectedItems.Add(new NamespaceEntry("ICSharpCode.PythonBinding.Test")); - Assert.AreEqual(expectedItems, completionItems); - } - - [Test] - public void NamespacePassedToProjectContentGetNamespaceContentsIsSubNamespaceName() - { - Assert.AreEqual("ICSharpCode", projectContent.NamespacePassedToGetNamespaceContentsMethod); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/MathModuleMembersInPythonContextTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/MathModuleMembersInPythonContextTestFixture.cs deleted file mode 100644 index b6470315a3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/MathModuleMembersInPythonContextTestFixture.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using IronPython.Hosting; -using IronPython.Modules; -using IronPython.Runtime; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class MathModuleMembersInPythonContextTestFixture - { - [Test] - public void UnableToGetMathModuleFromBuiltinModuleDictionary() - { - ScriptEngine engine = Python.CreateEngine(); - PythonContext context = HostingHelpers.GetLanguageContext(engine) as PythonContext; - - object mathModuleFromBuiltinModuleDictionaryObject = null; - context.BuiltinModuleDict.TryGetValue("math", out mathModuleFromBuiltinModuleDictionaryObject); - Assert.IsNull(mathModuleFromBuiltinModuleDictionaryObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs deleted file mode 100644 index 4f9ebcc36d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/NamespaceContentsAddedToCtrlSpaceTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that the contents of the imported namespaces are added - /// to the completion data list when the user presses Ctrl+Space - /// in a class. - /// - [TestFixture] - public class NamespaceContentsAddedToCtrlSpaceTestFixture - { - List results; - PythonResolver resolver; - ICSharpCode.Scripting.Tests.Utils.MockProjectContent mockProjectContent; - MockClass myTestClass; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent(); - mockProjectContent.NamespacesToAdd.Add("Test"); - myTestClass = new MockClass(mockProjectContent, "MyTestClass"); - List namespaceItems = new List(); - namespaceItems.Add(myTestClass); - mockProjectContent.AddExistingNamespaceContents("MyNamespace", namespaceItems); - - DefaultCompilationUnit cu = new DefaultCompilationUnit(mockProjectContent); - - // Add usings. - DefaultUsing newUsing = new DefaultUsing(cu.ProjectContent); - newUsing.Usings.Add("MyNamespace"); - DefaultUsingScope usingScope = new DefaultUsingScope(); - usingScope.Usings.Add(newUsing); - cu.UsingScope = usingScope; - ParseInformation parseInfo = new ParseInformation(cu); - - results = resolver.CtrlSpace(0, "".Length, parseInfo, "", ExpressionContext.Default); - } - - [Test] - public void MyTestClassReturnedInResults() - { - Assert.Contains(myTestClass, results); - } - - [Test] - public void NamespaceSearchedForContents() - { - Assert.AreEqual("MyNamespace", mockProjectContent.NamespacePassedToGetNamespaceContentsMethod); - } - - [Test] - public void TwoResultsReturned() - { - Assert.AreEqual(2, results.Count); - } - - [Test] - public void TestNamespaceReturnedInResults() - { - Assert.Contains(new NamespaceEntry("Test"), results); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionBindingTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionBindingTests.cs deleted file mode 100644 index fae76c9d15..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionBindingTests.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class PythonCodeCompletionBindingTests - { - TestablePythonCodeCompletionBinding completionBinding; - - void CreatePythonCodeCompletionBinding() - { - completionBinding = new TestablePythonCodeCompletionBinding(); - } - - [Test] - public void InsightHandler_CreateNewCodecompletionBindingInstance_IsSetToPythonInsightWindowHandlerInstance() - { - CreatePythonCodeCompletionBinding(); - PythonInsightWindowHandler handler = completionBinding.PythonInsightWindowHandler; - Assert.IsNotNull(handler); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionItemProviderTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionItemProviderTests.cs deleted file mode 100644 index 97c99365e5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCodeCompletionItemProviderTests.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class PythonCodeCompletionItemProviderTests - { - [Test] - public void CreateCompletionItemList_OverriddenInPythonCodeCompletionItemProvider_ReturnsPythonCompletionItemList() - { - TestablePythonCodeCompletionItemProvider provider = new TestablePythonCodeCompletionItemProvider(); - PythonCompletionItemList list = provider.CallBaseCreateCompletionItemList() as PythonCompletionItemList; - - Assert.IsNotNull(list); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCompletionItemListTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCompletionItemListTests.cs deleted file mode 100644 index f0f4e383e8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonCompletionItemListTests.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; -using NUnit.Framework; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class PythonCompletionItemListTests - { - PythonCompletionItemList completionItemList; - - void CreatePythonCompletionItemList() - { - completionItemList = new PythonCompletionItemList(); - } - - [Test] - public void ProcessInput_KeyIsAsterisk_ReturnsNormalKey() - { - CreatePythonCompletionItemList(); - CompletionItemListKeyResult result = completionItemList.ProcessInput('*'); - CompletionItemListKeyResult expectedResult = CompletionItemListKeyResult.NormalKey; - - Assert.AreEqual(expectedResult, result); - } - - [Test] - public void ProcessInput_KeyIsOpenParenthesis_ReturnsNormalKey() - { - CreatePythonCompletionItemList(); - CompletionItemListKeyResult result = completionItemList.ProcessInput('('); - CompletionItemListKeyResult expectedResult = CompletionItemListKeyResult.NormalKey; - - Assert.AreEqual(expectedResult, result); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonImportExpressionContextTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonImportExpressionContextTests.cs deleted file mode 100644 index 070c8ce0ff..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonImportExpressionContextTests.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class PythonImportExpressionContextTests - { - [Test] - public void ShowEntry_IMethodPassed_ReturnsTrue() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - context.HasFromAndImport = true; - - IMethod method = CreateMethod(); - bool result = context.ShowEntry(method); - - Assert.IsTrue(result); - } - - IMethod CreateMethod() - { - IClass c = CreateClass(); - return new DefaultMethod(c, "Test"); - } - - IClass CreateClass() - { - DefaultCompilationUnit unit = new DefaultCompilationUnit(new MockProjectContent()); - return new DefaultClass(unit, "ICSharpCode.MyClass"); - } - - [Test] - public void ShowEntry_PassedNull_ReturnsFalse() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - context.HasFromAndImport = true; - bool result = context.ShowEntry(null); - Assert.IsFalse(result); - } - - [Test] - public void ShowEntry_PassedIMethodWhenHasFromAndImportIsFalse_ReturnsFalse() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - IMethod method = CreateMethod(); - bool result = context.ShowEntry(method); - Assert.IsFalse(result); - } - - [Test] - public void HasFromAndImport_NewPythonImportExpressionContextInstance_IsFalseByDefault() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - bool result = context.HasFromAndImport; - Assert.IsFalse(result); - } - - [Test] - public void ShowEntry_PassedIField_ReturnsTrue() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - context.HasFromAndImport = true; - IField field = CreateField(); - bool result = context.ShowEntry(field); - - Assert.IsTrue(result); - } - - IField CreateField() - { - IClass c = CreateClass(); - return new DefaultField(c, "field"); - } - - [Test] - public void ShowEntry_PassedIFieldWhenHasFromAndImportIsFalse_ReturnsFalse() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - IField field = CreateField(); - bool result = context.ShowEntry(field); - - Assert.IsFalse(result); - } - - [Test] - public void ShowEntry_PassedIClass_ReturnsTrue() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - context.HasFromAndImport = true; - IClass c = CreateClass(); - bool result = context.ShowEntry(c); - - Assert.IsTrue(result); - } - - [Test] - public void ShowEntry_PassedIClassWhenHasFromAndImportIsFalse_ReturnsFalse() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - IClass c = CreateClass(); - bool result = context.ShowEntry(c); - - Assert.IsFalse(result); - } - - [Test] - public void ShowEntry_PassedImportAllNamespaceEntryWhenHasFromAndImportIsTrue_ReturnsTrue() - { - PythonImportExpressionContext context = new PythonImportExpressionContext(); - context.HasFromAndImport = true; - NamespaceEntry entry = new NamespaceEntry("*"); - bool result = context.ShowEntry(entry); - - Assert.IsTrue(result); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonInsightWindowHandlerTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonInsightWindowHandlerTests.cs deleted file mode 100644 index d4a85781cb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonInsightWindowHandlerTests.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Editor; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class PythonInsightWindowHandlerTests - { - PythonInsightWindowHandler handler; - MockTextEditor fakeTextEditor; - FakeInsightWindow fakeInsightWindow; - - void CreatePythonInsightWindowHandler() - { - fakeTextEditor = new MockTextEditor(); - fakeInsightWindow = new FakeInsightWindow(); - handler = new PythonInsightWindowHandler(); - } - - void InitializePythonInsightWindowHandler() - { - handler.InitializeOpenedInsightWindow(fakeTextEditor, fakeInsightWindow); - } - - TextChangeEventArgs CreateInsertedTextChangeEventArgs(int offset, string insertedText) - { - return new TextChangeEventArgs(offset, String.Empty, insertedText); - } - - [Test] - public void InitializeOpenedInsightWindow_CloseParenthesisCharacterAddedToDocument_InsightWindowClosed() - { - CreatePythonInsightWindowHandler(); - fakeTextEditor.FakeDocument.Text = "method("; - fakeTextEditor.FakeCaret.Offset = 7; - fakeInsightWindow.StartOffset = 7; - InitializePythonInsightWindowHandler(); - - int newCaretOffset = 8; - fakeTextEditor.FakeCaret.Offset = newCaretOffset; - fakeTextEditor.FakeDocument.Text = "method()"; - TextChangeEventArgs e = CreateInsertedTextChangeEventArgs(newCaretOffset, ")"); - fakeInsightWindow.FireDocumentChangedEvent(e); - - bool closed = fakeInsightWindow.IsClosed; - Assert.IsTrue(closed); - } - - [Test] - public void InitializeOpenedInsightWindow_MethodCallWithCursorAtOpenBracket_InsightWindowIsClosedBeforeDocumentIsChanged() - { - CreatePythonInsightWindowHandler(); - fakeTextEditor.FakeDocument.Text = "method("; - fakeTextEditor.FakeCaret.Offset = 7; - fakeInsightWindow.StartOffset = 7; - InitializePythonInsightWindowHandler(); - - bool closed = fakeInsightWindow.IsClosed; - Assert.IsFalse(closed); - } - - [Test] - public void InitializeOpenedInsightWindow_SingleCharacterAddedToDocumentAfterOpenParenthesis_InsightWindowIsNotClosed() - { - CreatePythonInsightWindowHandler(); - fakeTextEditor.FakeDocument.Text = "method("; - fakeTextEditor.FakeCaret.Offset = 7; - fakeInsightWindow.StartOffset = 7; - InitializePythonInsightWindowHandler(); - - int newCaretOffset = 8; - fakeTextEditor.FakeCaret.Offset = newCaretOffset; - fakeTextEditor.FakeDocument.Text = "method(a"; - TextChangeEventArgs e = CreateInsertedTextChangeEventArgs(newCaretOffset, "a"); - fakeInsightWindow.FireDocumentChangedEvent(e); - - bool closed = fakeInsightWindow.IsClosed; - Assert.IsFalse(closed); - } - - [Test] - public void InitializeOpenedInsightWindow_MethodCallInsideMethodCallAndCloseParenthesisCharacterAddedToDocument_InsightWindowIsNotClosed() - { - CreatePythonInsightWindowHandler(); - fakeTextEditor.FakeDocument.Text = "method(a("; - fakeTextEditor.FakeCaret.Offset = 9; - fakeInsightWindow.StartOffset = 7; - InitializePythonInsightWindowHandler(); - - int newCaretOffset = 10; - fakeTextEditor.FakeCaret.Offset = newCaretOffset; - fakeTextEditor.FakeDocument.Text = "method(a()"; - TextChangeEventArgs e = CreateInsertedTextChangeEventArgs(newCaretOffset, ")"); - fakeInsightWindow.FireDocumentChangedEvent(e); - - bool closed = fakeInsightWindow.IsClosed; - Assert.IsFalse(closed); - } - - [Test] - public void InitializeOpenedInsightWindow_CharacterAddedToDocumentBeforeStartOfInsightWindow_InsightWindowClosed() - { - CreatePythonInsightWindowHandler(); - fakeTextEditor.FakeDocument.Text = "method("; - fakeTextEditor.FakeCaret.Offset = 7; - fakeInsightWindow.StartOffset = 7; - InitializePythonInsightWindowHandler(); - - int newCaretOffset = 1; - fakeTextEditor.FakeCaret.Offset = newCaretOffset; - fakeTextEditor.FakeDocument.Text = "aethod("; - TextChangeEventArgs e = CreateInsertedTextChangeEventArgs(newCaretOffset, "a"); - fakeInsightWindow.FireDocumentChangedEvent(e); - - bool closed = fakeInsightWindow.IsClosed; - Assert.IsTrue(closed); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonSocketLibraryDocumentationTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonSocketLibraryDocumentationTestFixture.cs deleted file mode 100644 index c7c1d43961..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/PythonSocketLibraryDocumentationTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Modules; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Completion -{ - /// - /// Tests that the documentation is taken from the Documentation attribute for the method/field in the - /// python module classes. - /// - [TestFixture] - public class PythonSocketLibraryDocumentationTestFixture - { - PythonModuleCompletionItems completionItems; - - [SetUp] - public void Init() - { - PythonStandardModuleType moduleType = new PythonStandardModuleType(typeof(PythonSocket), "socket"); - completionItems = PythonModuleCompletionItemsFactory.Create(moduleType); - } - - [Test] - public void DocumentationForCreateConnectionMethodTakenFromDocumentationAttribute() - { - string doc = - "Connect to *address* and return the socket object.\n" + - "\n" + - "Convenience function. Connect to *address* (a 2-tuple ``(host,\nport)``) and return the socket object. Passing the optional\n" + - "*timeout* parameter will set the timeout on the socket instance\nbefore attempting to connect. If no *timeout* is supplied, the\n" + - "global default timeout setting returned by :func:`getdefaulttimeout`\n" + - "is used.\n"; - - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("create_connection", completionItems); - Assert.AreEqual(doc, method.Documentation); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/SysModuleMembersInPythonContextTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/SysModuleMembersInPythonContextTestFixture.cs deleted file mode 100644 index c0336088bd..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Completion/SysModuleMembersInPythonContextTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using IronPython.Hosting; -using IronPython.Modules; -using IronPython.Runtime; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; - -namespace PythonBinding.Tests.Completion -{ - [TestFixture] - public class SysModuleMembersInPythonContextTestFixture - { - IList membersFromSystemState; - object sysModuleFromBuiltinModuleDictionaryObject; - - [SetUp] - public void Init() - { - ScriptEngine engine = Python.CreateEngine(); - PythonContext context = HostingHelpers.GetLanguageContext(engine) as PythonContext; - - membersFromSystemState = context.GetMemberNames(context.SystemState); - - sysModuleFromBuiltinModuleDictionaryObject = null; - context.BuiltinModuleDict.TryGetValue("sys", out sysModuleFromBuiltinModuleDictionaryObject); - } - - [Test] - public void ExitMethodIsMemberOfSystemState() - { - Assert.IsTrue(membersFromSystemState.Contains("exit")); - } - - [Test] - public void SysModuleFromBuiltinModuleDictionary() - { - Assert.IsNull(sysModuleFromBuiltinModuleDictionaryObject); - } - - [Test] - public void PathIsMemberOfSystemState() - { - Assert.IsTrue(membersFromSystemState.Contains("path")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs deleted file mode 100644 index c119cc5efd..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Configuration -{ - /// - /// Tests the AddInOptions class. - /// - [TestFixture] - public class AddInOptionsTestFixture - { - PythonAddInOptions options; - Properties properties; - AddIn addin; - - [TestFixtureSetUp] - public void SetUpFixture() - { - AddInPathHelper helper = new AddInPathHelper("PythonBinding"); - addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"C:\Projects\SD\AddIns\Python\pythonbinding.addin"; - } - - [SetUp] - public void Init() - { - properties = new Properties(); - options = new PythonAddInOptions(properties); - } - - [Test] - public void DefaultPythonConsoleFileNameIsPythonAddInPathCombinedWithIpyExe() - { - string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe"; - Assert.AreEqual(expectedFileName, options.PythonFileName); - } - - [Test] - public void RequestingPythonFileNameWhenPythonConsoleFileNameSetToNullReturnsDefaultPythonConsoleFileName() - { - options.PythonFileName = null; - string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe"; - Assert.AreEqual(expectedFileName, options.PythonFileName); - } - - [Test] - public void RequestingPythonFileNameWhenPythonConsoleFileNameToEmptyStringReturnsDefaultPythonConsoleFileName() - { - options.PythonFileName = String.Empty; - string expectedFileName = @"C:\Projects\SD\AddIns\Python\ipy.exe"; - Assert.AreEqual(expectedFileName, options.PythonFileName); - } - - [Test] - public void SetPythonConsoleFileNameUpdatesAddInOptionsPythonFileName() - { - string fileName = @"C:\IronPython\ipy.exe"; - options.PythonFileName = fileName; - Assert.AreEqual(fileName, options.PythonFileName); - } - - [Test] - public void SetPythonConsoleFileNameUpdatesProperties() - { - string fileName = @"C:\IronPython\ipy.exe"; - options.PythonFileName = fileName; - Assert.AreEqual(fileName, properties["PythonFileName"]); - } - - [Test] - public void PythonLibraryPathTakenFromProperties() - { - string expectedPythonLibraryPath = @"c:\python26\lib;c:\python26\lib\lib-tk"; - properties["PythonLibraryPath"] = expectedPythonLibraryPath; - Assert.AreEqual(expectedPythonLibraryPath, options.PythonLibraryPath); - } - - [Test] - public void DefaultPythonLibraryPathIsEmptyString() - { - Assert.AreEqual(String.Empty, options.PythonLibraryPath); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/BuiltinCodeCompletionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/BuiltinCodeCompletionTestFixture.cs deleted file mode 100644 index 7e857820f7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/BuiltinCodeCompletionTestFixture.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit; -using ICSharpCode.AvalonEdit.CodeCompletion; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Console; -using ICSharpCode.Scripting.Tests.Utils; -using Microsoft.Scripting.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Console -{ - /// - /// Tests the code completion when the user has typed in __builtins__. - /// - [TestFixture] - public class BuiltinCodeCompletionTestFixture - { - ICompletionData[] completionItems; - ICompletionData[] expectedCompletionItems; - ScriptingConsoleCompletionDataProvider provider; - MockMemberProvider memberProvider; - - [TestFixtureSetUp] - public void SetUpFixture() - { - TextEditor textEditorControl = new TextEditor(); - textEditorControl.Text = ">>> __builtins__"; - ScriptingConsoleTextEditor textEditor = new ScriptingConsoleTextEditor(textEditorControl); - - memberProvider = new MockMemberProvider(); - memberProvider.SetMemberNames(new string[] {"a", "b", "c"}); - expectedCompletionItems = CreateCompletionItems(memberProvider.GetMemberNames("__builtins__")); - - provider = new ScriptingConsoleCompletionDataProvider(memberProvider); - completionItems = provider.GenerateCompletionData(textEditor); - } - - [Test] - public void MoreThanOneCompletionItem() - { - Assert.IsTrue(completionItems.Length > 0); - } - - [Test] - public void ExpectedCompletionItems() - { - for (int i = 0; i < expectedCompletionItems.Length; ++i) { - Assert.AreEqual(expectedCompletionItems[i].Text, completionItems[i].Text); - } - } - - [Test] - public void ExpectedCompletionItemsCountEqualsActualCompletionItemsCount() - { - Assert.AreEqual(expectedCompletionItems.Length, completionItems.Length); - } - - [Test] - public void BuiltinsPassedToMemberProvider() - { - Assert.AreEqual("__builtins__", memberProvider.GetMemberNamesParameter); - } - - ICompletionData[] CreateCompletionItems(IList memberNames) - { - List items = new List(); - foreach (string memberName in memberNames) { - items.Add(new ScriptingConsoleCompletionData(memberName)); - } - return items.ToArray(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs deleted file mode 100644 index 71fdb9fd3d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHostTests.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.AvalonEdit; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Hosting; -using IronPython.Runtime; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Console -{ - /// - /// Basic tests for the PythonConsoleHost class. - /// - [TestFixture] - public class PythonConsoleHostTests - { - DerivedPythonConsoleHost host; - TextEditor textEditorControl; - ScriptingConsoleTextEditor textEditor; - - [TestFixtureSetUp] - public void Init() - { - textEditorControl = new TextEditor(); - textEditor = new ScriptingConsoleTextEditor(textEditorControl); - host = new DerivedPythonConsoleHost(textEditor); - - ScriptRuntime runtime = IronPython.Hosting.Python.CreateRuntime(); - } - - [TestFixtureTearDown] - public void TearDown() - { - host.Dispose(); - } - - [Test] - public void PythonConsoleHostIsMicrosoftScriptingConsoleHostType() - { - Assert.IsInstanceOf(typeof(ConsoleHost), host); - } - - [Test] - public void OptionsParserCreatedIsPythonOptionsParser() - { - OptionsParser parser = host.CallCreateOptionsParser(); - Assert.IsInstanceOf(typeof(PythonOptionsParser), parser); - } - - [Test] - public void CommandLineCreatedIsPythonCommandLine() - { - CommandLine commandLine = host.CallCreateCommandLine(); - Assert.IsInstanceOf(typeof(PythonCommandLine), commandLine); - } - - [Test] - public void ConsoleCreatedIsPythonConsole() - { - IConsole console = host.CallCreateConsole(null, null, null); - Assert.IsInstanceOf(typeof(PythonConsole), console); - } - - [Test] - public void PythonContextIsProvider() - { - Assert.AreEqual(typeof(PythonContext), host.GetProvider()); - } - - [Test] - public void ConsoleHostImplementsIDisposable() - { - Assert.IsNotNull(host as IDisposable); - } - - /// - /// Makes sure the Dispose method checks if the python console is null before trying to dispose it. - /// - [Test] - public void DisposingPythonConsoleHostWithoutCreatingPythonConsole() - { - PythonConsoleHost host = new PythonConsoleHost(new FakeConsoleTextEditor(), new FakeControlDispatcher()); - host.Dispose(); - } - - [Test] - public void DefaultOutputStreamReplacedByCustomStreamClass() - { - host.CallCreateConsole(null, null, null); - Assert.IsNotNull(host.OutputStream); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AddHandlerConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AddHandlerConversionTestFixture.cs deleted file mode 100644 index 92e0d174e0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AddHandlerConversionTestFixture.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that assigning a method to an event handler is converted - /// from C# to Python correctly. - /// - [TestFixture] - public class AddHandlerConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{" + - "\t\tbutton = new Button();\r\n" + - "\t\tbutton.Click += ButtonClick;\r\n" + - "\t\tbutton.MouseDown += self.OnMouseDown;\r\n" + - "\t}\r\n" + - "\r\n" + - "\tvoid ButtonClick(object sender, EventArgs e)\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "\r\n" + - "\tvoid OnMouseDown(object sender, EventArgs e)\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tbutton = Button()\r\n" + - "\t\tbutton.Click += self.ButtonClick\r\n" + - "\t\tbutton.MouseDown += self.OnMouseDown\r\n" + - "\r\n" + - "\tdef ButtonClick(self, sender, e):\r\n" + - "\t\tpass\r\n" + - "\r\n" + - "\tdef OnMouseDown(self, sender, e):\r\n" + - "\t\tpass"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayCastConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayCastConversionTestFixture.cs deleted file mode 100644 index 48c076fdff..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayCastConversionTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that an array cast is correctly converted to Python. - /// - [TestFixture] - public class ArrayCastConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Assign()\r\n" + - " {\r\n" + - " int[] elements = new int[10];\r\n" + - " List list = new List();\r\n" + - " list.Add((int[])elements.Clone());\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " def Assign(self):\r\n" + - " elements = Array.CreateInstance(int, 10)\r\n" + - " list = List[Array[int]]()\r\n" + - " list.Add(elements.Clone())"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayConversionTestFixture.cs deleted file mode 100644 index 6a3de7ad02..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ArrayConversionTestFixture.cs +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that an array is converted from C# to Python. - /// - [TestFixture] - public class ArrayConversionTestFixture - { - string integerArray = "class Foo\r\n" + - "{\r\n" + - " public int[] Run()\r\n" + - " {" + - " int[] i = new int[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string int32Array = "class Foo\r\n" + - "{\r\n" + - " public Int32[] Run()\r\n" + - " {" + - " Int32[] i = new Int32[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string uintArray = "class Foo\r\n" + - "{\r\n" + - " public uint[] Run()\r\n" + - " {" + - " uint[] i = new uint[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string stringArray = "class Foo\r\n" + - "{\r\n" + - " public string[] Run()\r\n" + - " {" + - " string[] i = new string[] {\"a\", \"b\"};\r\n" + - " i[0] = \"c\";\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string barArray = "class Foo\r\n" + - "{\r\n" + - " public string[] Run()\r\n" + - " {" + - " Bar[] i = new Bar[] { new Bar(), new Bar()};\r\n" + - " i[0] = new Bar();\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string uriArray = "class Foo\r\n" + - "{\r\n" + - " public Uri[] Run()\r\n" + - " {" + - " Uri[] i = new Uri[] {new Uri(\"a\"), new Uri(\"b\")};\r\n" + - " i[0] = new Uri(\"c\");\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedIntegerArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[int]((1, 2, 3, 4))\r\n" + - " i[0] = 5\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(integerArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedStringArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[str]((\"a\", \"b\"))\r\n" + - " i[0] = \"c\"\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(stringArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedBarArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[Bar]((Bar(), Bar()))\r\n" + - " i[0] = Bar()\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(barArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedUriArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[Uri]((Uri(\"a\"), Uri(\"b\")))\r\n" + - " i[0] = Uri(\"c\")\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(uriArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedUIntArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[UInt32]((1, 2, 3, 4))\r\n" + - " i[0] = 5\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(uintArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedInt32ArrayCode() - { - string expectedCode = "class Foo(object):\r\n" + - " def Run(self):\r\n" + - " i = Array[int]((1, 2, 3, 4))\r\n" + - " i[0] = 5\r\n" + - " return i"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(int32Array); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs deleted file mode 100644 index e2fab111c4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests ArithmeticOperatorType conversions: - /// - /// None, - /// Assign, - /// - /// Add, Done - /// Subtract, - /// Multiply, - /// Divide, - /// Modulus, - /// - /// Power, // (VB only) - /// DivideInteger, // (VB only) - /// ConcatString, // (VB only) - /// - /// ShiftLeft, - /// ShiftRight, - /// - /// BitwiseAnd, - /// BitwiseOr, - /// ExclusiveOr - /// - [TestFixture] - public class AssignmentOperatorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Convert(int a)\r\n" + - "\t{\r\n" + - "\t\ta ASSIGNMENT_OPERATOR 5;\r\n" + - "\t}\r\n" + - "}"; - - string vb = "Namespace DefaultNamespace\r\n" + - "\tPublic Class Foo\r\n" + - "\t\tPublic Sub Convert(ByVal a as Integer)\r\n" + - "\t\t\ta ASSIGNMENT_OPERATOR 5;\r\n" + - "\t\tEnd Sub\r\n" + - "\tEnd Class\r\n" + - "End Namespace"; - - string pythonCodeTemplate = "class Foo(object):\r\n" + - "\tdef Convert(self, a):\r\n" + - "\t\ta ASSIGNMENT_OPERATOR 5"; - - [Test] - public void MultiplyOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "*=")); - string expectedPython = GetCode(pythonCodeTemplate, "*="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void DivideOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "/=")); - string expectedPython = GetCode(pythonCodeTemplate, "/="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void AndOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "&=")); - string expectedPython = GetCode(pythonCodeTemplate, "&="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void OrOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "|=")); - string expectedPython = GetCode(pythonCodeTemplate, "|="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void ExclusiveOrOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "^=")); - string expectedPython = GetCode(pythonCodeTemplate, "^="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void ShiftLeftOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, "<<=")); - string expectedPython = GetCode(pythonCodeTemplate, "<<="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void ShiftRightOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(GetCode(csharp, ">>=")); - string expectedPython = GetCode(pythonCodeTemplate, ">>="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void VBConcatOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - string python = converter.Convert(GetCode(vb, "&=")); - string expectedPython = GetCode(pythonCodeTemplate, "+="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void VBDivideIntegerOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - string python = converter.Convert(GetCode(vb, "\\=")); - string expectedPython = GetCode(pythonCodeTemplate, "/="); - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void VBPowerOperator() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - string python = converter.Convert(GetCode(vb, "^=")); - string expectedPython = GetCode(pythonCodeTemplate, "**="); - - Assert.AreEqual(expectedPython, python); - } - - string GetCode(string code, string assignmentOperator) - { - return code.Replace("ASSIGNMENT_OPERATOR", assignmentOperator); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassConversionTestFixture.cs deleted file mode 100644 index 70892d2461..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassConversionTestFixture.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class BaseClassConversionTestFixture - { - string csharp = - "class Foo : Bar, IMyInterface\r\n" + - "{\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = - "class Foo(Bar, IMyInterface):\r\n" + - " pass"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassReferenceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassReferenceTestFixture.cs deleted file mode 100644 index 4a8101bed8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BaseClassReferenceTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that a base class reference through the base keyword - /// is converted to the self keyword in Python when converting - /// from C# to Python correctly. - /// - [TestFixture] - public class BaseClassReferenceTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic string Run()\r\n" + - "\t{" + - "\t\treturn base.ToString();\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\treturn self.ToString()"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BinaryOperatorConversionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BinaryOperatorConversionTests.cs deleted file mode 100644 index a1ce587357..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BinaryOperatorConversionTests.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Ast; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that all the binary operators are converted to - /// Python correctly. - /// - [TestFixture] - public class BinaryOperatorConversionTests - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int Run(i)\r\n" + - "\t{\r\n" + - "\t\tif (i BINARY_OPERATOR 0) {\r\n" + - "\t\t\treturn 10;\r\n" + - "\t\t}\r\n" + - "\treturn 0;\r\n" + - "}"; - - [Test] - public void GreaterThan() - { - Assert.AreEqual(">", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.GreaterThan)); - } - - [Test] - public void NotEqual() - { - Assert.AreEqual("!=", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.InEquality)); - } - - [Test] - public void Divide() - { - Assert.AreEqual("/", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.Divide)); - } - - [Test] - public void LessThan() - { - Assert.AreEqual("<", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.LessThan)); - } - - [Test] - public void Equals() - { - string code = GetCode(@"=="); - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string pythonCode = converter.Convert(code); - string expectedPythonCode = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\tif i == 0:\r\n" + - "\t\t\treturn 10\r\n" + - "\t\treturn 0"; - Assert.AreEqual(expectedPythonCode, pythonCode); - } - - [Test] - public void LessThanOrEqual() - { - Assert.AreEqual("<=", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.LessThanOrEqual)); - } - - [Test] - public void GreaterThanOrEqual() - { - Assert.AreEqual(">=", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.GreaterThanOrEqual)); - } - - [Test] - public void Add() - { - Assert.AreEqual("+", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.Add)); - } - - [Test] - public void Multiply() - { - Assert.AreEqual("*", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.Multiply)); - } - - [Test] - public void BitwiseAnd() - { - Assert.AreEqual("&", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.BitwiseAnd)); - } - - [Test] - public void BitwiseOr() - { - Assert.AreEqual("|", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.BitwiseOr)); - } - - [Test] - public void BooleanAnd() - { - Assert.AreEqual("and", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.LogicalAnd)); - } - - [Test] - public void BooleanOr() - { - Assert.AreEqual("or", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.LogicalOr)); - } - - [Test] - public void BooleanXor() - { - Assert.AreEqual("^", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.ExclusiveOr)); - } - - [Test] - public void Modulus() - { - Assert.AreEqual("%", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.Modulus)); - } - - [Test] - public void Subtract() - { - Assert.AreEqual("-", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.Subtract)); - } - - [Test] - public void DivideInteger() - { - Assert.AreEqual("/", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.DivideInteger)); - } - - [Test] - public void ReferenceEquality() - { - Assert.AreEqual("is", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.ReferenceEquality)); - } - - [Test] - public void BitShiftRight() - { - Assert.AreEqual(">>", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.ShiftRight)); - } - - [Test] - public void BitShiftLeft() - { - Assert.AreEqual("<<", NRefactoryToPythonConverter.GetBinaryOperator(BinaryOperatorType.ShiftLeft)); - } - - /// - /// Gets the C# code with the binary operator replaced with the - /// specified string. - /// - string GetCode(string op) - { - return csharp.Replace("BINARY_OPERATOR", op); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BitShiftConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BitShiftConversionTestFixture.cs deleted file mode 100644 index 438d27716f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BitShiftConversionTestFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class BitShiftConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int Convert()\r\n" + - "\t{\r\n" + - "\t\tint a = (b >> 16) & 0xffff;\r\n" + - "\t\treturn a;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Convert(self):\r\n" + - "\t\ta = (b >> 16) & 0xffff\r\n" + - "\t\treturn a"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BooleanConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BooleanConversionTestFixture.cs deleted file mode 100644 index bdc2f299c5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BooleanConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class BooleanVariableConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tbool a;\r\n" + - "\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\ta = true;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._a = True"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs deleted file mode 100644 index 2cc2aeffc6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that a break statement is converted correctly. - /// - [TestFixture] - public class BreakAndContinueConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run()\r\n" + - "\t{\r\n" + - "\t\tint i = 0;\r\n" + - "\t\twhile (i < 10) {\r\n" + - "\t\t\tif (i == 5) {\r\n" + - "\t\t\t\tbreak;\r\n" + - "\t\t} else {\r\n" + - "\t\t\tcontinue;\r\n" + - "\t\t}\r\n" + - "\t\ti++;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\ti = 0\r\n" + - "\t\twhile i < 10:\r\n" + - "\t\t\tif i == 5:\r\n" + - "\t\t\t\tbreak\r\n" + - "\t\t\telse:\r\n" + - "\t\t\t\tcontinue\r\n" + - "\t\t\ti += 1"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs deleted file mode 100644 index 6a1ee01186..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class. Python's namespaces - /// are determined by the file the code is in so there are no - /// explicit namespace expression. - /// - [TestFixture] - public class CSharpClassWithNamespaceConversionTestFixture - { - string csharp = "namespace MyNamespace\r\n" + - "{\r\n" + - "\tclass Foo\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs deleted file mode 100644 index f393e89d8d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that parameters passed to a constructor are converted to Python correctly. - /// - [TestFixture] - public class CallConstructorWithParametersConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tBar b = new Bar(0, 0, 1, 10);\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tb = Bar(0, 0, 1, 10)"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassConstructorConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassConstructorConversionTestFixture.cs deleted file mode 100644 index 2f5a3f15be..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassConstructorConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a class constructor. - /// - [TestFixture] - public class ClassConstructorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassDestructorConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassDestructorConversionTestFixture.cs deleted file mode 100644 index a7b0693d82..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassDestructorConversionTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a class destructor. - /// - [TestFixture] - public class ClassDestructorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i = 10;\r\n" + - "\tpublic ~Foo()\r\n" + - "\t{\r\n" + - "\t\ti = 0;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 10\r\n" + - "\r\n" + - "\tdef __del__(self):\r\n" + - "\t\tself._i = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassFieldReferenceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassFieldReferenceTestFixture.cs deleted file mode 100644 index 288b3e9fc7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ClassFieldReferenceTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that the keyword this is used when an explicit reference to a field is used. - /// Also tests that any constructor parameters are generated. - /// - [TestFixture] - public class ClassFieldReferenceConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i;\r\n" + - "\tint j;\r\n" + - "\tpublic Foo(int i)\r\n" + - "\t{\r\n" + - "\t\tthis.i = i;\r\n" + - "\t}\r\n" + - "\r\n" + - "\tpublic void SetInt(int j)\r\n" + - "\t{\r\n" + - "\t\tthis.j = j;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self, i):\r\n" + - "\t\tself._i = i\r\n" + - "\r\n" + - "\tdef SetInt(self, j):\r\n" + - "\t\tself._j = j"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertCSharpToPythonMenuCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertCSharpToPythonMenuCommandTestFixture.cs deleted file mode 100644 index a0c5d4fe39..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertCSharpToPythonMenuCommandTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ConvertCSharpToPythonMenuCommandTestFixture : ConvertToPythonMenuCommand - { - string newFileText; - string defaultFileName; - string language; - - [TestFixtureSetUp] - public void SetUpFixture() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent("test.cs"); - workbench.ActiveMockEditableViewContent.Text = "class Foo { }"; - - MockTextEditorOptions options = workbench.ActiveMockEditableViewContent.MockTextEditorOptions; - options.IndentationSize = 4; - options.ConvertTabsToSpaces = true; - - Run(workbench); - } - - [Test] - public void Run_CSharpFileOpen_PythonCodeGeneratedInNewFile() - { - string code = - "class Foo(object):\r\n" + - " pass"; - Assert.AreEqual(code, newFileText); - } - - [Test] - public void Run_CSharpFileOpen_NewFileNameIsGeneratedPy() - { - Assert.AreEqual("Generated.py", defaultFileName); - } - - [Test] - public void Run_CSharpFileOpen_NewFileLanguageIsPython() - { - Assert.AreEqual("Python", language); - } - - protected override void NewFile(string defaultName, string language, string content) - { - defaultFileName = defaultName; - this.language = language; - newFileText = content; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs deleted file mode 100644 index b5710a0215..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertToPythonProjectCommandTestFixture.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using System.Text; -using ICSharpCode.Core; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ConvertToPythonProjectCommandTestFixture - { - DerivedConvertProjectToPythonProjectCommand convertProjectCommand; - FileProjectItem source; - FileProjectItem target; - MockProject sourceProject; - PythonProject targetProject; - FileProjectItem textFileSource; - FileProjectItem textFileTarget; - ReferenceProjectItem ironPythonReference; - string sourceCode = - "class Foo\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - - List bindings = new List(); - using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { - AddIn addin = AddIn.Load(reader, String.Empty); - bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python"))); - } - ProjectBindingService.SetBindings(bindings); - - convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand(); - convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode; - - sourceProject = new MockProject(); - sourceProject.Directory = @"d:\projects\test"; - source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs"); - targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); - target = new FileProjectItem(targetProject, source.ItemType, source.Include); - source.CopyMetadataTo(target); - - textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt"); - textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include); - textFileSource.CopyMetadataTo(textFileTarget); - - foreach (ProjectItem item in targetProject.Items) { - ReferenceProjectItem reference = item as ReferenceProjectItem; - if ((reference != null) && (reference.Name == "IronPython")) { - ironPythonReference = reference; - break; - } - } - - convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode); - - convertProjectCommand.CallConvertFile(source, target); - convertProjectCommand.CallConvertFile(textFileSource, textFileTarget); - } - - [Test] - public void CommandHasPythonTargetLanguage() - { - Assert.AreEqual(PythonProjectBinding.LanguageName, convertProjectCommand.TargetLanguageName); - } - - [Test] - public void TargetFileExtensionChanged() - { - Assert.AreEqual(@"src\Program.py", target.Include); - } - - [Test] - public void TextFileTargetFileExtensionUnchanged() - { - Assert.AreEqual(@"src\readme.txt", textFileTarget.Include); - } - - [Test] - public void FilesPassedToBaseClassForConversion() - { - List expectedFiles = new List(); - expectedFiles.Add(new SourceAndTargetFile(textFileSource, textFileTarget)); - Assert.AreEqual(expectedFiles, convertProjectCommand.SourceAndTargetFilesPassedToBaseClass); - } - - [Test] - public void ExpectedCodeWrittenToFile() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(); - string expectedCode = converter.Convert(sourceCode, SupportedLanguage.CSharp) + - "\r\n" + - "\r\n" + - converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - - List expectedSavedFiles = new List(); - expectedSavedFiles.Add(new ConvertedFile(target.FileName, expectedCode, Encoding.Unicode)); - Assert.AreEqual(expectedSavedFiles, convertProjectCommand.SavedFiles); - } - - [Test] - public void IronPythonReferenceAddedToProject() - { - Assert.IsNotNull(ironPythonReference, "No IronPython reference added to converted project."); - } - - [Test] - public void IronPythonReferenceHintPath() - { - Assert.AreEqual(@"$(PythonBinPath)\IronPython.dll", ironPythonReference.GetMetadata("HintPath")); - } - - [Test] - public void MainFileIsProgramPyFile() - { - PropertyStorageLocations location; - Assert.AreEqual(@"src\Program.py", targetProject.GetProperty(null, null, "MainFile", out location)); - } - - [Test] - public void PropertyStorageLocationForMainFilePropertyIsGlobal() - { - PropertyStorageLocations location; - targetProject.GetProperty(null, null, "MainFile", out location); - Assert.AreEqual(PropertyStorageLocations.Base, location); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertVBNetToPythonMenuCommandTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertVBNetToPythonMenuCommandTestFixture.cs deleted file mode 100644 index 62f50ccc0e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConvertVBNetToPythonMenuCommandTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ConvertVBNetToPythonMenuCommandTestFixture : ConvertToPythonMenuCommand - { - string newFileText; - string defaultFileName; - string language; - - [SetUp] - public void Init() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent("test.vb"); - workbench.ActiveMockEditableViewContent.Text = - "class Foo\r\n" + - "end class"; - - MockTextEditorOptions options = workbench.ActiveMockEditableViewContent.MockTextEditorOptions; - options.ConvertTabsToSpaces = false; - options.IndentationSize = 2; - - Run(workbench); - } - - [Test] - public void Run_VBNetFileOpen_PythonCodeIsSavedInFileCreated() - { - string expectedNewFileText = - "class Foo(object):\r\n" + - "\tpass"; - - Assert.AreEqual(expectedNewFileText, newFileText); - } - - [Test] - public void Run_VBNetFileOpen_NewFileNameIsGeneratedPy() - { - Assert.AreEqual("Generated.py", defaultFileName); - } - - [Test] - public void Run_VBNetFileOpen_NewFileLanguageIsPython() - { - Assert.AreEqual("Python", language); - } - - protected override void NewFile(string defaultName, string language, string content) - { - defaultFileName = defaultName; - this.language = language; - newFileText = content; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConverterSupportedLanguageTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConverterSupportedLanguageTests.cs deleted file mode 100644 index 428a3f64e4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ConverterSupportedLanguageTests.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.NRefactory; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ConverterSupportedLanguageTests - { - [Test] - public void CSharpSupportedLanguage() - { - NRefactoryToPythonConverter converter = NRefactoryToPythonConverter.Create(".cs"); - Assert.AreEqual(SupportedLanguage.CSharp, converter.SupportedLanguage); - } - - [Test] - public void VBNetSupportedLanguage() - { - NRefactoryToPythonConverter converter = NRefactoryToPythonConverter.Create(".vb"); - Assert.AreEqual(SupportedLanguage.VBNet, converter.SupportedLanguage); - } - - [Test] - public void CSharpCaseInsensitive() - { - NRefactoryToPythonConverter converter = NRefactoryToPythonConverter.Create(".CS"); - Assert.AreEqual(SupportedLanguage.CSharp, converter.SupportedLanguage); - } - - [Test] - public void NullFileName() - { - Assert.IsNull(NRefactoryToPythonConverter.Create(null)); - } - - [Test] - public void TextFileCannotBeConverted() - { - Assert.IsNull(NRefactoryToPythonConverter.Create(".txt")); - } - - [Test] - public void CanConvertCSharpFiles() - { - Assert.IsTrue(NRefactoryToPythonConverter.CanConvert(".cs")); - } - - [Test] - public void CanConvertVBNetFiles() - { - Assert.IsTrue(NRefactoryToPythonConverter.CanConvert(".vb")); - } - - [Test] - public void CanConvertIsCaseInsensitive() - { - Assert.IsTrue(NRefactoryToPythonConverter.CanConvert(".CS")); - } - - [Test] - public void CannotConvertTextFile() - { - Assert.IsFalse(NRefactoryToPythonConverter.CanConvert(".txt")); - } - - [Test] - public void CannotConvertNullFileName() - { - Assert.IsFalse(NRefactoryToPythonConverter.CanConvert(null)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs deleted file mode 100644 index b3d7fcd283..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Converts a C# else if statement to Python's elif. - /// - [TestFixture] - public class ElseIfStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int GetCount(i)\r\n" + - "\t{" + - "\t\tif (i == 0) {\r\n" + - "\t\t\treturn 10;\r\n" + - "\t\t} else if (i < 1){\r\n" + - "\t\t\treturn 4;\r\n" + - "\t\t}\r\n" + - "\t\treturn 2;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef GetCount(self, i):\r\n" + - "\t\tif i == 0:\r\n" + - "\t\t\treturn 10\r\n" + - "\t\telif i < 1:\r\n" + - "\t\t\treturn 4\r\n" + - "\t\treturn 2"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs deleted file mode 100644 index 04bda011b2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class. - /// - [TestFixture] - public class EmptyCSharpClassConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tpass"; - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void ConvertedPythonCodeUsingFourSpacesAsIndent() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = new String(' ', 4); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " pass"; - - Assert.AreEqual(expectedPython, python); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs deleted file mode 100644 index a14a42c014..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that an event handler such as button1.Click += new EventHandler(Button1Click) is converted - /// to Python correctly. - /// - [TestFixture] - public class EventHandlerWithObjectCreationTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{" + - "\t\tbutton = new Button();\r\n" + - "\t\tbutton.Click += new EventHandler(ButtonClick);\r\n" + - "\t}\r\n" + - "\r\n" + - "\tvoid ButtonClick(object sender, EventArgs e)\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tbutton = Button()\r\n" + - "\t\tbutton.Click += self.ButtonClick\r\n" + - "\r\n" + - "\tdef ButtonClick(self, sender, e):\r\n" + - "\t\tpass"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs deleted file mode 100644 index 68c6114635..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the C# to Python converter does not add an - /// assignment for a variable declaration that has no - /// initial value assigned. - /// - [TestFixture] - public class FieldDeclarationWithNoInitializerTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tprivate int i;\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tint j = 0;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tj = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs deleted file mode 100644 index e036748ecb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForLoopConversionTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of a for loop to Python. - /// - /// C#: - /// - /// for (int i = 0; i < 5; ++i) { - /// } - /// - /// Python: - /// - /// i = 0 - /// while i < 5 - /// i = i + 1 - /// - /// Ideally we would convert it to: - /// - /// for i in range(0, 5): - /// pass - /// - [TestFixture] - public class ForLoopConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{\r\n" + - "\t\tint count = 0;\r\n" + - "\t\tfor (int i = 0; i < 5; i = i + 1) {\r\n" + - "\t\t\tcount++;\r\n" + - "\t\t}\r\n" + - "\t\treturn count;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - string expectedCode = "class Foo(object):\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\tcount = 0\r\n" + - "\t\ti = 0\r\n" + - "\t\twhile i < 5:\r\n" + - "\t\t\tcount += 1\r\n" + - "\t\t\ti = i + 1\r\n" + - "\t\treturn count"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForNextConversionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForNextConversionTests.cs deleted file mode 100644 index 75a397b1c6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForNextConversionTests.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ForNextConversionTests - { - string vbnetForNextCode = - "Public Class Foo\r\n" + - " Public Function GetCount() As Integer\r\n" + - " Dim count As Integer = 0\r\n" + - " For i As Integer = 0 To 4\r\n" + - " count += 1\r\n" + - " Next\r\n" + - " Return count\r\n" + - " End Function\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertVBNetForNextToPython() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string code = converter.Convert(vbnetForNextCode); - string expectedCode = - "class Foo(object):\r\n" + - " def GetCount(self):\r\n" + - " count = 0\r\n" + - " i = 0\r\n" + - " while i <= 4:\r\n" + - " count += 1\r\n" + - " i = i + 1\r\n" + - " return count"; - - Assert.AreEqual(expectedCode, code); - } - - string vbnetForNextWithStepCode = - "Public Class Foo\r\n" + - " Public Function GetCount() As Integer\r\n" + - " Dim count As Integer = 0\r\n" + - " For i As Integer = 0 To 4 Step 2\r\n" + - " count += 1\r\n" + - " Next\r\n" + - " Return count\r\n" + - " End Function\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertVBNetForNextWithStepToPython() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string code = converter.Convert(vbnetForNextWithStepCode ); - string expectedCode = - "class Foo(object):\r\n" + - " def GetCount(self):\r\n" + - " count = 0\r\n" + - " i = 0\r\n" + - " while i <= 4:\r\n" + - " count += 1\r\n" + - " i = i + 2\r\n" + - " return count"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionTestFixture.cs deleted file mode 100644 index 5786aa754a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionTestFixture.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of a foreach loop to Python. - /// - [TestFixture] - public class ForeachConversionTestFixture - { - string intArrayCode = "class Foo\r\n" + - "{\r\n" + - " public int GetCount(int[] items)\r\n" + - " {\r\n" + - " int count = 0;\r\n" + - " foreach (int item in items) {\r\n" + - " count++;\r\n" + - " }\r\n" + - " return count;\r\n" + - " }\r\n" + - "}"; - - string dictionaryCode = "class Foo\r\n" + - "{\r\n" + - " public void DisplayItems()\r\n" + - " {\r\n" + - " Dictionary record = new Dictionary();\r\n" + - " record.Add(\"a\", \"b\");\r\n" + - " record.Add(\"c\", \"d\");\r\n" + - " foreach (string key in record.Keys) {\r\n" + - " Console.WriteLine(\"Key: \" + key);\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedIntArrayCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(intArrayCode); - string expectedCode = "class Foo(object):\r\n" + - " def GetCount(self, items):\r\n" + - " count = 0\r\n" + - " enumerator = items.GetEnumerator()\r\n" + - " while enumerator.MoveNext():\r\n" + - " item = enumerator.Current\r\n" + - " count += 1\r\n" + - " return count"; - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedDictionaryCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(dictionaryCode); - string expectedCode = "class Foo(object):\r\n" + - " def DisplayItems(self):\r\n" + - " record = Dictionary[str, str]()\r\n" + - " record.Add(\"a\", \"b\")\r\n" + - " record.Add(\"c\", \"d\")\r\n" + - " enumerator = record.Keys.GetEnumerator()\r\n" + - " while enumerator.MoveNext():\r\n" + - " key = enumerator.Current\r\n" + - " Console.WriteLine(\"Key: \" + key)"; - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs deleted file mode 100644 index 7adbed098b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ForeachConversionWithMethodCallTestFixture - { - string environmentSpecialFolderCode = "class Foo\r\n" + - "{\r\n" + - " public void PrintEnvironmentVariables()\r\n" + - " {\r\n" + - " foreach (Environment.SpecialFolder folder in Environment.SpecialFolder.GetValues(typeof(Environment.SpecialFolder)))\r\n" + - " {\r\n" + - " Console.WriteLine(\"{0}={1}\\n\", folder, Environment.GetFolderPath(folder));\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedEnvironmentSpecialFolderCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(environmentSpecialFolderCode); - string expectedCode = "import clr\r\n" + - "\r\n" + - "class Foo(object):\r\n" + - " def PrintEnvironmentVariables(self):\r\n" + - " enumerator = Environment.SpecialFolder.GetValues(clr.GetClrType(Environment.SpecialFolder)).GetEnumerator()\r\n" + - " while enumerator.MoveNext():\r\n" + - " folder = enumerator.Current\r\n" + - " Console.WriteLine(\"{0}={1}\\n\", folder, Environment.GetFolderPath(folder))"; - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs deleted file mode 100644 index 6e6fa8a9e2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the generation of code to call the class's Main method. - /// - [TestFixture] - public class GenerateMainMethodCallTestFixture - { - string mainMethodWithNoParametersCode = "class Foo\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " static void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedMainMethodCallWithNoParametersCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - converter.Convert(mainMethodWithNoParametersCode); - string code = converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - Assert.AreEqual("Foo.Main()", code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenericListConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenericListConversionTestFixture.cs deleted file mode 100644 index 81848aa620..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/GenericListConversionTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that the code to create an instance of a generic list is converted to python - /// correctly. - /// - /// C#: List list = new List(); - /// - /// Python: list = List[str]() - /// - [TestFixture] - public class GenericListConversionTestFixture - { - string csharp = "using System.Collections.Generic;\r\n" + - "\r\n" + - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " List list = new List();\r\n" + - " Dictionary dictionary = new Dictionary();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "from System.Collections.Generic import *\r\n" + - "\r\n" + - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " list = List[str]()\r\n" + - " dictionary = Dictionary[str, int]()"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs deleted file mode 100644 index 35cde3602e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else blocks both have more than one statement. - /// - [TestFixture] - public class IfBlockStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i = 0;\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{" + - "\t\tif (i == 0) {\r\n" + - "\t\ti = 10;\r\n" + - "\t\t\treturn 10;\r\n" + - "\t\t} else {\r\n" + - "\t\ti = 4;\r\n" + - "\t\t\treturn 4;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0\r\n" + - "\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\tif self._i == 0:\r\n" + - "\t\t\tself._i = 10\r\n" + - "\t\t\treturn 10\r\n" + - "\t\telse:\r\n" + - "\t\t\tself._i = 4\r\n" + - "\t\t\treturn 4"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfStatementConversionTestFixture.cs deleted file mode 100644 index 7323562887..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IfStatementConversionTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of a C# if-else statement to python. - /// - [TestFixture] - public class IfStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i = 0;\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{" + - "\t\tif (i == 0) {\r\n" + - "\t\t\treturn 10;\r\n" + - "\t\t} else {\r\n" + - "\t\t\treturn 4;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0\r\n" + - "\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\tif self._i == 0:\r\n" + - "\t\t\treturn 10\r\n" + - "\t\telse:\r\n" + - "\t\t\treturn 4"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IncrementAndDecrementConversionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IncrementAndDecrementConversionTests.cs deleted file mode 100644 index 3d141df137..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IncrementAndDecrementConversionTests.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that an integer increments and decrements are converted - /// from C# to Python correctly. - /// - [TestFixture] - public class IncrementAndDecrementConversionTests - { - [Test] - public void PreIncrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\t++i;\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti += 1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void PostIncrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti++;\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti += 1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void PreDecrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\t--i\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti -= 1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void PostDecrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti--\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti -= 1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void Add10() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti = i + 10\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti = i + 10"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void Add5() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti += 5\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti += 5"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void Subtract10() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti = i - 10\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti = i - 10"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void Subtract5() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run(int i)\r\n" + - "\t{\r\n" + - "\t\ti -= 5\r\n" + - "\t}\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti -= 5"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs deleted file mode 100644 index 6b4f25d307..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a class with - /// a private field that's an integer. What should happen is that - /// since Python does not have the concept of class fields all - /// fields initialized in the class are moved to the start of the - /// __init__ method. Note that this assumes there are no - /// overloaded constructors otherwise we will get duplicated code. - /// - [TestFixture] - public class IntegerClassFieldConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tprivate int i = 0;\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs deleted file mode 100644 index 227b511592..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter correctly converts the class - /// constructor when a value is assigned to one of its fields. - /// - [TestFixture] - public class IntegerClassFieldInitializedInConstructorTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tprivate int i;\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\ti = 0;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs deleted file mode 100644 index b205fe69dc..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class does not add - /// an extra constructor method to hold the statements to - /// initialize the converted class's fields. - /// - [TestFixture] - public class IntegerClassFieldWithConstructorTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tprivate int i = 0;\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tint j = 0;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0\r\n" + - "\t\tj = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerMethodParameterTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerMethodParameterTestFixture.cs deleted file mode 100644 index fb213fa37b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/IntegerMethodParameterTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that a method call is converted correctly. - /// - [TestFixture] - public class IntegerMethodParameterTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Print()\r\n" + - " {\r\n" + - " int i = 0;\r\n" + - " PrintInt(i);\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Print(self):\r\n" + - "\t\ti = 0\r\n" + - "\t\tself.PrintInt(i)"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs deleted file mode 100644 index f9960c4a4e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter correctly converts a local - /// variable in the constructor. - /// - [TestFixture] - public class LocalVariableAssignedInConstructorTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tint i = 0;\r\n" + - "\t\tint i = 2;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\ti = 0\r\n" + - "\t\ti = 2"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs deleted file mode 100644 index ae521809f0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else block have a local variable defined. - /// - [TestFixture] - public class LocalVariableDeclarationInIfStatementTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i = 0;\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{" + - "\t\tif (i == 0) {\r\n" + - "\t\t\tint j = 10;\r\n" + - "\t\t\treturn j;\r\n" + - "\t\t} else {\r\n" + - "\t\tiint j = 4;\r\n" + - "\t\t\treturn j;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0\r\n" + - "\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\tif self._i == 0:\r\n" + - "\t\t\tj = 10\r\n" + - "\t\t\treturn j\r\n" + - "\t\telse:\r\n" + - "\t\t\tj = 4\r\n" + - "\t\t\treturn j"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs deleted file mode 100644 index 8a2423e014..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class LocalVariableDefinitionsOnSameLineTests - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " int i = 0, i = 2;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " i = 0\r\n" + - " i = 2"; - - Assert.AreEqual(expectedPython, python); - } - - string vnetClassWithTwoArrayVariablesOnSameLine = - "class Foo\r\n" + - " Public Sub New()\r\n" + - " Dim i(10), j(20) as integer\r\n" + - " End Sub\r\n" + - "end class"; - - [Test] - public void ConvertVBNetClassWithTwoArrayVariablesOnSameLine() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string python = converter.Convert(vnetClassWithTwoArrayVariablesOnSameLine); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " i = Array.CreateInstance(int, 10)\r\n" + - " j = Array.CreateInstance(int, 20)"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs deleted file mode 100644 index 916e33b87b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class LocalVariableNotInitializedTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{\r\n" + - "\t\tint i;\r\n" + - "\t\treturn 10;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\treturn 10"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodCallInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodCallInConstructorTestFixture.cs deleted file mode 100644 index be784a8da7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodCallInConstructorTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Was causing a null reference exception in the convertor's IsStatic method since the method - /// being passed as a parameter is null. - /// - [TestFixture] - public class MethodCallInConstructorTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " Init();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.Init()"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodParameterConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodParameterConversionTestFixture.cs deleted file mode 100644 index 9840a90e57..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodParameterConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that method parameters are converted into Python - /// correctly. - /// - [TestFixture] - public class MethodParameterConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int Run(int i)\r\n" + - "\t{\r\n" + - "\t\treturn i;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - string expectedCode = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\treturn i"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs deleted file mode 100644 index f675079a40..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a method that - /// returns an integer. - /// - [TestFixture] - public class MethodReturnValueConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int Run()\r\n" + - "\t{\r\n" + - "\t\treturn 10;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\treturn 10"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs deleted file mode 100644 index 34296fd341..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a method with - /// simple integer assignment in the body. - /// - [TestFixture] - public class MethodWithBodyConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run()\r\n" + - "\t{\r\n" + - "\t\tint i = 0;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\ti = 0"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs deleted file mode 100644 index 3b8efd26ba..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ModulusOperatorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Convert(int a)\r\n" + - "\t{\r\n" + - "\t\ta %= 5;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Convert(self, a):\r\n" + - "\t\ta %= 5"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultiLineCommentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultiLineCommentTestFixture.cs deleted file mode 100644 index 72663b205c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultiLineCommentTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class MultiLineCommentConversionTestFixture - { - string csharp = "/* \r\n" + - "Class Foo\r\n" + - "*/ \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " /* Initialize. */\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " /* Initialize j.\r\n" + - " set to zero */\r\n" + - " j = 0; /* Set to zero */\r\n" + - " /* test */\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "# \r\n" + - "# Class Foo\r\n" + - "# \r\n" + - "class Foo(object):\r\n" + - " # Initialize.\r\n"+ - " def __init__(self):\r\n" + - " # Initialize j.\r\n" + - " # set to zero\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0:\r\n" + - " j = 2"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs deleted file mode 100644 index 59012afca5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class MultipleFieldsOnSameLineTests - { - string csharpClassWithFieldsThatHaveInitialValues = - "class Foo\r\n" + - "{\r\n" + - " int i = 0, j = 1;\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithFieldsThatHaveInitialValues() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharpClassWithFieldsThatHaveInitialValues); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._i = 0\r\n" + - " self._j = 1"; - - Assert.AreEqual(expectedPython, python); - } - - string csharpClassWithTwoFieldsWhereFirstDoesNotHaveInitialValue = - "class Foo\r\n" + - "{\r\n" + - " int i, j = 1;\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithFieldsWhereFirstFieldDoesNotHaveInitialValue() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharpClassWithTwoFieldsWhereFirstDoesNotHaveInitialValue); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._j = 1"; - - Assert.AreEqual(expectedPython, python); - } - - string csharpClassWithTwoFieldsInitializedInMethod = - "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " int j, k;\r\n" + - "\r\n" + - " public void Test()\r\n" + - " {\r\n" + - " j = 1;\r\n" + - " k = 3;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithTwoFieldsInitializedInMethod() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharpClassWithTwoFieldsInitializedInMethod); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._i = 0\r\n" + - "\r\n" + - " def Test(self):\r\n" + - " self._j = 1\r\n" + - " self._k = 3"; - - Assert.AreEqual(expectedPython, python); - } - - string vnetClassWithTwoArrayFieldsOnSameLine = - "class Foo\r\n" + - " Private i(10), j(20) as integer\r\n" + - "end class"; - - [Test] - public void ConvertVBNetClassWithTwoArrayFieldsOnSameLine() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string python = converter.Convert(vnetClassWithTwoArrayFieldsOnSameLine); - string expectedPython = - "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._i = Array.CreateInstance(int, 10)\r\n" + - " self._j = Array.CreateInstance(int, 20)"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedClassConversionTestFixture.cs deleted file mode 100644 index 33df523ec4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedClassConversionTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that the indentation after the nested class is correct for any outer class methods. - /// - [TestFixture] - public class NestedClassConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Run()\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "\r\n" + - "\t\tclass Bar\r\n" + - "\t\t{\r\n" + - "\t\t\tpublic void Test()\r\n" + - "\t\t\t{\r\n" + - "\t\t\t}\r\n" + - "\t\t}\r\n" + - "\r\n" + - "\tpublic void AnotherRun()\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\tpass\r\n" + - "\r\n" + - "\tclass Bar(object):\r\n" + - "\t\tdef Test(self):\r\n" + - "\t\t\tpass\r\n" + - "\r\n" + - "\tdef AnotherRun(self):\r\n" + - "\t\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs deleted file mode 100644 index 35b17628de..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else blocks each have nested if-else statements. - /// - [TestFixture] - public class NestedIfStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint i = 0;\r\n" + - "\tpublic int GetCount()\r\n" + - "\t{" + - "\t\tif (i == 0) {\r\n" + - "\t\t\tif (i == 0) {\r\n" + - "\t\t\t\ti = 10;\r\n" + - "\t\t\t\treturn 10;\r\n" + - "\t\t\t} else {\r\n" + - "\t\t\ti = 4;\r\n" + - "\t\t\t\treturn 4;\r\n" + - "\t\t\t}\r\n" + - "\t\t} else {\r\n" + - "\t\t\tif (i == 0) {\r\n" + - "\t\t\t\ti = 10;\r\n" + - "\t\t\t\treturn 10;\r\n" + - "\t\t\t} else {\r\n" + - "\t\t\ti = 4;\r\n" + - "\t\t\t\treturn 4;\r\n" + - "\t\t\t}\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._i = 0\r\n" + - "\r\n" + - "\tdef GetCount(self):\r\n" + - "\t\tif self._i == 0:\r\n" + - "\t\t\tif self._i == 0:\r\n" + - "\t\t\t\tself._i = 10\r\n" + - "\t\t\t\treturn 10\r\n" + - "\t\t\telse:\r\n" + - "\t\t\t\tself._i = 4\r\n" + - "\t\t\t\treturn 4\r\n" + - "\t\telse:\r\n" + - "\t\t\tif self._i == 0:\r\n" + - "\t\t\t\tself._i = 10\r\n" + - "\t\t\t\treturn 10\r\n" + - "\t\t\telse:\r\n" + - "\t\t\t\tself._i = 4\r\n" + - "\t\t\t\treturn 4"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NullConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NullConversionTestFixture.cs deleted file mode 100644 index ad2d08f299..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/NullConversionTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that null is converted to None in python. - /// - [TestFixture] - public class NullConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic int Run(string a)\r\n" + - "\t{\r\n" + - "\t\tif (a == null) {\r\n" + - "\t\t\treturn 4;\r\n" + - "\t\t}\r\n" + - "\t\treturn 2;\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, a):\r\n" + - "\t\tif a == None:\r\n" + - "\t\t\treturn 4\r\n" + - "\t\treturn 2"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectCreationTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectCreationTestFixture.cs deleted file mode 100644 index 5c4dca9c57..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectCreationTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that C# code that creates a new XmlDocument object - /// is converted to Python correctly. - /// - [TestFixture] - public class ObjectCreationTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tXmlDocument doc = new XmlDocument();\r\n" + - "\t\tdoc.LoadXml(\"\");\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tdoc = XmlDocument()\r\n" + - "\t\tdoc.LoadXml(\"\")"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs deleted file mode 100644 index eb0d59a662..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Object initializers should be converted to calling the appropriate property setters, but - /// this means a single line statement would need to be replaced with multiple statements. - /// - [TestFixture] - public class ObjectInitializerConversionTestFixture - { - string csharp = "class Class1\r\n" + - "{\r\n" + - " string name = String.Empty;\r\n" + - " string lastName = String.Empty;\r\n" + - "\r\n" + - " public string Name {\r\n" + - " get { return name; }\r\n" + - " set { name = value; }\r\n" + - " }\r\n" + - "\r\n" + - " public string LastName {\r\n" + - " get { return lastName; }\r\n" + - " set { lastName = value; }\r\n" + - " }\r\n" + - "\r\n" + - " public Class1 Clone()\r\n" + - " {\r\n" + - " return new Class1 { Name = \"First\", LastName = \"Last\" };\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Class1(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._name = String.Empty\r\n" + - "\t\tself._lastName = String.Empty\r\n" + - "\r\n" + - "\tdef get_Name(self):\r\n" + - "\t\treturn self._name\r\n" + - "\r\n" + - "\tdef set_Name(self, value):\r\n" + - "\t\tself._name = value\r\n" + - "\r\n" + - "\tName = property(fget=get_Name, fset=set_Name)\r\n" + - "\r\n" + - "\tdef get_LastName(self):\r\n" + - "\t\treturn self._lastName\r\n" + - "\r\n" + - "\tdef set_LastName(self, value):\r\n" + - "\t\tself._lastName = value\r\n" + - "\r\n" + - "\tLastName = property(fget=get_LastName, fset=set_LastName)\r\n" + - "\r\n" + - "\tdef Clone(self):\r\n" + - "\t\treturn Class1(Name = \"First\", LastName = \"Last\")"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs deleted file mode 100644 index 0a5a7dd771..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ObjectReferenceEqualsConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public bool IsEqual(object o)\r\n" + - " {\r\n" + - " return object.ReferenceEquals(o, null);\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " def IsEqual(self, o):\r\n" + - " return Object.ReferenceEquals(o, None)"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs deleted file mode 100644 index 14aae80f35..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ProjectHasStartupObjectTestFixture.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using System.Text; - -using ICSharpCode.Core; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class ProjectHasStartupObjectTestFixture - { - DerivedConvertProjectToPythonProjectCommand convertProjectCommand; - FileProjectItem mainFile; - FileProjectItem main2File; - FileProjectItem targetMainFile; - FileProjectItem targetMain2File; - MSBuildBasedProject sourceProject; - PythonProject targetProject; - ICSharpCode.Scripting.Tests.Utils.MockProjectContent mockProjectContent; - - string startupObject = "RootNamespace.Main"; - - string mainSource = "class Foo\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - string main2Source = "class Bar\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - - List bindings = new List(); - using (TextReader reader = PythonBindingAddInFile.ReadAddInFile()) { - AddIn addin = AddIn.Load(reader, String.Empty); - bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Python"))); - } - ProjectBindingService.SetBindings(bindings); - - // Set up IProjectContent so the ConvertProjectToPythonProjectCommand can - // locate the startup object and determine it's filename. - - mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent(); - MockClass mainClass = new MockClass(mockProjectContent, startupObject); - mainClass.CompilationUnit.FileName = @"d:\projects\test\src\Main2.cs"; - mockProjectContent.SetClassToReturnFromGetClass(startupObject, mainClass); - - convertProjectCommand = new DerivedConvertProjectToPythonProjectCommand(); - convertProjectCommand.ProjectContent = mockProjectContent; - convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode; - - Solution solution = new Solution(new MockProjectChangeWatcher()); - sourceProject = new MSBuildBasedProject( - new ProjectCreateInformation() { - Solution = solution, - OutputProjectFileName = @"d:\projects\test\source.csproj", - ProjectName = "source" - }); - sourceProject.Parent = solution; - sourceProject.SetProperty(null, null, "StartupObject", startupObject, PropertyStorageLocations.Base, true); - mainFile = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main.cs"); - targetProject = (PythonProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); - convertProjectCommand.CallCopyProperties(sourceProject, targetProject); - targetMainFile = new FileProjectItem(targetProject, mainFile.ItemType, mainFile.Include); - mainFile.CopyMetadataTo(targetMainFile); - - main2File = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Main2.cs"); - targetMain2File = new FileProjectItem(targetProject, main2File.ItemType, main2File.Include); - main2File.CopyMetadataTo(targetMain2File); - - convertProjectCommand.AddParseableFileContent(mainFile.FileName, mainSource); - convertProjectCommand.AddParseableFileContent(main2File.FileName, main2Source); - - convertProjectCommand.CallConvertFile(mainFile, targetMainFile); - convertProjectCommand.CallConvertFile(main2File, targetMain2File); - } - - [Test] - public void MainFileIsMain2PyFile() - { - PropertyStorageLocations location; - Assert.AreEqual(@"src\Main2.py", targetProject.GetProperty(null, null, "MainFile", out location)); - } - - [Test] - public void PropertyStorageLocationForMainFilePropertyIsGlobal() - { - PropertyStorageLocations location; - targetProject.GetProperty(null, null, "MainFile", out location); - Assert.AreEqual(PropertyStorageLocations.Base, location); - } - - [Test] - public void ClassSearchedFor() - { - Assert.AreEqual(startupObject, mockProjectContent.GetClassName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyConversionTestFixture.cs deleted file mode 100644 index ddf5a51823..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyConversionTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a C# property to - /// two get and set methods in Python. - /// - [TestFixture] - public class PropertyConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint count = 0;\r\n" + - "\tpublic int Count\r\n" + - "\t{\r\n" + - "\t\tget { return count; }\r\n" + - "\t\tset { count = value; }\r\n" + - "\t}\r\n" + - "\r\n" + - "\tpublic void Run()\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._count = 0\r\n" + - "\r\n" + - "\tdef get_Count(self):\r\n" + - "\t\treturn self._count\r\n" + - "\r\n" + - "\tdef set_Count(self, value):\r\n" + - "\t\tself._count = value\r\n" + - "\r\n" + - "\tCount = property(fget=get_Count, fset=set_Count)\r\n" + - "\r\n" + - "\tdef Run(self):\r\n" + - "\t\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs deleted file mode 100644 index ce9c12098e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class PropertyReferenceConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " public int Count {\r\n" + - " get {\r\n" + - " return count;\r\n" + - " }\r\n" + - " }\r\n" + - "\r\n" + - " public void Increment()\r\n" + - " {\r\n" + - " Count++;\r\n" + - " }\r\n" + - "\r\n" + - " public void SetCount(int Count)\r\n" + - " {\r\n" + - " this.Count = Count;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - "\r\n" + - " def get_Count(self):\r\n" + - " return self._count\r\n" + - "\r\n" + - " Count = property(fget=get_Count)\r\n" + - "\r\n" + - " def Increment(self):\r\n" + - " self.Count += 1\r\n" + - "\r\n" + - " def SetCount(self, Count):\r\n" + - " self.Count = Count"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetSetStatementsTestfixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetSetStatementsTestfixture.cs deleted file mode 100644 index 95b8a22e02..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetSetStatementsTestfixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests the CSharpToPythonConverter class can convert a C# property to - /// two get and set methods in Python. - /// - [TestFixture] - public class PropertyWithGetSetStatementsTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tint count = 0;\r\n" + - "\tint i = 0;\r\n" + - "\tpublic int Count\r\n" + - "\t{\r\n" + - "\t\tget {\r\n" + - "\t\t\tif (i == 0) {\r\n" + - "\t\t\treturn 10;\r\n" + - "\t\t} else {\r\n" + - "\t\t\treturn count;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "\t\tset {\r\n" + - "\t\t\tif (i == 1) {\r\n" + - "\t\t\tcount = value;\r\n" + - "\t\t} else {\r\n" + - "\t\t\tcount = value + 5;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself._count = 0\r\n" + - "\t\tself._i = 0\r\n" + - "\r\n" + - "\tdef get_Count(self):\r\n" + - "\t\tif self._i == 0:\r\n" + - "\t\t\treturn 10\r\n" + - "\t\telse:\r\n" + - "\t\t\treturn self._count\r\n" + - "\r\n" + - "\tdef set_Count(self, value):\r\n" + - "\t\tif self._i == 1:\r\n" + - "\t\t\tself._count = value\r\n" + - "\t\telse:\r\n" + - "\t\t\tself._count = value + 5\r\n" + - "\r\n" + - "\tCount = property(fget=get_Count, fset=set_Count)"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetterTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetterTestFixture.cs deleted file mode 100644 index 5c6a656667..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithGetterTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class PropertyWithGetterTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " int i = 0;\r\n" + - " public int Count {\r\n" + - " get {\r\n" + - " if (i == 0) {\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " return count;\r\n" + - " }\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - " self._i = 0\r\n" + - "\r\n" + - " def get_Count(self):\r\n" + - " if self._i == 0:\r\n" + - " return 10\r\n" + - " else:\r\n" + - " return self._count\r\n" + - "\r\n" + - " Count = property(fget=get_Count)"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithSetterTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithSetterTestFixture.cs deleted file mode 100644 index 6e23bf57ba..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/PropertyWithSetterTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class PropertyWithSetterTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " int i = 0;\r\n" + - " public int Count {\r\n" + - " set {\r\n" + - " count = value;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - " self._i = 0\r\n" + - "\r\n" + - " def set_Count(self, value):\r\n" + - " self._count = value\r\n" + - "\r\n" + - " Count = property(fset=set_Count)"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs deleted file mode 100644 index 3cf568df75..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that removing a method from an event handler is converted - /// from C# to Python correctly. - /// - [TestFixture] - public class RemoveHandlerConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{" + - "\t\tbutton = new Button();\r\n" + - "\t\tbutton.Click -= ButtonClick;\r\n" + - "\t}\r\n" + - "\r\n" + - "\tvoid ButtonClick(object sender, EventArgs e)\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tbutton = Button()\r\n" + - "\t\tbutton.Click -= self.ButtonClick\r\n" + - "\r\n" + - "\tdef ButtonClick(self, sender, e):\r\n" + - "\t\tpass"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs deleted file mode 100644 index 62eb2a7524..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests a single class method is converted. - /// - [TestFixture] - public class SingleClassMethodConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void Init()\r\n" + - "\t{\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void GeneratedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef Init(self):\r\n" + - "\t\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs deleted file mode 100644 index 6b3f292fa3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class SingleLineCommentConversionTestFixture - { - string csharp = "// \r\n" + - "// Class Foo\r\n" + - "// \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " // Initialize.\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " // Initialize j.\r\n" + - " j = 0; // Set to zero\r\n" + - " // test\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "# \r\n" + - "# Class Foo\r\n" + - "# \r\n" + - "class Foo(object):\r\n" + - " # Initialize.\r\n"+ - " def __init__(self):\r\n" + - " # Initialize j.\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0:\r\n" + - " j = 2"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticClassReferenceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticClassReferenceTestFixture.cs deleted file mode 100644 index 0171a53d2e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticClassReferenceTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that C# code such as "System.Console.WriteLine("Test");" - /// is converted to Python code correctly. - /// - [TestFixture] - public class StaticClassReferenceTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic Foo()\r\n" + - "\t{\r\n" + - "\t\tSystem.Console.WriteLine(\"Test\");\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tSystem.Console.WriteLine(\"Test\")"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticMethodConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticMethodConversionTestFixture.cs deleted file mode 100644 index 4fbf745776..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/StaticMethodConversionTestFixture.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Static methods should not use "self" and they should by defined by using "staticmethod". - /// - [TestFixture] - public class StaticMethodConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " static void Main(string[] args)\r\n" + - " {\r\n" + - " Stop();\r\n" + - " }\r\n" + - "\r\n" + - " static void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - string python; - NRefactoryToPythonConverter converter; - - [SetUp] - public void Init() - { - converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - python = converter.Convert(csharp); - } - - [Test] - public void ConvertedPythonCode() - { - string expectedPython = "class Foo(object):\r\n" + - " def Main(args):\r\n" + - " Foo.Stop()\r\n" + - "\r\n" + - " Main = staticmethod(Main)\r\n" + - "\r\n" + - " def Stop():\r\n" + - " pass\r\n" + - "\r\n" + - " Stop = staticmethod(Stop)\r\n" + - "\r\n" + - " def Run(self):\r\n" + - " pass"; - Assert.AreEqual(expectedPython, python, python); - } - - [Test] - public void EntryPointMethodFound() - { - Assert.AreEqual(1, converter.EntryPointMethods.Count); - } - - [Test] - public void MainEntryPointMethodNameIsMain() - { - Assert.AreEqual("Main", converter.EntryPointMethods[0].Name); - } - - [Test] - public void GenerateCodeToCallMainMethod() - { - Assert.AreEqual("Foo.Main(None)", converter.GenerateMainMethodCall(converter.EntryPointMethods[0])); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SwitchStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SwitchStatementConversionTestFixture.cs deleted file mode 100644 index 628bd3ae05..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/SwitchStatementConversionTestFixture.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class SwitchStatementConversionTestFixture - { - [Test] - public void SwitchStatement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run(int i)\r\n" + - " {\r\n" + - " switch (i) {\r\n" + - " case 7:\r\n" + - " i = 4;\r\n" + - " break;\r\n" + - " case 10:\r\n" + - " return 0;\r\n" + - " case 9:\r\n" + - " return 2;\r\n" + - " case 8:\r\n" + - " break;\r\n" + - " default:\r\n" + - " return -1;\r\n" + - " }\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - " def Run(self, i):\r\n" + - " if i == 7:\r\n" + - " i = 4\r\n" + - " elif i == 10:\r\n" + - " return 0\r\n" + - " elif i == 9:\r\n" + - " return 2\r\n" + - " elif i == 8:\r\n" + - " pass\r\n" + - " else:\r\n" + - " return -1\r\n" + - " return i"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code, code); - } - - [Test] - public void CaseFallThrough() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run(int i)\r\n" + - " {\r\n" + - " switch (i) {\r\n" + - " case 10:\r\n" + - " case 11:\r\n" + - " return 0;\r\n" + - " case 9:\r\n" + - " return 2;\r\n" + - " default:\r\n" + - " return -1;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - " def Run(self, i):\r\n" + - " if i == 10 or i == 11:\r\n" + - " return 0\r\n" + - " elif i == 9:\r\n" + - " return 2\r\n" + - " else:\r\n" + - " return -1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs deleted file mode 100644 index 220bd68356..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class TernaryOperatorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic string TestMe(bool test)\r\n" + - "\t{\r\n" + - "\t\tstring a = test ? \"Ape\" : \"Monkey\";\r\n" + - "\t\treturn a;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef TestMe(self, test):\r\n" + - "\t\ta = \"Ape\" if test else \"Monkey\"\r\n" + - "\t\treturn a"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs deleted file mode 100644 index e0ab0c3dfa..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that a throw statement is converted to a - /// raise keyword in Python when converting - /// from C#. - /// - [TestFixture] - public class ThrowExceptionConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic string Run()\r\n" + - "\t{" + - "\t\tthrow new XmlException();\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - string expectedCode = "class Foo(object):\r\n" + - "\tdef Run(self):\r\n" + - "\t\traise XmlException()"; - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs deleted file mode 100644 index 44e0f014d4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Converts a C# try-catch-finally to python. - /// - [TestFixture] - public class TryCatchFinallyConversionTestFixture - { - string csharp = "class Loader\r\n" + - "{\r\n" + - "\tpublic void load(string xml)\r\n" + - "\t{\r\n" + - "\t\ttry {\r\n" + - "\t\t\tXmlDocument doc = new XmlDocument();\r\n" + - "\t\t\tdoc.LoadXml(xml);\r\n" + - "\t\t} catch (XmlException ex) {\r\n" + - "\t\t\tConsole.WriteLine(ex.ToString());\r\n" + - "\t\t} finally {\r\n" + - "\t\t\tConsole.WriteLine(xml);\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - /// - /// Note that Python seems to need to nest the try-catch - /// inside a try-finally if the finally exists. - /// - [Test] - public void ConvertedCode() - { - string expectedPython = "class Loader(object):\r\n" + - "\tdef load(self, xml):\r\n" + - "\t\ttry:\r\n" + - "\t\t\tdoc = XmlDocument()\r\n" + - "\t\t\tdoc.LoadXml(xml)\r\n" + - "\t\texcept XmlException, ex:\r\n" + - "\t\t\tConsole.WriteLine(ex.ToString())\r\n" + - "\t\tfinally:\r\n" + - "\t\t\tConsole.WriteLine(xml)"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TypeofConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TypeofConversionTestFixture.cs deleted file mode 100644 index 7be6292458..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/TypeofConversionTestFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class TypeofConversionTestFixture - { - string typeofIntCode = "class Foo\r\n" + - "{\r\n" + - " public string ToString()\r\n" + - " {\r\n" + - " typeof(int).FullName;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedTypeOfIntegerCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(typeofIntCode); - string expectedPython = "import clr\r\n" + - "\r\n" + - "class Foo(object):\r\n" + - " def ToString(self):\r\n" + - " clr.GetClrType(int).FullName"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UnaryOperatorConversionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UnaryOperatorConversionTests.cs deleted file mode 100644 index d9ea7cb0c9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UnaryOperatorConversionTests.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class UnaryOperatorConversionTests - { - [Test] - public void MinusOne() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = -1;\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti = -1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void PlusOne() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = +1;\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\ti = +1"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void NotOperator() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(bool i)\r\n" + - " {\r\n" + - " j = !i;\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\tj = not i"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - - [Test] - public void BitwiseNotOperator() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(bool i)\r\n" + - " {\r\n" + - " j = ~i;\r\n" + - " }\r\n" + - "}"; - - string expectedPython = "class Foo(object):\r\n" + - "\tdef Run(self, i):\r\n" + - "\t\tj = ~i"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedPython, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UsingStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UsingStatementConversionTestFixture.cs deleted file mode 100644 index 6c36439025..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/UsingStatementConversionTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class UsingStatementConversionTestFixture - { - string csharp = "using System\r\n" + - "class Foo\r\n" + - "{\r\n" + - "}"; - - [Test] - public void GeneratedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "from System import *\r\n" + - "\r\n" + - "class Foo(object):\r\n" + - "\tpass"; - - Assert.AreEqual(expectedPython, python); - } - - [Test] - public void MultipleUsingStatements() - { - string csharp = "using System\r\n" + - "using System.Drawing\r\n" + - "class Foo\r\n" + - "{\r\n" + - "}"; - - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "from System import *\r\n" + - "from System.Drawing import *\r\n" + - "\r\n" + - "class Foo(object):\r\n" + - "\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBClassConversionTestFixture.cs deleted file mode 100644 index 8fcc1fddfc..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBClassConversionTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - /// - /// Tests that a VB.NET class is converted to Python successfully. - /// - [TestFixture] - public class VBClassConversionTestFixture - { - string vb = "Namespace DefaultNamespace\r\n" + - "\tPublic Class Class1\r\n" + - "\tEnd Class\r\n" + - "End Namespace"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - string python = converter.Convert(vb); - string expectedPython = "class Class1(object):\r\n" + - "\tpass"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBExitConversionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBExitConversionTests.cs deleted file mode 100644 index d53f2368aa..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBExitConversionTests.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class VBExitConversionTests - { - string vb = - "Public Class Class1\r\n" + - " Public Sub Test\r\n" + - " While True\r\n" + - " Exit While\r\n" + - " End While\r\n" + - " End Sub\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string python = converter.Convert(vb); - string expectedPython = - "class Class1(object):\r\n" + - " def Test(self):\r\n" + - " while True:\r\n" + - " break"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBStringConcatTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBStringConcatTestFixture.cs deleted file mode 100644 index 08a79e5fae..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/VBStringConcatTestFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class VBStringConcatTestFixture - { - string vb = "Namespace DefaultNamespace\r\n" + - "\tPublic Class Class1\r\n" + - "\t\tPublic Sub Test\r\n" + - "\t\t\tDim a as String\r\n" + - "\t\t\ta = \"test\" & \" this\"\r\n" + - "\t\tEnd Sub\r\n" + - "\tEnd Class\r\n" + - "End Namespace"; - - [Test] - public void GeneratedPythonSourceCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.VBNet); - string python = converter.Convert(vb); - string expectedPython = "class Class1(object):\r\n" + - "\tdef Test(self):\r\n" + - "\t\ta = \"test\" + \" this\""; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/WhileLoopConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/WhileLoopConversionTestFixture.cs deleted file mode 100644 index 1ccf9fb2c9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/WhileLoopConversionTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class WhileLoopConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "\tpublic void CountDown()\r\n" + - "\t{\r\n" + - "\t\tint i = 10;\r\n" + - "\t\twhile (i > 0) {\r\n" + - "\t\t\ti--;\r\n" + - "\t\t}\r\n" + - "\t}\r\n" + - "}"; - - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - "\tdef CountDown(self):\r\n" + - "\t\ti = 10\r\n" + - "\t\twhile i > 0:\r\n" + - "\t\t\ti -= 1"; - - Assert.AreEqual(expectedPython, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs deleted file mode 100644 index e61f604f3c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Converter -{ - [TestFixture] - public class XmlDocCommentConversionTestFixture - { - string csharp = "/// \r\n" + - "/// Class Foo\r\n" + - "/// \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " /// \r\n" + - " /// Run\r\n" + - " /// \r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " /// Stop \r\n" + - " public void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " /// Initialize.\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " /// Initialize j.\r\n" + - " int j = 0; /// Set to zero\r\n" + - " /// test\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedPythonCode() - { - NRefactoryToPythonConverter converter = new NRefactoryToPythonConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string python = converter.Convert(csharp); - string expectedPython = "class Foo(object):\r\n" + - " \"\"\" \r\n" + - " Class Foo\r\n" + - " \r\n" + - " \"\"\"\r\n" + - " def Run(self):\r\n" + - " \"\"\" \r\n" + - " Run\r\n" + - " \r\n" + - " \"\"\"\r\n" + - " pass\r\n" + - "\r\n" + - " def Stop(self):\r\n" + - " \"\"\" Stop \"\"\"\r\n" + - " pass\r\n" + - "\r\n" + - " def __init__(self):\r\n" + - " \"\"\" Initialize.\"\"\"\r\n" + - " # Initialize j.\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0:\r\n" + - " j = 2"; - - Assert.AreEqual(expectedPython, python, python); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/App.ico b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/App.ico deleted file mode 100644 index 3a5525fd79..0000000000 Binary files a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/App.ico and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/AssignmentAfterFormClassTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/AssignmentAfterFormClassTests.cs deleted file mode 100644 index c6719eef95..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/AssignmentAfterFormClassTests.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Resources; -using ICSharpCode.Core; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that only the InitializeComponents method is processed - /// when walking the AST. - /// - [TestFixture] - public class AssignmentAfterFormClassTests : LoadFormTestFixtureBase - { - public override void BeforeSetUpFixture() - { - var rm = new ResourceManager("PythonBinding.Tests.Strings", GetType().Assembly); - ResourceService.RegisterNeutralStrings(rm); - } - - public override string PythonCode { - get { - return - "import clr\r\n" + - "clr.AddReference('System.Windows.Forms')\r\n" + - "clr.AddReference('System.Drawing')\r\n" + - "\r\n" + - "import System.Drawing\r\n" + - "import System.Windows.Forms\r\n" + - "\r\n" + - "from System.Drawing import *\r\n" + - "from System.Windows.Forms import *\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - " \r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - "\r\n" + - "test = MainForm()\r\n" + - "Application.Run(test)\r\n" + - "\r\n"; - } - } - - [Test] - public void MainFormName() - { - Assert.AreEqual("MainForm", Form.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs deleted file mode 100644 index 66cb526d2e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the control's BeginInit and EndInit methods are called. - /// - [TestFixture] - public class CallBeginInitOnLoadTestFixture : CallBeginInitOnLoadTestsBase - { - public override string Code { - get { - ComponentCreator.AddType("ICSharpCode.Scripting.Tests.Utils.SupportInitCustomControl", typeof(SupportInitCustomControl)); - - return - "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._control = ICSharpCode.Scripting.Tests.Utils.SupportInitCustomControl()\r\n" + - " self._control.BeginInit()\r\n" + - " localVariable = ICSharpCode.Scripting.Tests.Utils.SupportInitCustomControl()\r\n" + - " localVariable.BeginInit()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AccessibleRole = System.Windows.Forms.AccessibleRole.None\r\n" + - " self.Controls.Add(self._control)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self._control.EndInit()\r\n" + - " localVariable.EndInit()\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return PythonComponentWalkerHelper.CreateComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs deleted file mode 100644 index 0a0db473c0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Converts a custom class that has a custom TypeConverter defined. - /// This type converter implements an InstanceDescriptor which is used to generate the - /// code to create an instance of the class. - /// - [TestFixture] - public class ConvertCustomClassUsingTypeConverterTestFixture - { - [Test] - public void ConvertCustomClass() - { - CustomClass customClass = new CustomClass("Test", "Category"); - string text = PythonPropertyValueAssignment.ToString(customClass); - string expectedText = "ICSharpCode.Scripting.Tests.Utils.CustomClass(\"Test\", \"Category\")"; - Assert.AreEqual(expectedText, text); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CursorTypeResolutionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CursorTypeResolutionTestFixture.cs deleted file mode 100644 index 18076a27c1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/CursorTypeResolutionTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the string "System.Windows.Forms.Cursors.AppStarting" can be resolved by the - /// PythonCodeDeserializer. - /// - [TestFixture] - public class CursorTypeResolutionTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetPythonCode() - { - return "self.Cursors = System.Windows.Forms.Cursors.AppStarting"; - } - - [Test] - public void DeserializedObjectIsCursorsAppStarting() - { - Assert.AreEqual(Cursors.AppStarting, deserializedObject); - } - - [Test] - public void CursorsTypeResolved() - { - Assert.AreEqual("System.Windows.Forms.Cursors", base.componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs deleted file mode 100644 index 37c2aa8925..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Base class for all tests of the PythonCodeDeserialize when deserializing an - /// assignment. - /// - public abstract class DeserializeAssignmentTestFixtureBase - { - protected Node rhsAssignmentNode; - protected object deserializedObject; - protected MockDesignerLoaderHost mockDesignerLoaderHost; - protected MockTypeResolutionService typeResolutionService; - protected MockComponentCreator componentCreator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - - AssignmentStatement assignment = PythonParserHelper.GetAssignmentStatement(GetPythonCode()); - rhsAssignmentNode = assignment.Right; - - mockDesignerLoaderHost = new MockDesignerLoaderHost(); - typeResolutionService = mockDesignerLoaderHost.TypeResolutionService; - PythonCodeDeserializer deserializer = new PythonCodeDeserializer(componentCreator); - deserializedObject = deserializer.Deserialize(rhsAssignmentNode); - } - - public abstract string GetPythonCode(); - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs deleted file mode 100644 index 15b1258cf2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the string "System.Drawing.Color.FromArgb(0, 192, 10)" can be converted to an object by the - /// PythonCodeDeserializer. - /// - [TestFixture] - public class DeserializeColorFromArgbTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetPythonCode() - { - return "self.BackColor = System.Drawing.Color.FromArgb(0, 192, 10)"; - } - - [Test] - public void DeserializedObjectIsExpectedCustomColor() - { - Color customColor = Color.FromArgb(0, 192, 10); - Assert.AreEqual(customColor, deserializedObject); - } - - [Test] - public void ColorTypeResolved() - { - Assert.AreEqual("System.Drawing.Color", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs deleted file mode 100644 index 7eb2b349f1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the string "self._menuItem1" is converted to the matching component. - /// - [TestFixture] - public class DeserializeComponentAssignmentTestFixture : DeserializeAssignmentTestFixtureBase - { - Button button; - - public override string GetPythonCode() - { - button = (Button)base.componentCreator.CreateInstance(typeof(Button), new object[0], "button1", false); - return "self.AcceptButton = self._button1"; - } - - [Test] - public void DeserializedObjectIsButton() - { - Assert.AreSame(button, deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeConstraintArrayTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeConstraintArrayTestFixture.cs deleted file mode 100644 index 117b222ef6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeConstraintArrayTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Data; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeConstraintArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetPythonCode() - { - return "self.Items = System.Array[System.Data.Constraint](\r\n" + - " [System.Data.UniqueConstraint(\"Constraint1\", System.Array[System.String](\r\n" + - " [\"Column1\"]), False)]))"; - } - - [Test] - public void DeserializedObjectIsExpectedArray() - { - UniqueConstraint constraint = new UniqueConstraint("Constraint1", new string[] { "Column1" }, false); - Constraint[] expectedArray = new Constraint[] { constraint }; - Assert.AreEqual(expectedArray, deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs deleted file mode 100644 index cf066f01fc..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeDateTimeArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetPythonCode() - { - return "self.Items = System.Array[System.DateTime](\r\n" + - " [System.DateTime(2010, 2, 3, 0, 0, 0, 0),\r\n" + - " System.DateTime(0)])"; - } - - [Test] - public void DeserializedObjectIsExpectedArray() - { - DateTime[] expectedArray = new DateTime[] {new DateTime(2010, 2, 3), new DateTime(0)}; - Assert.AreEqual(expectedArray, deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs deleted file mode 100644 index f9e9dc549f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that a local variable can be deserialized. Local variables are used when adding - /// ListViewItems to a ListView. - /// - [TestFixture] - public class DeserializeLocalVariableTestFixture - { - string pythonCode = "self.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem]([listViewItem1]))"; - - MockDesignerLoaderHost mockDesignerLoaderHost; - MockTypeResolutionService typeResolutionService; - MockComponentCreator componentCreator; - ListViewItem listViewItem1; - object deserializedObject; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - listViewItem1 = (ListViewItem)componentCreator.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem1", false); - - CallExpression callExpression = PythonParserHelper.GetCallExpression(pythonCode); - - mockDesignerLoaderHost = new MockDesignerLoaderHost(); - typeResolutionService = mockDesignerLoaderHost.TypeResolutionService; - PythonCodeDeserializer deserializer = new PythonCodeDeserializer(componentCreator); - deserializedObject = deserializer.Deserialize(callExpression.Args[0].Expression); - } - - [Test] - public void ListViewItemDeserialized() - { - ListViewItem[] array = (ListViewItem[])deserializedObject; - Assert.AreSame(listViewItem1, array[0]); - } - - [Test] - public void ListViewItemIsNotNull() - { - Assert.IsNotNull(deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs deleted file mode 100644 index 94b2970faa..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeCallParametersTestFixture - { - PythonCodeDeserializer deserializer; - MockComponentCreator componentCreator; - - [SetUp] - public void Init() - { - componentCreator = new MockComponentCreator(); - MockDesignerLoaderHost mockDesignerLoaderHost = new MockDesignerLoaderHost(); - deserializer = new PythonCodeDeserializer(componentCreator); - } - - [Test] - public void NegativeIntegerParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(-1); - - string code = "TestClass(-1)"; - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void NegativeDoubleParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(-1.0); - - string code = "TestClass(-1.0)"; - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void EnumParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(AnchorStyles.Top); - - string code = "TestClass(System.Windows.Forms.AnchorStyles.Top)"; - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void BooleanParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(true); - - string code = "TestClass(True)"; - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void LocalVariableInstance() - { - string s = "abc"; - CreatedInstance instance = new CreatedInstance(typeof(string), new object[0], "localVariable", false); - instance.Object = s; - componentCreator.CreatedInstances.Add(instance); - List expectedArgs = new List(); - expectedArgs.Add(s); - - string code = "TestClass(localVariable)"; - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeStringArrayTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeStringArrayTestFixture.cs deleted file mode 100644 index e30ca6642c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeStringArrayTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the string "System.Array" can be converted to an array. - /// - [TestFixture] - public class DeserializeStringArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetPythonCode() - { - return "self.Items = System.Array[System.String](\r\n" + - " [\"a\",\r\n" + - " \"b\"])"; - } - - [Test] - public void DeserializedObjectIsExpectedArray() - { - string[] expectedArray = new string[] {"a", "b"}; - Assert.AreEqual(expectedArray, deserializedObject); - } - - [Test] - public void StringTypeResolved() - { - Assert.AreEqual("System.String", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs deleted file mode 100644 index c51371feef..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeToolStripItemArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - ToolStripMenuItem fileMenuItem; - ToolStripMenuItem editMenuItem; - - public override string GetPythonCode() - { - fileMenuItem = (ToolStripMenuItem)componentCreator.CreateComponent(typeof(ToolStripMenuItem), "fileToolStripMenuItem"); - editMenuItem = (ToolStripMenuItem)componentCreator.CreateComponent(typeof(ToolStripMenuItem), "editToolStripMenuItem"); - - componentCreator.Add(fileMenuItem, "fileToolStripMenuItem"); - componentCreator.Add(editMenuItem, "editToolStripMenuItem"); - - return "self.Items = System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._fileToolStripMenuItem,\r\n" + - " self._editToolStripMenuItem])"; - } - - [Test] - public void DeserializedObjectIsExpectedCustomColor() - { - ToolStripItem[] expectedArray = new ToolStripItem[] {fileMenuItem, editMenuItem}; - Assert.AreEqual(expectedArray, deserializedObject); - } - - [Test] - public void StringTypeResolved() - { - Assert.AreEqual("System.Windows.Forms.ToolStripItem", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializerConstructorStringArrayTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializerConstructorStringArrayTestFixture.cs deleted file mode 100644 index 53108205c1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/DeserializerConstructorStringArrayTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the constructor arguments are returned when the first argument is - /// an array. - /// - [TestFixture] - public class DeserializeConstructorStringArrayTestFixture - { - string code = "System.Windows.Forms.ListViewItem(System.Array[System.String](\r\n" + - " [\"a\",\r\n" + - " \"sa\",\r\n" + - " \"sa2\"]))\r\n"; - - List args; - - [TestFixtureSetUp] - public void SetUpFixture() - { - MockComponentCreator componentCreator = new MockComponentCreator(); - CallExpression callExpression = PythonParserHelper.GetCallExpression(code); - PythonCodeDeserializer deserializer = new PythonCodeDeserializer(componentCreator); - args = deserializer.GetArguments(callExpression); - } - - [Test] - public void OneArgument() - { - Assert.AreEqual(1, args.Count); - } - - [Test] - public void ArgumentIsStringArray() - { - string[] array = new string[0]; - Assert.IsInstanceOf(array.GetType(), args[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs deleted file mode 100644 index b5897dd56d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// The PythonForm class should be getting the value from the PropertyDescriptor and not - /// the PropertyInfo information returned from the form object. If this is not done then when the - /// user sets Enabled to false in the designer the value is not generated in the InitializeComponent method. - /// - [TestFixture] - public class EnabledSetUsingPropertyDescriptorTestFixture : GenerateEnabledUsingPropertyDescriptorTestsBase - { - [Test] - public void GeneratedCode() - { - string expectedCode = - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - "self.Enabled = False\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedCode); - } - - protected override IScriptingCodeDomSerializer CreateSerializer() - { - return PythonCodeDomSerializerHelper.CreateSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs deleted file mode 100644 index 98219b9e5d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonDesignerGenerator does not insert an event handler if a method already exists with the same - /// name. - /// - [TestFixture] - public class EventHandlerAlreadyExistsTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - } - - [Test] - public void CodeAfterInsertComponentEventMethodCalledIsNotChanged() - { - string expectedCode = GetTextEditorCode(); - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - [Test] - public void InsertComponentEventMethodReturnsTrue() - { - Assert.IsTrue(insertedEventHandler); - } - - [Test] - public void FileIsForm() - { - Assert.AreEqual(fileName, file); - } - - [Test] - public void PositionOfEventHandlerIsLine12() - { - Assert.AreEqual(12, position); - } - - protected override string GetTextEditorCode() - { - return - "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponents()\r\n" + - " \r\n" + - " def InitializeComponents(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self._button1.Click += mybuttonclick\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " \r\n" + - " def mybuttonclick(self, sender, e):\r\n" + - " pass\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs deleted file mode 100644 index 993dfbceb5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// An event handler should be inserted if a method exists in the form's class but has the incorrect - /// number of parameters. - /// - [TestFixture] - public class EventHandlerExistsWithIncorrectParameterCountTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = GetTextEditorCode(); - string eventHandler = - "\tdef mybuttonclick(self, sender, e):\r\n" + - "\t\tpass"; - expectedCode = expectedCode + "\r\n" + eventHandler; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - protected override string GetTextEditorCode() - { - return - "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\t\r\n" + - "\tdef InitializeComponents(self):\r\n" + - "\t\tself._button1 = System.Windows.Forms.Button()\r\n" + - "\t\tself._button1.Click += mybuttonclick\r\n" + - "\t\r\n" + - "\tdef mybuttonclick(self):\r\n" + - "\t\tpass\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs deleted file mode 100644 index 2ac2bbfd65..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the GeneratedInitializeComponentMethod class locates - /// the InitializeComponents method in the source code. - /// - /// Note that the source code contains a non-designable class - /// before the Form. This tests that the first designable class - /// is correctly picked up. - /// - [TestFixture] - public class FindInitializeComponentMethodTestFixture - { - IMethod initializeComponentMethod; - ParseInformation parseInfo; - IMethod expectedInitializeComponentMethod; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonParser parser = new PythonParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\Test\MainForm.py", GetFormCode()); - - // Create parse info to return from ParseFile method. - parseInfo = new ParseInformation(compilationUnit); - - // Get the InitializeComponent method from the - // compilation unit. - expectedInitializeComponentMethod = GetInitializeComponentMethod(compilationUnit); - - // Find the InitializeComponent method using the designer generator. - initializeComponentMethod = PythonDesignerGenerator.GetInitializeComponents(parseInfo); - } - - /// - /// Sanity check. Make sure we found the InitializeComponent method - /// from the compilation unit during the SetUpFixture method. - /// - [Test] - public void ExpectedInitializeComponentMethodFound() - { - Assert.IsNotNull(expectedInitializeComponentMethod); - } - - [Test] - public void InitializeComponentMethodFound() - { - Assert.AreSame(expectedInitializeComponentMethod, initializeComponentMethod); - } - - [Test] - public void GetInitializeComponentWhenNoClassesInCompilationUnit() - { - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(new MockProjectContent())); - Assert.IsNull(PythonDesignerGenerator.GetInitializeComponents(parseInfo)); - } - - /// - /// Tests that the PythonDesignerGenerator handles the InitializeComponent - /// method being "InitializeComponents" and not "InitializeComponent". - /// - [Test] - public void InitializeComponentsUsedInsteadOfInitializeComponent() - { - PythonParser parser = new PythonParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - string code = GetFormCode().Replace("InitializeComponent", "InitializeComponents"); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\Test\MainForm.py", code); - ParseInformation parseInfo = new ParseInformation(compilationUnit); - IMethod expectedMethod = GetInitializeComponentMethod(compilationUnit); - - IMethod method = PythonDesignerGenerator.GetInitializeComponents(parseInfo); - - Assert.IsNotNull(method); - Assert.AreSame(expectedMethod, method); - } - - string GetFormCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class IgnoreMe:\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tpass\r\n"+ - "\r\n" + - "class IgnoreMeSinceIHaveNoInitializeComponentMethod(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tpass\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\t\r\n" + - "\tdef InitializeComponent(self):\r\n" + - "\t\tpass\r\n"; - } - - static IMethod GetInitializeComponentMethod(ICompilationUnit unit) - { - IClass c = unit.Classes[2]; - foreach (IMethod m in c.Methods) { - if (m.Name == "InitializeComponent" || m.Name == "InitializeComponents") { - return m; - } - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs deleted file mode 100644 index 0a319b233d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class FormBaseClassCreatedOnLoadTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - ComponentCreator.AddType("FormBase.FormBase", typeof(Component)); - - return "class TestForm(FormBase.FormBase):\r\n" + - " def InitializeComponent(self):\r\n" + - " pass"; - } - } - - [Test] - public void BaseClassNamePassedAsGetTypeParam() - { - Assert.AreEqual("FormBase.FormBase", ComponentCreator.TypeNames[0]); - } - - [Test] - public void BaseClassTypePassedToCreateComponent() - { - Assert.AreEqual(typeof(Component).FullName, ComponentCreator.CreatedComponents[0].TypeName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs deleted file mode 100644 index 305e086972..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAcceptButtonFormTestFixture : GenerateAcceptButtonFormTestsBase - { - [Test] - public void GeneratedCode() - { - string expectedCode = - "self._button1 = System.Windows.Forms.Button()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# button1\r\n" + - "# \r\n" + - "self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - "self._button1.Name = \"button1\"\r\n" + - "self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - "self._button1.TabIndex = 0\r\n" + - "self._button1.Text = \"button1\"\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AcceptButton = self._button1\r\n" + - "self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - "self.Controls.Add(self._button1)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedCode, generatedCode); - } - - protected override IScriptingCodeDomSerializer CreateSerializer() - { - return PythonCodeDomSerializerHelper.CreateSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs deleted file mode 100644 index b5cc5c20f3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAccessibleRoleFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor accessibleRoleDescriptor = descriptors.Find("AccessibleRole", false); - accessibleRoleDescriptor.SetValue(form, AccessibleRole.None); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AccessibleRole = System.Windows.Forms.AccessibleRole.None\r\n" + - "self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs deleted file mode 100644 index d286a714a2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// A Form has a base ContainerControl class which has an AutoScaleMode property. This has the following attributes: - /// - /// Browsable = false - /// DesignerSerializationVisibility = Hidden - /// EditorBrowsable = EditorBrowsableState.Advanced - /// - /// However the forms root designer overrides these and shows it in the designer. - /// - /// This test fixture checks that the AutoScaleMode value will be generated in the form's code - /// by the python forms designer. - /// - [TestFixture] - public class GenerateAutoScaleModeFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - PropertyDescriptor autoScaleModeDescriptor = descriptors.Find("AutoScaleMode", false); - autoScaleModeDescriptor.SetValue(form, AutoScaleMode.Font); - - PropertyDescriptor autoScaleDimensionsDescriptor = descriptors.Find("AutoScaleDimensions", false); - autoScaleDimensionsDescriptor.SetValue(form, new SizeF(6F, 13F)); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AutoScaleDimensions = System.Drawing.SizeF(6, 13)\r\n" + - " self.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs deleted file mode 100644 index d6fe0fb67c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAutoScrollFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor autoScrollDescriptor = descriptors.Find("AutoScroll", false); - autoScrollDescriptor.SetValue(form, true); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AutoScroll = True\r\n" + - "self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs deleted file mode 100644 index 79fb7f7d24..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateBackgroundWorkerTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor propertyDescriptor = descriptors.Find("Name", false); - propertyDescriptor.SetValue(form, "MainForm"); - - BackgroundWorker worker = (BackgroundWorker)host.CreateComponent(typeof(BackgroundWorker), "backgroundWorker1"); - descriptors = TypeDescriptor.GetProperties(worker); - propertyDescriptor = descriptors.Find("WorkerReportsProgress", false); - propertyDescriptor.SetValue(worker, true); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._backgroundWorker1 = System.ComponentModel.BackgroundWorker()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # backgroundWorker1\r\n" + - " # \r\n" + - " self._backgroundWorker1.WorkerReportsProgress = True\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs deleted file mode 100644 index 59367f82cc..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateButtonFlatAppearanceTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - Button button = (Button)host.CreateComponent(typeof(Button), "button1"); - button.Location = new Point(0, 0); - button.Size = new Size(10, 10); - button.Text = "button1"; - button.UseCompatibleTextRendering = false; - - button.FlatAppearance.BorderSize = 2; - button.FlatAppearance.BorderColor = Color.Red; - button.FlatAppearance.MouseOverBackColor = Color.Yellow; - - form.Controls.Add(button); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._button1 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.FlatAppearance.BorderColor = System.Drawing.Color.Red\r\n" + - " self._button1.FlatAppearance.BorderSize = 2\r\n" + - " self._button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Yellow\r\n" + - " self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs deleted file mode 100644 index 54c1e38c3e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateComboBoxItemsFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add combo box. - ComboBox comboBox = (ComboBox)host.CreateComponent(typeof(ComboBox), "comboBox1"); - comboBox.TabIndex = 0; - comboBox.Location = new Point(0, 0); - comboBox.Size = new System.Drawing.Size(121, 21); - comboBox.Items.Add("aaa"); - comboBox.Items.Add("bbb"); - comboBox.Items.Add("ccc"); - - form.Controls.Add(comboBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._comboBox1 = System.Windows.Forms.ComboBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # comboBox1\r\n" + - " # \r\n" + - " self._comboBox1.Items.AddRange(System.Array[System.Object](\r\n" + - " [\"aaa\",\r\n" + - " \"bbb\",\r\n" + - " \"ccc\"]))\r\n" + - " self._comboBox1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._comboBox1.Name = \"comboBox1\"\r\n" + - " self._comboBox1.Size = System.Drawing.Size(121, 21)\r\n" + - " self._comboBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._comboBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs deleted file mode 100644 index dbf5bec563..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateContextMenuStripTestFixture - { - string generatedPythonCode; - Size menuStripSize; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add timer. This checks that the components Container is only created once in the - // generated code. - Timer timer = (Timer)host.CreateComponent(typeof(Timer), "timer1"); - - // Add menu strip. - ContextMenuStrip menuStrip = (ContextMenuStrip)host.CreateComponent(typeof(ContextMenuStrip), "contextMenuStrip1"); - - // Set the context menu strip OwnerItem to simulate leaving the context menu - // open in the designer before generating the source code. We do not want the - // OwnerItem to be serialized. - menuStrip.OwnerItem = new DerivedToolStripMenuItem(); - menuStrip.RightToLeft = RightToLeft.No; - menuStripSize = menuStrip.Size; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._components = System.ComponentModel.Container()\r\n" + - " self._timer1 = System.Windows.Forms.Timer(self._components)\r\n" + - " self._contextMenuStrip1 = System.Windows.Forms.ContextMenuStrip(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # contextMenuStrip1\r\n" + - " # \r\n" + - " self._contextMenuStrip1.Name = \"contextMenuStrip1\"\r\n" + - " self._contextMenuStrip1.Size = " + PythonPropertyValueAssignment.ToString(menuStripSize) + "\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCursorFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCursorFormTestFixture.cs deleted file mode 100644 index e70f51cc8a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCursorFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateCursorFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor cursorDescriptor = descriptors.Find("Cursor", false); - cursorDescriptor.SetValue(form, Cursors.Help); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Cursor = System.Windows.Forms.Cursors.Help\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs deleted file mode 100644 index 0a07ba0c9e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that a custom collection class generates the correct code. - /// The collection class should be a property of a custom component or user control - /// and it should be marked with DesignerSerializationVisibility.Content. - /// - [TestFixture] - public class GenerateCustomCollectionItemsTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add custom control - CustomUserControl userControl = (CustomUserControl)host.CreateComponent(typeof(CustomUserControl), "userControl1"); - userControl.Location = new Point(0, 0); - userControl.ClientSize = new Size(200, 100); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - FooItem fooItem = (FooItem)serializationManager.CreateInstance(typeof(FooItem), new object[] {"aa"}, "fooItem1", false); - userControl.FooItems.Add(fooItem); - fooItem = (FooItem)serializationManager.CreateInstance(typeof(FooItem), new object[] {"bb"}, "fooItem2", false); - userControl.FooItems.Add(fooItem); - - BarItem barItem = (BarItem)serializationManager.CreateInstance(typeof(BarItem), new object[] {"cc"}, "barItem1", false); - userControl.ParentComponent.ParentBarItems.Add(barItem); - barItem = (BarItem)serializationManager.CreateInstance(typeof(BarItem), new object[] {"dd"}, "barItem2", false); - userControl.ParentComponent.ParentBarItems.Add(barItem); - form.Controls.Add(userControl); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " fooItem1 = ICSharpCode.Scripting.Tests.Utils.FooItem()\r\n" + - " fooItem2 = ICSharpCode.Scripting.Tests.Utils.FooItem()\r\n" + - " barItem1 = ICSharpCode.Scripting.Tests.Utils.BarItem()\r\n" + - " barItem2 = ICSharpCode.Scripting.Tests.Utils.BarItem()\r\n" + - " self._userControl1 = ICSharpCode.Scripting.Tests.Utils.CustomUserControl()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " fooItem1.Text = \"aa\"\r\n" + - " fooItem2.Text = \"bb\"\r\n" + - " self._userControl1.FooItems.AddRange(System.Array[ICSharpCode.Scripting.Tests.Utils.FooItem](\r\n" + - " [fooItem1,\r\n" + - " fooItem2]))\r\n" + - " self._userControl1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._userControl1.Name = \"userControl1\"\r\n" + - " # \r\n" + - " # \r\n" + - " # \r\n" + - " barItem1.Text = \"cc\"\r\n" + - " barItem2.Text = \"dd\"\r\n" + - " self._userControl1.ParentComponent.ParentBarItems.AddRange(System.Array[ICSharpCode.Scripting.Tests.Utils.BarItem](\r\n" + - " [barItem1,\r\n" + - " barItem2]))\r\n" + - " self._userControl1.Size = System.Drawing.Size(200, 100)\r\n" + - " self._userControl1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._userControl1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDataSetTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDataSetTestFixture.cs deleted file mode 100644 index f0004d1b74..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDataSetTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Data; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateDataSetTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - DataGridView dataGridView = (DataGridView)host.CreateComponent(typeof(DataGridView), "dataGridView1"); - dataGridView.Location = new Point(0, 0); - dataGridView.Size = new Size(100, 100); - form.Controls.Add(dataGridView); - - DataSet dataSet = (DataSet)host.CreateComponent(typeof(DataSet), "dataSet1"); - dataGridView.DataSource = dataSet; - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._dataGridView1 = System.Windows.Forms.DataGridView()\r\n" + - " self._dataSet1 = System.Data.DataSet()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # dataGridView1\r\n" + - " # \r\n" + - " self._dataGridView1.AutoGenerateColumns = False\r\n" + - " self._dataGridView1.DataSource = self._dataSet1\r\n" + - " self._dataGridView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._dataGridView1.Name = \"dataGridView1\"\r\n" + - " self._dataGridView1.Size = System.Drawing.Size(100, 100)\r\n" + - " self._dataGridView1.TabIndex = 0\r\n" + - " # \r\n" + - " # dataSet1\r\n" + - " # \r\n" + - " self._dataSet1.DataSetName = \"NewDataSet\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._dataGridView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs deleted file mode 100644 index 7c0064c83a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// The DoubleBuffered property on the Control class is a protected method so using the GetType().GetProperty(...) - /// method will not return it. This test checks that this property is generated when creating the python code - /// for the form. - /// - [TestFixture] - public class GenerateDoubleBufferedFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - form.AllowDrop = false; - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("DoubleBuffered", false); - doubleBufferedPropertyDescriptor.SetValue(form, true); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.DoubleBuffered = True\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs deleted file mode 100644 index 1ff786c3f0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Reflection; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that an event is wired to its event handler after the user specifies an event handler - /// method in the property grid. - /// - [TestFixture] - public class GenerateEventHandlerFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IEventBindingService), eventBindingService); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Simulate giving a name to the Load event handler in the property grid. - EventDescriptorCollection events = TypeDescriptor.GetEvents(form); - EventDescriptor loadEvent = events.Find("Load", false); - PropertyDescriptor loadEventProperty = eventBindingService.GetEventProperty(loadEvent); - loadEventProperty.SetValue(form, "MainFormLoad"); - - // Add a second event handler method. - EventDescriptor closedEvent = events.Find("FormClosed", false); - PropertyDescriptor closedEventProperty = eventBindingService.GetEventProperty(closedEvent); - closedEventProperty.SetValue(form, "MainFormClosed"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.FormClosed += self.MainFormClosed\r\n" + - " self.Load += self.MainFormLoad\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventLogTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventLogTestFixture.cs deleted file mode 100644 index cc067697e9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateEventLogTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Diagnostics; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateEventLogTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - EventLog eventLog = (EventLog)host.CreateComponent(typeof(EventLog), "eventLog1"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - " self._eventLog1 = System.Diagnostics.EventLog()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # eventLog1\r\n" + - " # \r\n" + - " self._eventLog1.SynchronizingObject = self\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs deleted file mode 100644 index 4a8567c63e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFolderBrowserDialogRootFolderTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - FolderBrowserDialog dialog = (FolderBrowserDialog)host.CreateComponent(typeof(FolderBrowserDialog), "folderBrowserDialog1"); - dialog.RootFolder = Environment.SpecialFolder.ApplicationData; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "self._folderBrowserDialog1 = System.Windows.Forms.FolderBrowserDialog()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# folderBrowserDialog1\r\n" + - "# \r\n" + - "self._folderBrowserDialog1.RootFolder = System.Environment.SpecialFolder.ApplicationData\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormColorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormColorTestFixture.cs deleted file mode 100644 index 7c898fc9d4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormColorTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormColorTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor colorDescriptor = descriptors.Find("BackColor", false); - colorDescriptor.SetValue(form, SystemColors.HotTrack); - colorDescriptor = descriptors.Find("ForeColor", false); - colorDescriptor.SetValue(form, Color.Red); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackColor = System.Drawing.SystemColors.HotTrack\r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.ForeColor = System.Drawing.Color.Red\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormLocationTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormLocationTestFixture.cs deleted file mode 100644 index 4ed57861e9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormLocationTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormLocationTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Location", false); - descriptor.SetValue(form, new Point(10, 20)); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Location = System.Drawing.Point(10, 20)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormPaddingTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormPaddingTestFixture.cs deleted file mode 100644 index 9a5fa10eb3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormPaddingTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormPaddingTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Padding", false); - descriptor.SetValue(form, new Padding(10, 20, 15, 18)); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Padding = System.Windows.Forms.Padding(10, 20, 15, 18)\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormResourcesTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormResourcesTestFixture.cs deleted file mode 100644 index fcc61922ee..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateFormResourcesTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedPythonCode; - Bitmap bitmap; - Icon icon; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Set bitmap as form background image. - bitmap = new Bitmap(10, 10); - form.BackgroundImage = bitmap; - - icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - form.Icon = icon; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1); - } - } - } - - [Test] - public void TearDownFixture() - { - bitmap.Dispose(); - icon.Dispose(); - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " resources = System.Resources.ResourceManager(\"RootNamespace.MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackgroundImage = resources.GetObject(\"$this.BackgroundImage\")\r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Icon = resources.GetObject(\"$this.Icon\")\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - - [Test] - public void BitmapAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(bitmap, resourceWriter.GetResource("$this.BackgroundImage"))); - } - - [Test] - public void IconAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(icon, resourceWriter.GetResource("$this.Icon"))); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImageListResourcesTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImageListResourcesTestFixture.cs deleted file mode 100644 index 64c55dbabc..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImageListResourcesTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateImageListResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedPythonCode; - Icon icon; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add ImageList. - icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1"); - imageList.Images.Add("App.ico", icon); - imageList.Images.Add("", icon); - imageList.Images.Add("", icon); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1); - } - } - } - - [Test] - public void TearDownFixture() - { - icon.Dispose(); - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._components = System.ComponentModel.Container()\r\n" + - " resources = System.Resources.ResourceManager(\"RootNamespace.MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self._imageList1 = System.Windows.Forms.ImageList(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # imageList1\r\n" + - " # \r\n" + - " self._imageList1.ImageStream = resources.GetObject(\"imageList1.ImageStream\")\r\n" + - " self._imageList1.TransparentColor = System.Drawing.Color.Transparent\r\n" + - " self._imageList1.Images.SetKeyName(0, \"App.ico\")\r\n" + - " self._imageList1.Images.SetKeyName(1, \"\")\r\n" + - " self._imageList1.Images.SetKeyName(2, \"\")\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - - [Test] - public void ImageStreamAddedToResourceWriter() - { - Assert.IsNotNull(resourceWriter.GetResource("imageList1.ImageStream")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImeModeFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImeModeFormTestFixture.cs deleted file mode 100644 index 8038abc0d7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateImeModeFormTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateImeModeFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("ImeMode", false); - doubleBufferedPropertyDescriptor.SetValue(form, ImeMode.Alpha); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.ImeMode = System.Windows.Forms.ImeMode.Alpha\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedFormTestFixture.cs deleted file mode 100644 index 5a9d77a535..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedFormTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - class BaseForm : Form - { - Button button1 = new Button(); - - public BaseForm() - { - button1.Name = "button1"; - Controls.Add(button1); - } - } - - class DerivedForm : BaseForm - { - } - - /// - /// Tests that no code is generated for controls that are inherited from the base class. - /// - [TestFixture] - public class GenerateInheritedFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(DerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs deleted file mode 100644 index 0077cf0252..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - class ProtectedPanelBaseForm : Form - { - protected Panel panel1 = new Panel(); - Button button1 = new Button(); - - public ProtectedPanelBaseForm() - { - button1.Name = "button1"; - - panel1.Name = "panel1"; - panel1.Location = new Point(5, 10); - panel1.Size = new Size(200, 100); - panel1.Controls.Add(button1); - - Controls.Add(panel1); - } - } - - class ProtectedPanelDerivedForm : ProtectedPanelBaseForm - { - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Point PanelLocation { - get { return panel1.Location; } - set { panel1.Location = value; } - } - - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Size PanelSize { - get { return panel1.Size; } - set { panel1.Size = value; } - } - - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Panel GetPanel() - { - return panel1; - } - } - - /// - /// Tests that no code is generated for a protected panel control in the base class - /// that has child controls. - /// - [TestFixture] - public class GenerateInheritedProtectedPanelFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(ProtectedPanelDerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Move protected panel so we generate code for the new location. - ProtectedPanelDerivedForm derivedForm = (ProtectedPanelDerivedForm)form; - derivedForm.PanelLocation = new Point(10, 15); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System.Drawing.Point(10, 15)\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs deleted file mode 100644 index 37c57bc2e9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - class PublicToolTipBaseForm : Form - { - public ToolTip toolTip; - Container components = new Container(); - - public PublicToolTipBaseForm() - { - toolTip = new ToolTip(components); - } - } - - class PublicToolTipDerivedForm : PublicToolTipBaseForm - { - } - - [TestFixture] - public class GenerateInheritedToolTipTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(PublicToolTipDerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - PublicToolTipDerivedForm form = (PublicToolTipDerivedForm)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - form.toolTip.SetToolTip(form, "test"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.toolTip.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs deleted file mode 100644 index 934f4e0d01..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewGroupsTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add groups. - ListViewGroup group1 = (ListViewGroup)serializationManager.CreateInstance(typeof(ListViewGroup), new object[0], "listViewGroup1", false); - group1.Header = "ListViewGroup"; - group1.HeaderAlignment = HorizontalAlignment.Right; - group1.Name = "defaultGroup"; - group1.Tag = "tag1"; - listView.Groups.Add(group1); - - ListViewGroup group2 = (ListViewGroup)serializationManager.CreateInstance(typeof(ListViewGroup), new object[0], "listViewGroup2", false); - group2.Header = "ListViewGroup"; - group2.HeaderAlignment = HorizontalAlignment.Center; - group2.Name = "listViewGroup2"; - listView.Groups.Add(group2); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewGroup1 = System.Windows.Forms.ListViewGroup(\"ListViewGroup\", System.Windows.Forms.HorizontalAlignment.Right)\r\n" + - " listViewGroup2 = System.Windows.Forms.ListViewGroup(\"ListViewGroup\", System.Windows.Forms.HorizontalAlignment.Center)\r\n" + - " self._listView1 = System.Windows.Forms.ListView()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " listViewGroup1.Header = \"ListViewGroup\"\r\n" + - " listViewGroup1.HeaderAlignment = System.Windows.Forms.HorizontalAlignment.Right\r\n" + - " listViewGroup1.Name = \"defaultGroup\"\r\n" + - " listViewGroup1.Tag = \"tag1\"\r\n" + - " listViewGroup2.Header = \"ListViewGroup\"\r\n" + - " listViewGroup2.HeaderAlignment = System.Windows.Forms.HorizontalAlignment.Center\r\n" + - " listViewGroup2.Name = \"listViewGroup2\"\r\n" + - " self._listView1.Groups.AddRange(System.Array[System.Windows.Forms.ListViewGroup](\r\n" + - " [listViewGroup1,\r\n" + - " listViewGroup2]))\r\n" + - " self._listView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._listView1.Name = \"listView1\"\r\n" + - " self._listView1.Size = System.Drawing.Size(204, 104)\r\n" + - " self._listView1.TabIndex = 0\r\n" + - " self._listView1.View = System.Windows.Forms.View.Details\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewItemTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewItemTestFixture.cs deleted file mode 100644 index 40579d9a96..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewItemTestFixture.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewItemsFormTestFixture - { - string generatedPythonCode; - ColumnHeader columnHeader1; - ColumnHeader columnHeader2; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add column headers. - columnHeader1 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader1"); - descriptors = TypeDescriptor.GetProperties(columnHeader1); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader1, "columnHeader1"); - listView.Columns.Add(columnHeader1); - - columnHeader2 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader2"); - descriptors = TypeDescriptor.GetProperties(columnHeader2); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader2, "columnHeader2"); - listView.Columns.Add(columnHeader2); - - // Add list view items. - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"aaa"}, "listViewItem1", false); - item.ToolTipText = "tooltip"; - listView.Items.Add(item); - - item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"bbb"}, "listViewItem2", false); - listView.Items.Add(item); - - item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem3", false); - listView.Items.Add(item); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewItem1 = System.Windows.Forms.ListViewItem(\"aaa\")\r\n" + - " listViewItem2 = System.Windows.Forms.ListViewItem(\"bbb\")\r\n" + - " listViewItem3 = System.Windows.Forms.ListViewItem(\"\")\r\n" + - " self._listView1 = System.Windows.Forms.ListView()\r\n" + - " self._columnHeader1 = System.Windows.Forms.ColumnHeader()\r\n" + - " self._columnHeader2 = System.Windows.Forms.ColumnHeader()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " self._listView1.Columns.AddRange(System.Array[System.Windows.Forms.ColumnHeader](\r\n" + - " [self._columnHeader1,\r\n" + - " self._columnHeader2]))\r\n" + - " listViewItem1.ToolTipText = \"tooltip\"\r\n" + - " self._listView1.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem](\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2,\r\n" + - " listViewItem3]))\r\n" + - " self._listView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._listView1.Name = \"listView1\"\r\n" + - " self._listView1.Size = System.Drawing.Size(204, 104)\r\n" + - " self._listView1.TabIndex = 0\r\n" + - " self._listView1.View = System.Windows.Forms.View.Details\r\n" + - " # \r\n" + - " # columnHeader1\r\n" + - " # \r\n" + - " self._columnHeader1.Text = \"columnHeader1\"\r\n" + - " # \r\n" + - " # columnHeader2\r\n" + - " # \r\n" + - " self._columnHeader2.Text = \"columnHeader2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs deleted file mode 100644 index 1b21d884e1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewSubItemsTestFixture - { - string generatedPythonCode; - ColumnHeader columnHeader1; - ColumnHeader columnHeader2; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add column headers. - columnHeader1 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader1"); - descriptors = TypeDescriptor.GetProperties(columnHeader1); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader1, "columnHeader1"); - listView.Columns.Add(columnHeader1); - - columnHeader2 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader2"); - descriptors = TypeDescriptor.GetProperties(columnHeader2); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader2, "columnHeader2"); - listView.Columns.Add(columnHeader2); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add list view item with 3 sub items. - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"listItem1"}, "listViewItem1", false); - item.SubItems.Add("subItem1"); - item.SubItems.Add("subItem2"); - item.SubItems.Add("subItem3"); - listView.Items.Add(item); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - /// - /// Should include the column header and list view item creation. - /// - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewItem1 = System.Windows.Forms.ListViewItem(System.Array[System.String](\r\n" + - " [\"listItem1\",\r\n" + - " \"subItem1\",\r\n" + - " \"subItem2\",\r\n" + - " \"subItem3\"]), -1)\r\n" + - " self._listView1 = System.Windows.Forms.ListView()\r\n" + - " self._columnHeader1 = System.Windows.Forms.ColumnHeader()\r\n" + - " self._columnHeader2 = System.Windows.Forms.ColumnHeader()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " self._listView1.Columns.AddRange(System.Array[System.Windows.Forms.ColumnHeader](\r\n" + - " [self._columnHeader1,\r\n" + - " self._columnHeader2]))\r\n" + - " self._listView1.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem](\r\n" + - " [listViewItem1]))\r\n" + - " self._listView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._listView1.Name = \"listView1\"\r\n" + - " self._listView1.Size = System.Drawing.Size(204, 104)\r\n" + - " self._listView1.TabIndex = 0\r\n" + - " self._listView1.View = System.Windows.Forms.View.Details\r\n" + - " # \r\n" + - " # columnHeader1\r\n" + - " # \r\n" + - " self._columnHeader1.Text = \"columnHeader1\"\r\n" + - " # \r\n" + - " # columnHeader2\r\n" + - " # \r\n" + - " self._columnHeader2.Text = \"columnHeader2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewWithImageListTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewWithImageListTestFixture.cs deleted file mode 100644 index 8d568c82f9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateListViewWithImageListTestFixture.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewWithImageListFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add ImageList. - Icon icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1"); - imageList.Images.Add("App.ico", icon); - imageList.Images.Add("b.ico", icon); - imageList.Images.Add("c.ico", icon); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - // Add list view items. - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"aaa"}, "listViewItem1", false); - item.ImageIndex = 1; - listView.Items.Add(item); - - ListViewItem item2 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"bbb"}, "listViewItem2", false); - item2.ImageKey = "App.ico"; - listView.Items.Add(item2); - - ListViewItem item3 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem3", false); - item3.ImageIndex = 2; - listView.Items.Add(item3); - - ListViewItem item4 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem4", false); - item4.ImageKey = "b.ico"; - listView.Items.Add(item4); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - /// - /// Should include the column header and list view item creation. - /// - [Test] - public void GenerateCode() - { - string expectedCode = "self._components = System.ComponentModel.Container()\r\n" + - "listViewItem1 = System.Windows.Forms.ListViewItem(\"aaa\", 1)\r\n" + - "listViewItem2 = System.Windows.Forms.ListViewItem(\"bbb\", \"App.ico\")\r\n" + - "listViewItem3 = System.Windows.Forms.ListViewItem(\"\", 2)\r\n" + - "listViewItem4 = System.Windows.Forms.ListViewItem(\"\", \"b.ico\")\r\n" + - "resources = System.Resources.ResourceManager(\"MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - "self._listView1 = System.Windows.Forms.ListView()\r\n" + - "self._imageList1 = System.Windows.Forms.ImageList(self._components)\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# listView1\r\n" + - "# \r\n" + - "self._listView1.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem](\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2,\r\n" + - " listViewItem3,\r\n" + - " listViewItem4]))\r\n" + - "self._listView1.Location = System.Drawing.Point(0, 0)\r\n" + - "self._listView1.Name = \"listView1\"\r\n" + - "self._listView1.Size = System.Drawing.Size(204, 104)\r\n" + - "self._listView1.TabIndex = 0\r\n" + - "self._listView1.View = System.Windows.Forms.View.Details\r\n" + - "# \r\n" + - "# imageList1\r\n" + - "# \r\n" + - "self._imageList1.ImageStream = resources.GetObject(\"imageList1.ImageStream\")\r\n" + - "self._imageList1.TransparentColor = System.Drawing.Color.Transparent\r\n" + - "self._imageList1.Images.SetKeyName(0, \"App.ico\")\r\n" + - "self._imageList1.Images.SetKeyName(1, \"b.ico\")\r\n" + - "self._imageList1.Images.SetKeyName(2, \"c.ico\")\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - "self.Controls.Add(self._listView1)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(False)\r\n"; - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs deleted file mode 100644 index c94861ab8c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateLocalImageResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedPythonCode; - MockResourceWriter resourceWriter2; - MockComponentCreator componentCreator2; - Bitmap bitmap; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - resourceWriter2 = new MockResourceWriter(); - componentCreator2 = new MockComponentCreator(); - componentCreator2.SetResourceWriter(resourceWriter2); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add picture box - PictureBox pictureBox = (PictureBox)host.CreateComponent(typeof(PictureBox), "pictureBox1"); - pictureBox.Location = new Point(0, 0); - bitmap = new Bitmap(10, 10); - pictureBox.Image = bitmap; - pictureBox.Size = new Size(100, 120); - pictureBox.TabIndex = 0; - form.Controls.Add(pictureBox); - - // Add bitmap to form. - form.BackgroundImage = new Bitmap(10, 10); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - - // Check that calling the GenerateInitializeComponentMethodBody also generates a resource file. - host.RemoveService(typeof(IResourceService)); - host.AddService(typeof(IResourceService), componentCreator2); - - serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " resources = System.Resources.ResourceManager(\"MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self._pictureBox1 = System.Windows.Forms.PictureBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " self._pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " self._pictureBox1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._pictureBox1.Name = \"pictureBox1\"\r\n" + - " self._pictureBox1.Size = System.Drawing.Size(100, 120)\r\n" + - " self._pictureBox1.TabIndex = 0\r\n" + - " self._pictureBox1.TabStop = False\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackgroundImage = resources.GetObject(\"$this.BackgroundImage\")\r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._pictureBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - - [Test] - public void ResourceWriterRetrievedFromComponentCreator() - { - Assert.IsTrue(componentCreator.GetResourceWriterCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceWriter() - { - Assert.AreEqual(CultureInfo.InvariantCulture, componentCreator.CultureInfoPassedToGetResourceWriter); - } - - [Test] - public void ResourceWriterRetrievedFromComponentCreator2() - { - Assert.IsTrue(componentCreator2.GetResourceWriterCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceWriter2() - { - Assert.AreEqual(CultureInfo.InvariantCulture, componentCreator2.CultureInfoPassedToGetResourceWriter); - } - -// [Test] -// public void ResourceWriter2IsDisposed() -// { -// Assert.IsTrue(resourceWriter2.IsDisposed); -// } - - [Test] - public void BitmapAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(bitmap, resourceWriter.GetResource("pictureBox1.Image"))); - } - - [Test] - public void ResourceWriterHasNonNullPictureBox1ImageResource() - { - Assert.IsNotNull(resourceWriter.GetResource("pictureBox1.Image")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs deleted file mode 100644 index e81c94d03e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Adding a MenuStrip control to a form in the designer generates code for a - /// miniToolStrip - System.Windows.Forms.Design.ToolStripTemplateNode+TransparentToolStrip() - /// This is a design time control and should be ignored. - /// - [TestFixture] - public class GenerateMenuStripFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - form.Controls.Add(menuStrip); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._menuStrip1 = System.Windows.Forms.MenuStrip()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " self._menuStrip1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._menuStrip1.Name = \"menuStrip1\"\r\n" + - " self._menuStrip1.Size = System.Drawing.Size(200, 24)\r\n" + - " self._menuStrip1.TabIndex = 0\r\n" + - " self._menuStrip1.Text = \"menuStrip1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._menuStrip1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripItemsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripItemsTestFixture.cs deleted file mode 100644 index f0495b30a0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMenuStripItemsTestFixture.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateMenuStripItemsFormTestFixture - { - string generatedPythonCode; - Size fileMenuItemSize; - Size openMenuItemSize; - Size exitMenuItemSize; - Size editMenuItemSize; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - menuStrip.Size = new System.Drawing.Size(200, 24); - - // Add menu strip items. - ToolStripMenuItem fileMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "fileToolStripMenuItem"); - fileMenuItem.Text = "&File"; - - ToolStripMenuItem openMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "openToolStripMenuItem"); - openMenuItem.Text = "&Open"; - - ToolStripMenuItem exitMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "exitToolStripMenuItem"); - exitMenuItem.Text = "E&xit"; - fileMenuItem.DropDownItems.Add(openMenuItem); - fileMenuItem.DropDownItems.Add(exitMenuItem); - - // Add non-sited component. - fileMenuItem.DropDownItems.Add(new ToolStripMenuItem()); - - menuStrip.Items.Add(fileMenuItem); - - ToolStripMenuItem editMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "editToolStripMenuItem"); - editMenuItem.Text = "&Edit"; - menuStrip.Items.Add(editMenuItem); - - form.Controls.Add(menuStrip); - - fileMenuItemSize = fileMenuItem.Size; - openMenuItemSize = openMenuItem.Size; - exitMenuItemSize = exitMenuItem.Size; - editMenuItemSize = editMenuItem.Size; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._menuStrip1 = System.Windows.Forms.MenuStrip()\r\n" + - " self._fileToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._openToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._exitToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._editToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._menuStrip1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " self._menuStrip1.Items.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._fileToolStripMenuItem,\r\n" + - " self._editToolStripMenuItem]))\r\n" + - " self._menuStrip1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._menuStrip1.Name = \"menuStrip1\"\r\n" + - " self._menuStrip1.Size = System.Drawing.Size(200, 24)\r\n" + - " self._menuStrip1.TabIndex = 0\r\n" + - " self._menuStrip1.Text = \"menuStrip1\"\r\n" + - " # \r\n" + - " # fileToolStripMenuItem\r\n" + - " # \r\n" + - " self._fileToolStripMenuItem.DropDownItems.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._openToolStripMenuItem,\r\n" + - " self._exitToolStripMenuItem]))\r\n" + - " self._fileToolStripMenuItem.Name = \"fileToolStripMenuItem\"\r\n" + - " self._fileToolStripMenuItem.Size = " + SizeToString(fileMenuItemSize) + "\r\n" + - " self._fileToolStripMenuItem.Text = \"&File\"\r\n" + - " # \r\n" + - " # openToolStripMenuItem\r\n" + - " # \r\n" + - " self._openToolStripMenuItem.Name = \"openToolStripMenuItem\"\r\n" + - " self._openToolStripMenuItem.Size = " + SizeToString(openMenuItemSize) + "\r\n" + - " self._openToolStripMenuItem.Text = \"&Open\"\r\n" + - " # \r\n" + - " # exitToolStripMenuItem\r\n" + - " # \r\n" + - " self._exitToolStripMenuItem.Name = \"exitToolStripMenuItem\"\r\n" + - " self._exitToolStripMenuItem.Size = " + SizeToString(exitMenuItemSize) + "\r\n" + - " self._exitToolStripMenuItem.Text = \"E&xit\"\r\n" + - " # \r\n" + - " # editToolStripMenuItem\r\n" + - " # \r\n" + - " self._editToolStripMenuItem.Name = \"editToolStripMenuItem\"\r\n" + - " self._editToolStripMenuItem.Size = " + SizeToString(editMenuItemSize) + "\r\n" + - " self._editToolStripMenuItem.Text = \"&Edit\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._menuStrip1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._menuStrip1.ResumeLayout(False)\r\n" + - " self._menuStrip1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - - string SizeToString(Size size) - { - return PythonPropertyValueAssignment.ToString(size); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs deleted file mode 100644 index 8674a0b4d7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that a form's MinimumSize, AutoScrollMinSize and AutoScrollMargin properties are generated - /// in the InitializeComponent method. - /// - [TestFixture] - public class GenerateMinSizeFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("MinimumSize", false); - descriptor.SetValue(form, new Size(100, 200)); - descriptor = descriptors.Find("AutoScrollMinSize", false); - descriptor.SetValue(form, new Size(10, 20)); - descriptor = descriptors.Find("AutoScrollMargin", false); - descriptor.SetValue(form, new Size(11, 22)); - descriptor = descriptors.Find("AutoScroll", false); - descriptor.SetValue(form, false); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AutoScrollMargin = System.Drawing.Size(11, 22)\r\n" + - " self.AutoScrollMinSize = System.Drawing.Size(10, 20)\r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.MinimumSize = System.Drawing.Size(100, 200)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs deleted file mode 100644 index 3fcfc6d0fb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateMonthCalendarTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add month calendar. - MonthCalendar calendar = (MonthCalendar)host.CreateComponent(typeof(MonthCalendar), "monthCalendar1"); - calendar.TabIndex = 0; - calendar.Location = new Point(0, 0); - calendar.AddMonthlyBoldedDate(new DateTime(2009, 1, 2)); - calendar.AddMonthlyBoldedDate(new DateTime(0)); - - form.Controls.Add(calendar); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._monthCalendar1 = System.Windows.Forms.MonthCalendar()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # monthCalendar1\r\n" + - " # \r\n" + - " self._monthCalendar1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._monthCalendar1.MonthlyBoldedDates = System.Array[System.DateTime](\r\n" + - " [System.DateTime(2009, 1, 2, 0, 0, 0, 0),\r\n" + - " System.DateTime(0)])\r\n" + - " self._monthCalendar1.Name = \"monthCalendar1\"\r\n" + - " self._monthCalendar1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._monthCalendar1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs deleted file mode 100644 index 62185875a4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Ensures that SuspendLayout and ResumeLayout methods are generated for a panel containing controls and sitting on top of - /// another panel. - /// - [TestFixture] - public class GenerateNestedPanelFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Panel panel1 = (Panel)host.CreateComponent(typeof(Panel), "panel1"); - panel1.Location = new Point(0, 0); - panel1.TabIndex = 0; - panel1.Size = new Size(200, 220); - - Panel panel2 = (Panel)host.CreateComponent(typeof(Panel), "panel2"); - panel2.Location = new Point(10, 15); - panel2.TabIndex = 0; - panel2.Size = new Size(100, 120); - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Location = new Point(5, 5); - textBox.TabIndex = 0; - textBox.Size = new Size(110, 20); - panel2.Controls.Add(textBox); - - panel1.Controls.Add(panel2); - form.Controls.Add(panel1); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._panel1 = System.Windows.Forms.Panel()\r\n" + - " self._panel2 = System.Windows.Forms.Panel()\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self._panel1.SuspendLayout()\r\n" + - " self._panel2.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self._panel1.Controls.Add(self._panel2)\r\n" + - " self._panel1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._panel1.Name = \"panel1\"\r\n" + - " self._panel1.Size = System.Drawing.Size(200, 220)\r\n" + - " self._panel1.TabIndex = 0\r\n" + - " # \r\n" + - " # panel2\r\n" + - " # \r\n" + - " self._panel2.Controls.Add(self._textBox1)\r\n" + - " self._panel2.Location = System.Drawing.Point(10, 15)\r\n" + - " self._panel2.Name = \"panel2\"\r\n" + - " self._panel2.Size = System.Drawing.Size(100, 120)\r\n" + - " self._panel2.TabIndex = 0\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Location = System.Drawing.Point(5, 5)\r\n" + - " self._textBox1.Name = \"textBox1\"\r\n" + - " self._textBox1.Size = System.Drawing.Size(110, 20)\r\n" + - " self._textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._panel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._panel1.ResumeLayout(False)\r\n" + - " self._panel2.ResumeLayout(False)\r\n" + - " self._panel2.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs deleted file mode 100644 index 6982fa2cf0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratePanelFormTestFixture.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GeneratePanelFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IEventBindingService), eventBindingService); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Panel panel = (Panel)host.CreateComponent(typeof(Panel), "panel1"); - panel.Location = new Point(10, 15); - panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - panel.TabIndex = 0; - panel.Size = new Size(100, 120); - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Location = new Point(5, 5); - textBox.TabIndex = 0; - textBox.Size = new Size(110, 20); - panel.Controls.Add(textBox); - - // Add an event handler to the panel to check that this code is generated - // before the text box is initialized. - EventDescriptorCollection events = TypeDescriptor.GetEvents(panel); - EventDescriptor clickEvent = events.Find("Click", false); - PropertyDescriptor clickEventProperty = eventBindingService.GetEventProperty(clickEvent); - clickEventProperty.SetValue(panel, "Panel1Click"); - - form.Controls.Add(panel); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._panel1 = System.Windows.Forms.Panel()\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self._panel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self._panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right\r\n" + - " self._panel1.Controls.Add(self._textBox1)\r\n" + - " self._panel1.Location = System.Drawing.Point(10, 15)\r\n" + - " self._panel1.Name = \"panel1\"\r\n" + - " self._panel1.Size = System.Drawing.Size(100, 120)\r\n" + - " self._panel1.TabIndex = 0\r\n" + - " self._panel1.Click += self.Panel1Click\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Location = System.Drawing.Point(5, 5)\r\n" + - " self._textBox1.Name = \"textBox1\"\r\n" + - " self._textBox1.Size = System.Drawing.Size(110, 20)\r\n" + - " self._textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._panel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._panel1.ResumeLayout(False)\r\n" + - " self._panel1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs deleted file mode 100644 index 12d0c408f2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that multiline text is correctly generated for the RichTextBox. - /// - [TestFixture] - public class GenerateRichTextBoxTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - RichTextBox textBox = (RichTextBox)host.CreateComponent(typeof(RichTextBox), "richTextBox1"); - textBox.Size = new Size(110, 20); - textBox.TabIndex = 1; - textBox.Location = new Point(10, 10); - textBox.Text = "abc\r\n" + - "def\r\n" + - "ghi\r\n"; - - form.Controls.Add(textBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._richTextBox1 = System.Windows.Forms.RichTextBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # richTextBox1\r\n" + - " # \r\n" + - " self._richTextBox1.Location = System.Drawing.Point(10, 10)\r\n" + - " self._richTextBox1.Name = \"richTextBox1\"\r\n" + - " self._richTextBox1.Size = System.Drawing.Size(110, 20)\r\n" + - " self._richTextBox1.TabIndex = 1\r\n" + - " self._richTextBox1.Text = \"\"\"abc\n" + - "def\n" + - "ghi\n" + - "\"\"\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._richTextBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs deleted file mode 100644 index dd12b314a5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateRightToLeftFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("RightToLeft", false); - doubleBufferedPropertyDescriptor.SetValue(form, RightToLeft.Yes); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.RightToLeft = System.Windows.Forms.RightToLeft.Yes\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateSimpleFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateSimpleFormTestFixture.cs deleted file mode 100644 index 8c686813b9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateSimpleFormTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateSimpleFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs deleted file mode 100644 index 0d23ef634f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTableLayoutPanelTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add table layout panel. - TableLayoutPanel tableLayoutPanel1 = (TableLayoutPanel)host.CreateComponent(typeof(TableLayoutPanel), "tableLayoutPanel1"); - tableLayoutPanel1.ColumnCount = 2; - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F)); - tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F)); - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F)); - tableLayoutPanel1.Size = new System.Drawing.Size(200, 100); - tableLayoutPanel1.TabIndex = 0; - - form.Controls.Add(tableLayoutPanel1); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._tableLayoutPanel1 = System.Windows.Forms.TableLayoutPanel()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # tableLayoutPanel1\r\n" + - " # \r\n" + - " self._tableLayoutPanel1.ColumnCount = 2\r\n" + - " self._tableLayoutPanel1.ColumnStyles.Add(System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 40))\r\n" + - " self._tableLayoutPanel1.ColumnStyles.Add(System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60))\r\n" + - " self._tableLayoutPanel1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._tableLayoutPanel1.Name = \"tableLayoutPanel1\"\r\n" + - " self._tableLayoutPanel1.RowCount = 2\r\n" + - " self._tableLayoutPanel1.RowStyles.Add(System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20))\r\n" + - " self._tableLayoutPanel1.RowStyles.Add(System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25))\r\n" + - " self._tableLayoutPanel1.Size = System.Drawing.Size(200, 100)\r\n" + - " self._tableLayoutPanel1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._tableLayoutPanel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs deleted file mode 100644 index 647965d220..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTextBoxFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Size = new Size(110, 20); - textBox.TabIndex = 1; - textBox.Location = new Point(10, 10); - - form.Controls.Add(textBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Location = System.Drawing.Point(10, 10)\r\n" + - " self._textBox1.Name = \"textBox1\"\r\n" + - " self._textBox1.Size = System.Drawing.Size(110, 20)\r\n" + - " self._textBox1.TabIndex = 1\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._textBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTimerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTimerTestFixture.cs deleted file mode 100644 index f23f897a37..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTimerTestFixture.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTimerTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Timer timer = (Timer)host.CreateComponent(typeof(Timer), "timer1"); - descriptors = TypeDescriptor.GetProperties(timer); - namePropertyDescriptor = descriptors.Find("Interval", false); - namePropertyDescriptor.SetValue(timer, 1000); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._components = System.ComponentModel.Container()\r\n" + - " self._timer1 = System.Windows.Forms.Timer(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # timer1\r\n" + - " # \r\n" + - " self._timer1.Interval = 1000\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateToolTipFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateToolTipFormTestFixture.cs deleted file mode 100644 index 7a71d7ff20..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateToolTipFormTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateToolTipFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - ToolTip toolTip = (ToolTip)host.CreateComponent(typeof(ToolTip), "toolTip1"); - toolTip.SetToolTip(form, "test"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._components = System.ComponentModel.Container()\r\n" + - " self._toolTip1 = System.Windows.Forms.ToolTip(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._toolTip1.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTreeViewTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTreeViewTestFixture.cs deleted file mode 100644 index 83f45d456b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateTreeViewTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTreeViewTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add tree view. - TreeView treeView = (TreeView)host.CreateComponent(typeof(TreeView), "treeView1"); - treeView.LineColor = Color.Black; - treeView.Location = new Point(0, 0); - treeView.Size = new Size(100, 100); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add first root node. - TreeNode firstRootNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode3", false); - firstRootNode.Name = "RootNode0"; - firstRootNode.Text = "RootNode0.Text"; - treeView.Nodes.Add(firstRootNode); - - // Add first child node. - TreeNode firstChildNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode2", false); - firstChildNode.Name = "ChildNode0"; - firstChildNode.Text = "ChildNode0.Text"; - firstRootNode.Nodes.Add(firstChildNode); - - // Add second child node. - TreeNode secondChildNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode1", false); - secondChildNode.Name = "ChildNode1"; - secondChildNode.Text = "ChildNode1.Text"; - firstChildNode.Nodes.Add(secondChildNode); - - form.Controls.Add(treeView); - - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " treeNode1 = System.Windows.Forms.TreeNode(\"ChildNode1.Text\")\r\n" + - " treeNode2 = System.Windows.Forms.TreeNode(\"ChildNode0.Text\", System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode1]))\r\n" + - " treeNode3 = System.Windows.Forms.TreeNode(\"RootNode0.Text\", System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode2]))\r\n" + - " self._treeView1 = System.Windows.Forms.TreeView()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " self._treeView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._treeView1.Name = \"treeView1\"\r\n" + - " treeNode1.Name = \"ChildNode1\"\r\n" + - " treeNode1.Text = \"ChildNode1.Text\"\r\n" + - " treeNode2.Name = \"ChildNode0\"\r\n" + - " treeNode2.Text = \"ChildNode0.Text\"\r\n" + - " treeNode3.Name = \"RootNode0\"\r\n" + - " treeNode3.Text = \"RootNode0.Text\"\r\n" + - " self._treeView1.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode3]))\r\n" + - " self._treeView1.Size = System.Drawing.Size(100, 100)\r\n" + - " self._treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._treeView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs deleted file mode 100644 index 1d0d4d30a5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class GenerateUserControlWithNullPropertyValueTests : GenerateUserControlWithNullPropertyValueTestsBase - { - [Test] - public void GeneratedCode() - { - string expectedCode = - "self._userControl1 = ICSharpCode.Scripting.Tests.Utils.NullPropertyUserControl()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# userControl1\r\n" + - "# \r\n" + - "self._userControl1.FooBar = None\r\n" + - "self._userControl1.Location = System.Drawing.Point(0, 0)\r\n" + - "self._userControl1.Name = \"userControl1\"\r\n" + - "self._userControl1.Size = System.Drawing.Size(10, 10)\r\n" + - "self._userControl1.TabIndex = 0\r\n" + - "# \r\n" + - "# MainControl\r\n" + - "# \r\n" + - "self.Controls.Add(self._userControl1)\r\n" + - "self.Name = \"MainControl\"\r\n" + - "self.Size = System.Drawing.Size(200, 300)\r\n" + - "self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedCode, generatedCode); - } - - protected override IScriptingCodeDomSerializer CreateSerializer() - { - return PythonCodeDomSerializerHelper.CreateSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs deleted file mode 100644 index 7be374086c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the controls are initialized in the order they were put on the form. - /// The forms designer has them in reverse order in the Controls collection. - /// - [TestFixture] - public class GeneratedControlOrderingTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Button button = (Button)host.CreateComponent(typeof(Button), "button1"); - button.Location = new Point(0, 0); - button.Size = new Size(10, 10); - button.Text = "button1"; - button.TabIndex = 0; - button.UseCompatibleTextRendering = false; - form.Controls.Add(button); - - RadioButton radioButton = (RadioButton)host.CreateComponent(typeof(RadioButton), "radioButton1"); - radioButton.Location = new Point(20, 0); - radioButton.Size = new Size(10, 10); - radioButton.Text = "radioButton1"; - radioButton.TabIndex = 1; - radioButton.UseCompatibleTextRendering = false; - form.Controls.Add(radioButton); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self._button1 = System.Windows.Forms.Button()\r\n" + - " self._radioButton1 = System.Windows.Forms.RadioButton()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # radioButton1\r\n" + - " # \r\n" + - " self._radioButton1.Location = System.Drawing.Point(20, 0)\r\n" + - " self._radioButton1.Name = \"radioButton1\"\r\n" + - " self._radioButton1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._radioButton1.TabIndex = 1\r\n" + - " self._radioButton1.Text = \"radioButton1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.Controls.Add(self._radioButton1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs deleted file mode 100644 index cef1a88d5c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - /// - /// The python form code generator should ignore any design time properties (e.g. Locked) of the form. - /// These are put in the .resx file not the source code. - /// - [TestFixture] - public class IgnoreDesignTimePropertiesTestFixture - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - string generatedPythonCode; - - /// - /// After a form is loaded onto a DesignSurface this checks that the PythonForm does not try to - /// add design time properties and does not throw a null reference exception. - /// - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void DesignTimePropertyIsIgnoredInGeneratedCode() - { - Assert.AreEqual(expectedCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs deleted file mode 100644 index 85e499fb7c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Base class that tests the PythonDesignerGenerator.InsertEventComponent method. - /// - public class InsertEventHandlerTestFixtureBase - { - protected string file; - protected int position; - protected bool insertedEventHandler; - protected MockTextEditorViewContent mockViewContent; - protected DerivedFormDesignerViewContent viewContent; - protected string fileName = @"C:\Projects\Python\mainform.py"; - protected DerivedPythonDesignerGenerator generator; - protected MockTextEditorOptions textEditorOptions; - - [TestFixtureSetUp] - public void SetUpFixture() - { - textEditorOptions = new MockTextEditorOptions(); - generator = new DerivedPythonDesignerGenerator(textEditorOptions); - mockViewContent = new MockTextEditorViewContent(); - viewContent = new DerivedFormDesignerViewContent(mockViewContent, new MockOpenedFile(fileName)); - generator.Attach(viewContent); - viewContent.DesignerCodeFileContent = GetTextEditorCode(); - - PythonParser parser = new PythonParser(); - ICompilationUnit parserCompilationUnit = parser.Parse(new DefaultProjectContent(), fileName, GetTextEditorCode()); - ParseInformation parseInfo = new ParseInformation(parserCompilationUnit); - generator.ParseInfoToReturnFromParseFileMethod = parseInfo; - - AfterSetUpFixture(); - } - - /// - /// Called at the end of the SetUpFixture method. - /// - public virtual void AfterSetUpFixture() - { - } - - /// - /// Gets the form's code. - /// - protected virtual string GetTextEditorCode() - { - return String.Empty; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs deleted file mode 100644 index d3513fa9df..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonDesignerGenerator uses the text editor properties for indentation when - /// inserting an event handler into the document. - /// - [TestFixture] - public class InsertEventHandlerWithSpaceIndentTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - base.textEditorOptions.ConvertTabsToSpaces = true; - base.textEditorOptions.IndentationSize = 4; - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = GetTextEditorCode(); - string eventHandler = - " def button1_click(self, sender, e):\r\n" + - " pass"; - expectedCode = expectedCode + "\r\n" + eventHandler; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - /// - /// Note that the text editor code already has the - /// statement: - /// - /// "self._button1.Click += button1_click" - /// - /// This is generated by the form designer framework and not - /// by the designer generator. - /// - protected override string GetTextEditorCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponents()\r\n" + - " \r\n" + - " def InitializeComponents(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self.Controls.Add(self._button1)\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs deleted file mode 100644 index a42394b77b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonDesignerGenerator inserts an event handler - /// into the document correctly. - /// - [TestFixture] - public class InsertNewEventHandlerTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = GetTextEditorCode(); - string eventHandler = "\tdef button1_click(self, sender, e):\r\n" + - "\t\tpass"; - expectedCode = expectedCode + "\r\n" + eventHandler; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - /// - /// Note that the text editor code already has the - /// statement: - /// - /// "self._button1.Click += button1_click" - /// - /// This is generated by the form designer framework and not - /// by the designer generator. - /// - protected override string GetTextEditorCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\t\r\n" + - "\tdef InitializeComponents(self):\r\n" + - "\t\tself._button1 = System.Windows.Forms.Button()\r\n" + - "\t\tself.Controls.Add(self._button1)\r\n"; - } - - /// - /// The generator should call the FormDesignerViewContent's - /// MergeFormChanges method to make sure the latest version of the - /// code is in the text editor. - /// - [Test] - public void MergeFormChangesCalled() - { - Assert.IsTrue(viewContent.MergeFormChangesCalled); - } - - [Test] - public void InsertedEventHandlerReturnedTrue() - { - Assert.IsTrue(insertedEventHandler); - } - - [Test] - public void PositionEventHandlerInserted() - { - // The position is actually a line number. So - // it should be set to line 11. - Assert.AreEqual(11, position); - } - - [Test] - public void FileNameSameAsDocumentFileName() - { - Assert.AreEqual(viewContent.DesignerCodeFile.FileName.ToString(), file); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs deleted file mode 100644 index 2890c85c6c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonDesignerGenerator adds an extra new line between the previous event handler - /// and the new one inserted. - /// - [TestFixture] - public class InsertSecondEventHandlerTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button2_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = GetTextEditorCode(); - string eventHandler = "\tdef button1_click(self, sender, e):\r\n" + - "\t\tpass\r\n" + - "\r\n" + - "\tdef button2_click(self, sender, e):\r\n" + - "\t\tpass"; - expectedCode = expectedCode + "\r\n" + eventHandler; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - protected override string GetTextEditorCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\t\r\n" + - "\tdef InitializeComponents(self):\r\n" + - "\t\tself._button1 = System.Windows.Forms.Button()\r\n" + - "\t\tself.Controls.Add(self._button1)\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFormDesignableTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFormDesignableTestFixture.cs deleted file mode 100644 index 385e7a0bfd..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFormDesignableTestFixture.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the SecondaryDisplayBinding detects that the form - /// is designable: - /// - /// 1) Has an InitializeComponents method. - /// 2) Has a base class of Form. - /// - [TestFixture] - public class IsFormDesignableTestFixture - { - IMethod initializeComponentsMethod; - protected IClass mainFormClass; - ParseInformation parseInfo; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonParser parser = new PythonParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\Test\MainForm.py", GetPythonCode()); - - parseInfo = new ParseInformation(compilationUnit); - - if (compilationUnit.Classes.Count > 0) { - mainFormClass = compilationUnit.Classes[0]; - initializeComponentsMethod = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(mainFormClass); - } - } - - [Test] - public void InitializeComponentsIsNotNull() - { - Assert.IsNotNull(initializeComponentsMethod); - } - - [Test] - public void BaseClassIsForm() - { - Assert.IsTrue(FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(mainFormClass)); - } - - [Test] - public void IsDesignable() - { - Assert.IsTrue(FormsDesignerSecondaryDisplayBinding.IsDesignable(parseInfo)); - } - - protected virtual string GetPythonCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\r\n" + - "\tdef InitializeComponent(self):\r\n" + - "\t\tpass\r\n" + - "\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs deleted file mode 100644 index 7b20252a3c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the SecondaryDisplayBinding detects that the form - /// is designable when the base class is fully qualified. - /// - [TestFixture] - public class IsFullyQualifiedBaseClassFormDesignableTestFixture : IsFormDesignableTestFixture - { - protected override string GetPythonCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\r\n" + - "\tdef InitializeComponent(self):\r\n" + - "\t\tpass\r\n" + - "\r\n"; - } - - [Test] - public void MainFormClassBaseTypeIsForm() - { - IReturnType baseType = null; - foreach (IReturnType returnType in mainFormClass.BaseTypes) { - if (returnType.Name == "Form") { - baseType = returnType; - break; - } - } - Assert.IsNotNull(baseType); - } - - [Test] - public void MainFormClassBaseTypeFullNameIsSystemWindowsFormsForm() - { - IReturnType baseType = null; - foreach (IReturnType returnType in mainFormClass.BaseTypes) { - if (returnType.FullyQualifiedName == "System.Windows.Forms.Form") { - baseType = returnType; - break; - } - } - Assert.IsNotNull(baseType); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs deleted file mode 100644 index cf8a819f22..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadAcceptButtonFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = self._button1\r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void FormHasAcceptButton() - { - Assert.IsNotNull(Form.AcceptButton); - } - - [Test] - public void AcceptButtonPropertyDescriptorObjectMatchesButton() - { - Button button = Form.Controls[0] as Button; - PropertyDescriptor p = TypeDescriptor.GetProperties(Form).Find("AcceptButton", true); - Assert.AreEqual(button, p.GetValue(Form)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs deleted file mode 100644 index 66e0f4a8eb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the Form's AccessibleRole property can be loaded into the designer. - /// - [TestFixture] - public class LoadAccessibleRoleTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AccessibleRole = System.Windows.Forms.AccessibleRole.None\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void AccessibleRoleIsNone() - { - Assert.AreEqual(AccessibleRole.None, Form.AccessibleRole); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAnchorStylesFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAnchorStylesFormTestFixture.cs deleted file mode 100644 index 91df8a554f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadAnchorStylesFormTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadAnchorStylesTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Name = \"textBoxName\"\r\n" + - " self._textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Controls.Add(self._textBox1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [TestFixtureSetUp] - public new void SetUpFixture() - { - base.SetUpFixture(); - } - - [Test] - public void TextBoxAnchorStyle() - { - AnchorStyles style = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; - TextBox textBox = Form.Controls[0] as TextBox; - Assert.AreEqual(style, textBox.Anchor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs deleted file mode 100644 index 79d35fe208..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the designer load handles the Binding Navigator having separator toolstrips with the same Name - /// property text "bindingNavigatorSeparator" - /// - [TestFixture] - public class LoadBindingNavigatorTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return - "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._components = System.ComponentModel.Container()\r\n" + - " resources = System.Resources.ResourceManager(\"PyWin.TestForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self._bindingNavigator1 = System.Windows.Forms.BindingNavigator(self._components)\r\n" + - " self._bindingNavigatorMoveFirstItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigatorMovePreviousItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigatorSeparator = System.Windows.Forms.ToolStripSeparator()\r\n" + - " self._bindingNavigatorPositionItem = System.Windows.Forms.ToolStripTextBox()\r\n" + - " self._bindingNavigatorCountItem = System.Windows.Forms.ToolStripLabel()\r\n" + - " self._bindingNavigatorSeparator1 = System.Windows.Forms.ToolStripSeparator()\r\n" + - " self._bindingNavigatorMoveNextItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigatorMoveLastItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigatorSeparator2 = System.Windows.Forms.ToolStripSeparator()\r\n" + - " self._bindingNavigatorAddNewItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigatorDeleteItem = System.Windows.Forms.ToolStripButton()\r\n" + - " self._bindingNavigator1.BeginInit()\r\n" + - " self._bindingNavigator1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # bindingNavigator1\r\n" + - " # \r\n" + - " self._bindingNavigator1.AddNewItem = self._bindingNavigatorAddNewItem\r\n" + - " self._bindingNavigator1.CountItem = self._bindingNavigatorCountItem\r\n" + - " self._bindingNavigator1.DeleteItem = self._bindingNavigatorDeleteItem\r\n" + - " self._bindingNavigator1.Items.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._bindingNavigatorMoveFirstItem,\r\n" + - " self._bindingNavigatorMovePreviousItem,\r\n" + - " self._bindingNavigatorSeparator,\r\n" + - " self._bindingNavigatorPositionItem,\r\n" + - " self._bindingNavigatorCountItem,\r\n" + - " self._bindingNavigatorSeparator1,\r\n" + - " self._bindingNavigatorMoveNextItem,\r\n" + - " self._bindingNavigatorMoveLastItem,\r\n" + - " self._bindingNavigatorSeparator2,\r\n" + - " self._bindingNavigatorAddNewItem,\r\n" + - " self._bindingNavigatorDeleteItem]))\r\n" + - " self._bindingNavigator1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._bindingNavigator1.MoveFirstItem = self._bindingNavigatorMoveFirstItem\r\n" + - " self._bindingNavigator1.MoveLastItem = self._bindingNavigatorMoveLastItem\r\n" + - " self._bindingNavigator1.MoveNextItem = self._bindingNavigatorMoveNextItem\r\n" + - " self._bindingNavigator1.MovePreviousItem = self._bindingNavigatorMovePreviousItem\r\n" + - " self._bindingNavigator1.Name = \"bindingNavigator1\"\r\n" + - " self._bindingNavigator1.PositionItem = self._bindingNavigatorPositionItem\r\n" + - " self._bindingNavigator1.Size = System.Drawing.Size(284, 25)\r\n" + - " self._bindingNavigator1.TabIndex = 0\r\n" + - " self._bindingNavigator1.Text = \"bindingNavigator1\"\r\n" + - " # \r\n" + - " # bindingNavigatorMoveFirstItem\r\n" + - " # \r\n" + - " self._bindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorMoveFirstItem.Image = resources.GetObject(\"bindingNavigatorMoveFirstItem.Image\")\r\n" + - " self._bindingNavigatorMoveFirstItem.Name = \"bindingNavigatorMoveFirstItem\"\r\n" + - " self._bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorMoveFirstItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorMoveFirstItem.Text = \"Move first\"\r\n" + - " # \r\n" + - " # bindingNavigatorMovePreviousItem\r\n" + - " # \r\n" + - " self._bindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorMovePreviousItem.Image = resources.GetObject(\"bindingNavigatorMovePreviousItem.Image\")\r\n" + - " self._bindingNavigatorMovePreviousItem.Name = \"bindingNavigatorMovePreviousItem\"\r\n" + - " self._bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorMovePreviousItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorMovePreviousItem.Text = \"Move previous\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator\r\n" + - " # \r\n" + - " self._bindingNavigatorSeparator.Name = \"bindingNavigatorSeparator\"\r\n" + - " self._bindingNavigatorSeparator.Size = System.Drawing.Size(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorPositionItem\r\n" + - " # \r\n" + - " self._bindingNavigatorPositionItem.AccessibleName = \"Position\"\r\n" + - " self._bindingNavigatorPositionItem.AutoSize = False\r\n" + - " self._bindingNavigatorPositionItem.Name = \"bindingNavigatorPositionItem\"\r\n" + - " self._bindingNavigatorPositionItem.Size = System.Drawing.Size(50, 23)\r\n" + - " self._bindingNavigatorPositionItem.Text = \"0\"\r\n" + - " self._bindingNavigatorPositionItem.ToolTipText = \"Current position\"\r\n" + - " # \r\n" + - " # bindingNavigatorCountItem\r\n" + - " # \r\n" + - " self._bindingNavigatorCountItem.Name = \"bindingNavigatorCountItem\"\r\n" + - " self._bindingNavigatorCountItem.Size = System.Drawing.Size(35, 22)\r\n" + - " self._bindingNavigatorCountItem.Text = \"of {0}\"\r\n" + - " self._bindingNavigatorCountItem.ToolTipText = \"Total number of items\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator1\r\n" + - " # \r\n" + - " self._bindingNavigatorSeparator1.Name = \"bindingNavigatorSeparator\"\r\n" + - " self._bindingNavigatorSeparator1.Size = System.Drawing.Size(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorMoveNextItem\r\n" + - " # \r\n" + - " self._bindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorMoveNextItem.Image = resources.GetObject(\"bindingNavigatorMoveNextItem.Image\")\r\n" + - " self._bindingNavigatorMoveNextItem.Name = \"bindingNavigatorMoveNextItem\"\r\n" + - " self._bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorMoveNextItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorMoveNextItem.Text = \"Move next\"\r\n" + - " # \r\n" + - " # bindingNavigatorMoveLastItem\r\n" + - " # \r\n" + - " self._bindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorMoveLastItem.Image = resources.GetObject(\"bindingNavigatorMoveLastItem.Image\")\r\n" + - " self._bindingNavigatorMoveLastItem.Name = \"bindingNavigatorMoveLastItem\"\r\n" + - " self._bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorMoveLastItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorMoveLastItem.Text = \"Move last\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator2\r\n" + - " # \r\n" + - " self._bindingNavigatorSeparator2.Name = \"bindingNavigatorSeparator\"\r\n" + - " self._bindingNavigatorSeparator2.Size = System.Drawing.Size(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorAddNewItem\r\n" + - " # \r\n" + - " self._bindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorAddNewItem.Image = resources.GetObject(\"bindingNavigatorAddNewItem.Image\")\r\n" + - " self._bindingNavigatorAddNewItem.Name = \"bindingNavigatorAddNewItem\"\r\n" + - " self._bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorAddNewItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorAddNewItem.Text = \"Add new\"\r\n" + - " # \r\n" + - " # bindingNavigatorDeleteItem\r\n" + - " # \r\n" + - " self._bindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image\r\n" + - " self._bindingNavigatorDeleteItem.Image = resources.GetObject(\"bindingNavigatorDeleteItem.Image\")\r\n" + - " self._bindingNavigatorDeleteItem.Name = \"bindingNavigatorDeleteItem\"\r\n" + - " self._bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = True\r\n" + - " self._bindingNavigatorDeleteItem.Size = System.Drawing.Size(23, 22)\r\n" + - " self._bindingNavigatorDeleteItem.Text = \"Delete\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._bindingNavigator1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Text = \"PyWin\"\r\n" + - " self._bindingNavigator1.EndInit()\r\n" + - " self._bindingNavigator1.ResumeLayout(False)\r\n" + - " self._bindingNavigator1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()"; - } - } - - public CreatedInstance BindingNavigatorSeparator1Instance { - get { return ComponentCreator.CreatedInstances[8]; } - } - - [Test] - public void BindingNavigatorSeparator1ComponentNameIsBindingNavigatorSeparator1() - { - Assert.AreEqual("bindingNavigatorSeparator1", BindingNavigatorSeparator1Instance.Name); - } - - [Test] - public void BindingNavigatorSeparator1ComponentTypeIsToolStripSeparator() - { - Assert.AreEqual("System.Windows.Forms.ToolStripSeparator", BindingNavigatorSeparator1Instance.InstanceType.FullName); - } - - [Test] - public void BindingNavigatorSeparator1SiteNameNameIsBindingNavigatorSeparator1() - { - ToolStripSeparator separator = BindingNavigatorSeparator1Instance.Object as ToolStripSeparator; - Assert.AreEqual("bindingNavigatorSeparator1", separator.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs deleted file mode 100644 index 9534823366..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadButtonFlatAppearanceTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.FlatAppearance.BorderColor = System.Drawing.Color.Red\r\n" + - " self._button1.FlatAppearance.BorderSize = 2\r\n" + - " self._button1.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Blue\r\n" + - " self._button1.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Yellow\r\n" + - " self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = self._button1\r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public Button Button - { - get { return Form.Controls[0] as Button; } - } - - [Test] - public void ButtonFlatAppearanceBorderSize() - { - Assert.AreEqual(2, Button.FlatAppearance.BorderSize); - } - - [Test] - public void ButtonFlatAppearanceBorderColor() - { - Assert.AreEqual(Color.Red, Button.FlatAppearance.BorderColor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadColorFromArgbTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadColorFromArgbTestFixture.cs deleted file mode 100644 index cb01443c76..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadColorFromArgbTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadColorFromArgbTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.BackColor = System.Drawing.Color.FromArgb(10, 190, 0)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void FormBackColor() - { - Assert.AreEqual(Color.FromArgb(10, 190, 0), Form.BackColor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs deleted file mode 100644 index fad750d2b2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadControlEventHandlerTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._button2 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button2\r\n" + - " # \r\n" + - " self._button2.Location = System.Drawing.Point(75, 39)\r\n" + - " self._button2.Name = \"button2\"\r\n" + - " self._button2.Size = System.Drawing.Size(75, 23)\r\n" + - " self._button2.TabIndex = 1\r\n" + - " self._button2.Text = \"button2\"\r\n" + - " self._button2.KeyDown += self.Button2KeyDown\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Controls.Add(self._button2)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public override void BeforeSetUpFixture() - { - base.ComponentCreator.SetEventPropertyDescriptor(new MockPropertyDescriptor("abc", "Button2KeyDown", true)); - } - - public Button GetButton() - { - return Form.Controls[0] as Button; - } - - public EventDescriptor GetButtonKeyDownEventDescriptor() - { - Button button = GetButton(); - return TypeDescriptor.GetEvents(button).Find("KeyDown", true); - } - - public MockPropertyDescriptor GetButtonKeyDownEventPropertyDescriptor() - { - EventDescriptor eventDescriptor = GetButtonKeyDownEventDescriptor(); - return base.ComponentCreator.GetEventProperty(eventDescriptor) as MockPropertyDescriptor; - } - - [Test] - public void PropertyDescriptorSetValueComponentIsForm() - { - Assert.AreEqual(GetButton(), GetButtonKeyDownEventPropertyDescriptor().GetSetValueComponent()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadCursorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadCursorTestFixture.cs deleted file mode 100644 index d15ce74ac8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadCursorTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadCursorTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Cursor = System.Windows.Forms.Cursors.Hand\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void FormCursorIsHand() - { - Assert.AreEqual(Cursors.Hand, Form.Cursor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadEventHandlerTestFixture.cs deleted file mode 100644 index fb34bf02f4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadEventHandlerTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadEventHandlerTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Load += self.TestFormLoad\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public override void BeforeSetUpFixture() - { - base.ComponentCreator.SetEventPropertyDescriptor(new MockPropertyDescriptor("abc", "TestFormLoad", true)); - } - - public EventDescriptor GetLoadEventDescriptor() - { - return TypeDescriptor.GetEvents(Form).Find("Load", true); - } - - public MockPropertyDescriptor GetLoadEventPropertyDescriptor() - { - EventDescriptor loadEventDescriptor = GetLoadEventDescriptor(); - return base.ComponentCreator.GetEventProperty(loadEventDescriptor) as MockPropertyDescriptor; - } - - [Test] - public void EventPropertyDescriptorValueSetToEventHandlerMethodName() - { - Assert.AreEqual("TestFormLoad", GetLoadEventPropertyDescriptor().GetValue(Form) as String); - } - - [Test] - public void PropertyDescriptorSetValueComponentIsForm() - { - Assert.AreEqual(Form, GetLoadEventPropertyDescriptor().GetSetValueComponent()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFileSystemWatcherTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFileSystemWatcherTestFixture.cs deleted file mode 100644 index 035f0ea2b1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFileSystemWatcherTestFixture.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadFileSystemWatcherTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._fileSystemWatcher1 = System.IO.FileSystemWatcher()\r\n" + - " self._fileSystemWatcher1.BeginInit()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # fileSystemWatcher1\r\n" + - " # \r\n" + - " self._fileSystemWatcher1.EnableRaisingEvents = True\r\n" + - " self._fileSystemWatcher1.SynchronizingObject = self\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._fileSystemWatcher1.EndInit()\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public CreatedInstance FileSystemWatcherInstance { - get { return ComponentCreator.CreatedInstances[0]; } - } - - public FileSystemWatcher FileSystemWatcher { - get { return FileSystemWatcherInstance.Object as FileSystemWatcher; } - } - - [Test] - public void ComponentName() - { - Assert.AreEqual("fileSystemWatcher1", FileSystemWatcherInstance.Name); - } - - [Test] - public void ComponentType() - { - Assert.AreEqual("System.IO.FileSystemWatcher", FileSystemWatcherInstance.InstanceType.FullName); - } - - [Test] - public void FileSystemWatcherEnableRaisingEventsIsTrue() - { - Assert.IsTrue(FileSystemWatcher.EnableRaisingEvents); - } - - [Test] - public void FileSystemWatcherSynchronisingObjectIsForm() - { - Assert.AreSame(Form, FileSystemWatcher.SynchronizingObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFontTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFontTestFixture.cs deleted file mode 100644 index 27962f21cf..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFontTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadFontTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Font = System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 1)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void FormBackColor() - { - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 1); - Assert.AreEqual(font, Form.Font); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormTestFixtureBase.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormTestFixtureBase.cs deleted file mode 100644 index b9d8dd6c41..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormTestFixtureBase.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Reflection; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Base class for all LoadFormTestFixture classes. - /// - public class LoadFormTestFixtureBase : LoadFormTestsBase - { - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return PythonComponentWalkerHelper.CreateComponentWalker(componentCreator); - } - - public virtual string PythonCode { - get { return String.Empty; } - } - - public override string Code { - get { return PythonCode; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs deleted file mode 100644 index dd951cd78d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadFormWithBooleanPropertiesSetTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AllowDrop = False\r\n" + - " self.Enabled = False\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void FormEnabledIsFalse() - { - Assert.IsFalse(Form.Enabled); - } - - [Test] - public void FormAllowDropIsFalse() - { - Assert.IsFalse(Form.AllowDrop); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithButtonFollowedByTimerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithButtonFollowedByTimerTestFixture.cs deleted file mode 100644 index a5cde063a8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithButtonFollowedByTimerTestFixture.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Fix ArgumentNullException when form has a button followed by a timer and the - /// first timer statement is the setting of the event handler. - /// - [TestFixture] - public class LoadFormWithButtonFollowedByTimerTestFixture : LoadFormTestFixtureBase - { - MockPropertyDescriptor mockTickPropertyDescriptor; - - public override string PythonCode { - get { - return - "import System.Drawing\r\n" + - "import System.Windows.Forms\r\n" + - "\r\n" + - "from System.Drawing import *\r\n" + - "from System.Windows.Forms import *\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - "\r\n" + - " def InitializeComponent(self):\r\n" + - " self._components = System.ComponentModel.Container()\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self._timer1 = System.Windows.Forms.Timer(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.Location = System.Drawing.Point(37, 29)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(75, 23)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " self._button1.UseVisualStyleBackColor = True\r\n" + - " # \r\n" + - " # timer1\r\n" + - " # \r\n" + - " self._timer1.Tick += self.Timer1Tick\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Text = \"PyWinTest\"\r\n" + - " self.ResumeLayout(False)\r\n" + - "\r\n" + - "\r\n" + - " def Timer1Tick(self, sender, e):\r\n" + - " pass"; - } - } - - public override void BeforeSetUpFixture() - { - mockTickPropertyDescriptor = new MockPropertyDescriptor("Tick", null, false); - ComponentCreator.SetEventPropertyDescriptor(mockTickPropertyDescriptor); - } - - [Test] - public void EventDescriptorUsedToGetEventProperty() - { - Assert.IsNotNull(ComponentCreator.EventDescriptorPassedToGetEventProperty); - } - - [Test] - public void EventDescriptorNameUsedToGetEventPropertyIsTick() - { - Assert.AreEqual("Tick", ComponentCreator.EventDescriptorPassedToGetEventProperty.Name); - } - - [Test] - public void GetPropertyValueSetForTimer() - { - string value = mockTickPropertyDescriptor.GetValue(null) as String; - Assert.AreEqual("Timer1Tick", value); - } - - [Test] - public void GetComponentUsedWhenSettingTickHandler() - { - IComponent expectedComponent = ComponentCreator.GetComponent("timer1"); - - object component = mockTickPropertyDescriptor.GetSetValueComponent(); - - Assert.AreEqual(expectedComponent, component); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithSysPathAppendStatementTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithSysPathAppendStatementTestFixture.cs deleted file mode 100644 index 483b2832d9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadFormWithSysPathAppendStatementTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Statements before the main form class are parsed by the PythonComponentWalker when - /// they should be ignored. This test fixture checks that only when the InitializeComponent method - /// is found the statements are parsed. - /// - [TestFixture] - public class LoadFormWithSysPathAppendStatementTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "import sys\r\n" + - "sys.path.append(r'c:\\python\\lib')\r\n" + // Calls Walk(CallExpression) - "a = System.Windows.Forms.TextBox()\r\n" + // Calls Walk(AssignmentStatement) - "a.Load += Load\r\n" + // Calls Walk(AugmentedAssignStatement) - "b\r\n" + // Calls Walk(NameExpression) - "10\r\n" + // Calls Walk(ConstantExpression) - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public CreatedComponent FormComponent { - get { return ComponentCreator.CreatedComponents[0]; } - } - - [Test] - public void MainFormCreated() - { - Assert.IsNotNull(Form); - } - - [Test] - public void NoInstancesCreated() - { - Assert.AreEqual(0, ComponentCreator.CreatedInstances.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs deleted file mode 100644 index bf8706ec36..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadInheritedProtectedPanelFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - base.ComponentCreator.AddType("PythonBinding.Tests.Designer.ProtectedPanelDerivedForm", typeof(ProtectedPanelDerivedForm)); - - return "class MainForm(PythonBinding.Tests.Designer.ProtectedPanelDerivedForm):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System.Drawing.Point(10, 15)\r\n" + - " self.panel1.Size = System.Drawing.Size(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System.Drawing.Point(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(self._textBox1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - ProtectedPanelDerivedForm DerivedForm { - get { return Form as ProtectedPanelDerivedForm; } - } - - [Test] - public void PanelLocation() - { - Assert.AreEqual(new Point(10, 15), DerivedForm.PanelLocation); - } - - [Test] - public void PanelSize() - { - Assert.AreEqual(new Size(108, 120), DerivedForm.PanelSize); - } - - [Test] - public void GetProtectedPanelObject() - { - Assert.AreEqual(DerivedForm.GetPanel(), PythonControlFieldExpression.GetInheritedObject("panel1", DerivedForm)); - } - - [Test] - public void GetProtectedPanelObjectIncorrectCase() - { - Assert.AreEqual(DerivedForm.GetPanel(), PythonControlFieldExpression.GetInheritedObject("PANEL1", DerivedForm)); - } - - [Test] - public void GetInheritedObjectPassedNull() - { - Assert.IsNull(PythonControlFieldExpression.GetInheritedObject("panel1", null)); - } - - [Test] - public void GetInheritedPanelObjectFromFieldExpression() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self.panel1.Name = \"abc\""); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(DerivedForm.GetPanel(), field.GetObject(ComponentCreator)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs deleted file mode 100644 index c284271588..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - class PublicPanelBaseForm : Form - { - public Panel panel1 = new Panel(); - Button button1 = new Button(); - - public PublicPanelBaseForm() - { - button1.Name = "button1"; - - panel1.Name = "panel1"; - panel1.Location = new Point(5, 10); - panel1.Size = new Size(200, 100); - panel1.Controls.Add(button1); - - Controls.Add(panel1); - } - } - - class PublicPanelDerivedForm : PublicPanelBaseForm - { - } - - [TestFixture] - public class LoadInheritedPublicPanelFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - base.ComponentCreator.AddType("PythonBinding.Tests.Designer.PublicPanelDerivedForm", typeof(PublicPanelDerivedForm)); - - return "class MainForm(PythonBinding.Tests.Designer.PublicPanelDerivedForm):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System.Drawing.Point(10, 15)\r\n" + - " self.panel1.Size = System.Drawing.Size(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System.Drawing.Point(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(self._textBox1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - PublicPanelDerivedForm DerivedForm { - get { return Form as PublicPanelDerivedForm; } - } - - [Test] - public void PanelLocation() - { - Assert.AreEqual(new Point(10, 15), DerivedForm.panel1.Location); - } - - [Test] - public void PanelSize() - { - Assert.AreEqual(new Size(108, 120), DerivedForm.panel1.Size); - } - - [Test] - public void GetPublicPanelObject() - { - Assert.AreEqual(DerivedForm.panel1, PythonControlFieldExpression.GetInheritedObject("panel1", DerivedForm)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs deleted file mode 100644 index e4cb3b6a2f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadInheritedToolTipTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - ComponentCreator.AddType("PythonBinding.Tests.Designer.PublicToolTipDerivedForm", typeof(PythonBinding.Tests.Designer.PublicToolTipDerivedForm)); - - return "class TestForm(PythonBinding.Tests.Designer.PublicToolTipDerivedForm):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " self.toolTip.SetToolTip(self._button1, \"buttonTest\")\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._button1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.toolTip.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - [Test] - public void FormHasToolTip() - { - PublicToolTipDerivedForm form = Form as PublicToolTipDerivedForm; - Assert.AreEqual("test", form.toolTip.GetToolTip(form)); - } - - [Test] - public void ButtonHasToolTip() - { - PublicToolTipDerivedForm form = Form as PublicToolTipDerivedForm; - Assert.AreEqual("buttonTest", form.toolTip.GetToolTip(form.Controls[0])); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadListViewFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadListViewFormTestFixture.cs deleted file mode 100644 index 68c16c7cd5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadListViewFormTestFixture.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadListViewFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._listView1 = System.Windows.Forms.ListView()\r\n" + - " listViewItem1 = System.Windows.Forms.ListViewItem()\r\n" + - " listViewItem2 = System.Windows.Forms.ListViewItem()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " self._listView1.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem](\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2]))\r\n" + - " self._listView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._listView1.Name = \"listView1\"\r\n" + - " self._listView1.Size = System.Drawing.Size(204, 104)\r\n" + - " self._listView1.TabIndex = 0\r\n" + - " listViewItem1.ToolTipText = \"tooltip1\"\r\n" + - " listViewItem2.ToolTipText = \"tooltip2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - public ListView ListView { - get { return Form.Controls[0] as ListView; } - } - - public ListViewItem ListViewItem1 { - get { return ListView.Items[0]; } - } - - public ListViewItem ListViewItem2 { - get { return ListView.Items[1]; } - } - - [Test] - public void ListViewAddedToForm() - { - Assert.IsNotNull(ListView); - } - - [Test] - public void ListViewHasTwoItems() - { - Assert.AreEqual(2, ListView.Items.Count); - } - - [Test] - public void ListViewItem1TooltipText() - { - Assert.AreEqual("tooltip1", ListViewItem1.ToolTipText); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs deleted file mode 100644 index 531e0e775d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadLocalImageResourceTestFixture : LoadFormTestFixtureBase - { - MockResourceReader reader; - Bitmap bitmap; - - public override string PythonCode { - get { - bitmap = new Bitmap(10, 20); - reader = new MockResourceReader(); - reader.AddResource("pictureBox1.Image", bitmap); - ComponentCreator.SetResourceReader(reader); - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " resources = System.Resources.ResourceManager(\"RootNamespace.MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self._pictureBox1 = System.Windows.Forms.PictureBox()\r\n" + - " self._pictureBox1.BeginInit()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " self._pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " self._pictureBox1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._pictureBox1.Name = \"button1\"\r\n" + - " self._pictureBox1.Size = System.Drawing.Size(10, 10)\r\n" + - " self._pictureBox1.TabIndex = 0\r\n" + - " self._pictureBox1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(self._pictureBox1)\r\n" + - " self._pictureBox1.EndInit()\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public PictureBox PictureBox1 { - get { return base.Form.Controls[0] as PictureBox; } - } - - [Test] - public void ResourceReaderRetrievedFromComponentCreator() - { - Assert.IsTrue(ComponentCreator.GetResourceReaderCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceReader() - { - Assert.AreEqual(CultureInfo.InvariantCulture, ComponentCreator.CultureInfoPassedToGetResourceReader); - } - - [Test] - public void ResourceReaderIsDisposed() - { - Assert.IsTrue(reader.IsDisposed); - } - - [Test] - public void ComponentResourceManagerCreated() - { - CreatedInstance expectedInstance = new CreatedInstance(typeof(ResourceManager), new object[0], "resources", false); - CreatedInstance instance = base.ComponentCreator.CreatedInstances[0]; - Assert.AreEqual(expectedInstance, instance); - } - - [Test] - public void BitmapAssignedToPictureBoxRetrievedFromResourceReader() - { - Assert.IsTrue(Object.Equals(bitmap, PictureBox1.Image)); - } - - [Test] - public void PictureBoxImageIsNotNull() - { - Assert.IsNotNull(PictureBox1.Image); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs deleted file mode 100644 index 4a5d3d99ed..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadLocalVariablePropertyAssignmentTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " button1 = System.Windows.Forms.Button()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = button1\r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void OneComponentCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedComponents.Count); - } - - [Test] - public void TwoObjectsCreated() - { - Assert.AreEqual(2, ComponentCreator.CreatedInstances.Count); - } - - [Test] - public void ButtonInstance() - { - CreatedInstance expectedInstance = new CreatedInstance(typeof(Button), new object[0], "button1", false); - Assert.AreEqual(expectedInstance, ComponentCreator.CreatedInstances[0]); - } - - [Test] - public void AcceptButtonPropertyIsNotNull() - { - Assert.IsNotNull(Form.AcceptButton); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMenuStripFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMenuStripFormTestFixture.cs deleted file mode 100644 index 02509747c8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMenuStripFormTestFixture.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadMenuStripFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._menuStrip1 = System.Windows.Forms.MenuStrip()\r\n" + - " self._fileToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._openToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._exitToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._editToolStripMenuItem = System.Windows.Forms.ToolStripMenuItem()\r\n" + - " self._menuStrip1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " self._menuStrip1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._menuStrip1.Name = \"menuStrip1\"\r\n" + - " self._menuStrip1.Size = System.Drawing.Size(200, 24)\r\n" + - " self._menuStrip1.TabIndex = 0\r\n" + - " self._menuStrip1.Text = \"menuStrip1\"\r\n" + - " self._menuStrip1.Items.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._fileToolStripMenuItem,\r\n" + - " self._editToolStripMenuItem]))\r\n" + - " # \r\n" + - " # fileToolStripMenuItem\r\n" + - " # \r\n" + - " self._fileToolStripMenuItem.Name = \"fileToolStripMenuItem\"\r\n" + - " self._fileToolStripMenuItem.Size = System.Drawing.Size(37, 20)\r\n" + - " self._fileToolStripMenuItem.Text = \"&File\"\r\n" + - " self._fileToolStripMenuItem.DropDownItems.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._openToolStripMenuItem,\r\n" + - " self._exitToolStripMenuItem]))\r\n" + - " # \r\n" + - " # openToolStripMenuItem\r\n" + - " # \r\n" + - " self._openToolStripMenuItem.Name = \"openToolStripMenuItem\"\r\n" + - " self._openToolStripMenuItem.Size = System.Drawing.Size(37, 20)\r\n" + - " self._openToolStripMenuItem.Text = \"&Open\"\r\n" + - " # \r\n" + - " # exitToolStripMenuItem\r\n" + - " # \r\n" + - " self._exitToolStripMenuItem.Name = \"exitToolStripMenuItem\"\r\n" + - " self._exitToolStripMenuItem.Size = System.Drawing.Size(37, 20)\r\n" + - " self._exitToolStripMenuItem.Text = \"E&xit\"\r\n" + - " # \r\n" + - " # editToolStripMenuItem\r\n" + - " # \r\n" + - " self._editToolStripMenuItem.Name = \"editToolStripMenuItem\"\r\n" + - " self._editToolStripMenuItem.Size = System.Drawing.Size(39, 20)\r\n" + - " self._editToolStripMenuItem.Text = \"&Edit\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(self._menuStrip1)\r\n" + - " self._menuStrip1.ResumeLayout(False)\r\n" + - " self._menuStrip1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - public MenuStrip MenuStrip { - get { return Form.Controls[0] as MenuStrip; } - } - - public ToolStripMenuItem FileMenuItem { - get { return MenuStrip.Items[0] as ToolStripMenuItem; } - } - - [Test] - public void MenuStripAddedToForm() - { - Assert.IsNotNull(MenuStrip); - } - - [Test] - public void MenuStripHasTwoItems() - { - Assert.AreEqual(2, MenuStrip.Items.Count); - } - - [Test] - public void MenuStripFirstItemIsFileMenuItem() - { - Assert.AreEqual("fileToolStripMenuItem", FileMenuItem.Name); - } - - [Test] - public void FileMenuItemText() - { - Assert.AreEqual("&File", FileMenuItem.Text); - } - - [Test] - public void MenuStripSecondItemIsEditMenuItem() - { - Assert.AreEqual("editToolStripMenuItem", MenuStrip.Items[1].Name); - } - - [Test] - public void FileMenuItemHasDropDownItems() - { - Assert.AreEqual(2, FileMenuItem.DropDownItems.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMonthCalendarTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMonthCalendarTestFixture.cs deleted file mode 100644 index 6bd9955e7e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadMonthCalendarTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadMonthCalendarTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._monthCalendar1 = System.Windows.Forms.MonthCalendar()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # monthCalendar1\r\n" + - " # \r\n" + - " self._monthCalendar1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._monthCalendar1.MonthlyBoldedDates = System.Array[System.DateTime](\r\n" + - " [System.DateTime(2009, 1, 2, 0, 0, 0, 0),\r\n" + - " System.DateTime(0)])\r\n" + - " self._monthCalendar1.Name = \"monthCalendar1\"\r\n" + - " self._monthCalendar1.SelectionRange = System.Windows.Forms.SelectionRange(System.DateTime(2009, 8, 4, 0, 0, 0, 0), System.DateTime(2009, 8, 5, 0, 0, 0, 0))\r\n" + - " self._monthCalendar1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._monthCalendar1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - public MonthCalendar Calendar { - get { return Form.Controls[0] as MonthCalendar; } - } - - [Test] - public void MonthlyBoldedDates() - { - DateTime[] expectedDates = new DateTime[] { new DateTime(2009, 1, 2), new DateTime(0) }; - Assert.AreEqual(expectedDates, Calendar.MonthlyBoldedDates); - } - - [Test] - public void SelectionRange() - { - SelectionRange expectedRange = new SelectionRange(new DateTime(2009, 8, 4, 0, 0, 0, 0), new DateTime(2009, 8, 5, 0, 0, 0, 0)); - Assert.AreEqual(expectedRange.ToString(), Calendar.SelectionRange.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleFormTestFixture.cs deleted file mode 100644 index 7a1fd33281..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleFormTestFixture.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadSimpleFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public CreatedComponent FormComponent { - get { return ComponentCreator.CreatedComponents[0]; } - } - - [Test] - public void MainFormCreated() - { - Assert.IsNotNull(Form); - } - - [Test] - public void MainFormName() - { - Assert.AreEqual("MainForm", Form.Name); - } - - [Test] - public void OneComponentCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedComponents.Count); - } - - [Test] - public void ComponentName() - { - Assert.AreEqual("MainForm", FormComponent.Name); - } - - [Test] - public void ComponentType() - { - Assert.AreEqual("System.Windows.Forms.Form", FormComponent.TypeName); - } - - [Test] - public void FormClientSize() - { - Size size = new Size(300, 400); - Assert.AreEqual(size, Form.ClientSize); - } - - [Test] - public void BaseClassTypeNameLookedUp() - { - Assert.AreEqual("System.Windows.Forms.Form", ComponentCreator.TypeNames[0]); - } - - /// - /// The System.Drawing.Size type name should have been looked up by the PythonFormWalker when - /// parsing the InitializeComponent method. Note that this is the second type that is looked up. - /// The first lookup is the base class type. - /// - [Test] - public void TypeNameLookedUp() - { - Assert.AreEqual("System.Drawing.Size", ComponentCreator.TypeNames[1]); - } - - [Test] - public void OneObjectCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedInstances.Count); - } - - [Test] - public void InstanceType() - { - List args = new List(); - int width = 300; - int height = 400; - args.Add(width); - args.Add(height); - - CreatedInstance expectedInstance = new CreatedInstance(typeof(Size), args, null, false); - Assert.AreEqual(expectedInstance, ComponentCreator.CreatedInstances[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs deleted file mode 100644 index e8ce031876..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadSimpleUserControlTestFixture - { - MockComponentCreator componentCreator = new MockComponentCreator(); - UserControl userControl; - - public string PythonCode { - get { - return "class MainForm(System.Windows.Forms.UserControl):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"userControl1\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonComponentWalker walker = new PythonComponentWalker(componentCreator); - userControl = walker.CreateComponent(PythonCode) as UserControl; - } - - [TestFixtureTearDown] - public void TearDownFixture() - { - userControl.Dispose(); - } - - [Test] - public void UserControlCreated() - { - Assert.IsNotNull(userControl); - } - - [Test] - public void UserControlName() - { - Assert.AreEqual("userControl1", userControl.Name); - } - - [Test] - public void UserControlClientSize() - { - Size size = new Size(300, 400); - Assert.AreEqual(size, userControl.ClientSize); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs deleted file mode 100644 index c3a499684d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadSplitContainerTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadSplitContainerTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._splitContainer1 = System.Windows.Forms.SplitContainer()\r\n" + - " self._treeView1 = System.Windows.Forms.TreeView()\r\n" + - " self._propertyGrid1 = System.Windows.Forms.PropertyGrid()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # splitContainer1\r\n" + - " # \r\n" + - " self._splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" + - " self._splitContainer1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._splitContainer1.Name = \"splitContainer1\"\r\n" + - " self._splitContainer1.Panel1.Controls.Add(self._treeView1)\r\n" + - " self._splitContainer1.Panel2.Controls.Add(self._propertyGrid1)\r\n" + - " self._splitContainer1.Size = System.Drawing.Size(284, 264)\r\n" + - " self._splitContainer1.SplitterDistance = 94\r\n" + - " self._splitContainer1.TabIndex = 0\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " self._treeView1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" + - " self._treeView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._treeView1.Name = \"treeView1\"\r\n" + - " self._treeView1.Size = System.Drawing.Size(94, 264)\r\n" + - " self._treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # propertyGrid1\r\n" + - " # \r\n" + - " self._propertyGrid1.Dock = System.Windows.Forms.DockStyle.Fill\r\n" + - " self._propertyGrid1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._propertyGrid1.Name = \"propertyGrid1\"\r\n" + - " self._propertyGrid1.Size = System.Drawing.Size(186, 264)\r\n" + - " self._propertyGrid1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._splitContainer1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - SplitContainer SplitContainer { - get { return Form.Controls[0] as SplitContainer; } - } - - [Test] - public void TreeViewAddedToSplitContainer() - { - Assert.IsInstanceOf(typeof(TreeView), SplitContainer.Panel1.Controls[0]); - } - - [Test] - public void PropertyGridAddedToSplitContainer() - { - Assert.IsInstanceOf(typeof(PropertyGrid), SplitContainer.Panel2.Controls[0]); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs deleted file mode 100644 index 6b893f094d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadTableLayoutPanelTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._button1 = System.Windows.Forms.Button()\r\n" + - " self._checkBox1 = System.Windows.Forms.CheckBox()\r\n" + - " self._tableLayoutPanel1 = System.Windows.Forms.TableLayoutPanel()\r\n" + - " self._tableLayoutPanel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " self._button1.Location = System.Drawing.Point(3, 3)\r\n" + - " self._button1.Name = \"button1\"\r\n" + - " self._button1.Size = System.Drawing.Size(75, 23)\r\n" + - " self._button1.TabIndex = 0\r\n" + - " self._button1.Text = \"button1\"\r\n" + - " self._button1.UseVisualStyleBackColor = True\r\n" + - " # \r\n" + - " # checkBox1\r\n" + - " # \r\n" + - " self._checkBox1.Location = System.Drawing.Point(103, 3)\r\n" + - " self._checkBox1.Name = \"checkBox1\"\r\n" + - " self._checkBox1.Size = System.Drawing.Size(94, 24)\r\n" + - " self._checkBox1.TabIndex = 1\r\n" + - " self._checkBox1.Text = \"checkBox1\"\r\n" + - " self._checkBox1.UseVisualStyleBackColor = True\r\n" + - " # \r\n" + - " # tableLayoutPanel1\r\n" + - " # \r\n" + - " self._tableLayoutPanel1.ColumnCount = 2\r\n" + - " self._tableLayoutPanel1.Controls.Add(self._button1)\r\n" + - " self._tableLayoutPanel1.Controls.Add(self._checkBox1)\r\n" + - " self._tableLayoutPanel1.Location = System.Drawing.Point(89, 36)\r\n" + - " self._tableLayoutPanel1.Name = \"tableLayoutPanel1\"\r\n" + - " self._tableLayoutPanel1.RowCount = 2\r\n" + - " self._tableLayoutPanel1.Size = System.Drawing.Size(200, 100)\r\n" + - " self._tableLayoutPanel1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Controls.Add(self._tableLayoutPanel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - TableLayoutPanel TableLayoutPanel { - get { return Form.Controls[0] as TableLayoutPanel; } - } - - [Test] - public void ButtonAddedToTableLayout() - { - Assert.IsInstanceOf(typeof(Button), TableLayoutPanel.Controls[0]); - } - - [Test] - public void CheckBoxAddedToTableLayout() - { - Assert.IsInstanceOf(typeof(CheckBox), TableLayoutPanel.Controls[1]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs deleted file mode 100644 index c481c96b2c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadTextBoxOnPanelTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._panel1 = System.Windows.Forms.Panel()\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self._panel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self._panel1.Location = System.Drawing.Point(10, 15)\r\n" + - " self._panel1.Name = \"panel1\"\r\n" + - " self._panel1.Size = System.Drawing.Size(100, 120)\r\n" + - " self._panel1.TabIndex = 0\r\n" + - " self._panel1.Controls.Add(self._textBox1)\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Location = System.Drawing.Point(5, 5)\r\n" + - " self._textBox1.Name = \"textBox1\"\r\n" + - " self._textBox1.Size = System.Drawing.Size(110, 20)\r\n" + - " self._textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(self._panel1)\r\n" + - " self._panel1.ResumeLayout(false)\r\n" + - " self._panel1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - public Panel Panel { - get { return Form.Controls[0] as Panel; } - } - - public TextBox TextBox { - get { return Panel.Controls[0] as TextBox; } - } - - [Test] - public void TextBoxAddedToPanel() - { - Assert.IsNotNull(TextBox); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxTestFixture.cs deleted file mode 100644 index 92838427ff..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTextBoxTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadTextBoxTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Name = \"textBoxName\"\r\n" + - " self._textBox1.Location = System.Drawing.Point(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System.Drawing.Point(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(self._textBox1)\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public TextBox TextBox { - get { return Form.Controls[0] as TextBox; } - } - - [Test] - public void AddedComponentsContainsTextBox() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - - AddedComponent component = new AddedComponent(instance.Object as IComponent, "textBox1"); - Assert.Contains(component, ComponentCreator.AddedComponents); - } - - [Test] - public void TextBoxInstanceCreated() - { - CreatedInstance instance = new CreatedInstance(typeof(TextBox), new List(), "textBox1", false); - Assert.Contains(instance, ComponentCreator.CreatedInstances); - } - - [Test] - public void TextBoxAddedToForm() - { - Assert.IsNotNull(TextBox); - } - - [Test] - public void TextBoxObjectMatchesObjectAddedToComponentCreator() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - Assert.AreSame(TextBox, instance.Object as TextBox); - } - - [Test] - public void TextBoxName() - { - Assert.AreEqual("textBoxName", TextBox.Name); - } - - [Test] - public void TextBoxLocation() - { - Assert.AreEqual(new Point(108, 120), TextBox.Location); - } - - [Test] - public void CreatedInstancesDoesNotIncludeLocation() - { - Assert.IsNull(ComponentCreator.GetCreatedInstance("Location")); - } - - [Test] - public void FormLocation() - { - Assert.AreEqual(new Point(10, 20), Form.Location); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTimerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTimerTestFixture.cs deleted file mode 100644 index 6a23bf9e1c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTimerTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadTimerTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._components = System.ComponentModel.Container()\r\n" + - " self._timer1 = System.Windows.Forms.Timer(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # timer1\r\n" + - " # \r\n" + - " self._timer1.Interval = 1000\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - public CreatedInstance TimerInstance { - get { return ComponentCreator.CreatedInstances[1]; } - } - - [Test] - public void ThreeInstancesCreated() - { - Assert.AreEqual(3, ComponentCreator.CreatedInstances.Count); - } - - - [Test] - public void ComponentName() - { - Assert.AreEqual("timer1", TimerInstance.Name); - } - - [Test] - public void ComponentType() - { - Assert.AreEqual("System.Windows.Forms.Timer", TimerInstance.InstanceType.FullName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadToolTipTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadToolTipTestFixture.cs deleted file mode 100644 index 5c9cad85cf..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadToolTipTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadToolTipTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class TestForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._components = System.ComponentModel.Container()\r\n" + - " self._toolTip1 = System.Windows.Forms.ToolTip(self._components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self._toolTip1.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - [Test] - public void FormHasToolTip() - { - ToolTip toolTip = (ToolTip)base.ComponentCreator.GetComponent("toolTip1"); - Assert.AreEqual("test",toolTip.GetToolTip(Form)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs deleted file mode 100644 index 6bf721634d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadTreeViewTestFixture.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadTreeViewTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " treeNode1 = System.Windows.Forms.TreeNode()\r\n" + - " treeNode2 = System.Windows.Forms.TreeNode()\r\n" + - " treeNode3 = System.Windows.Forms.TreeNode()\r\n" + - " self._treeView1 = System.Windows.Forms.TreeView()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " treeNode1.BackColor = System.Drawing.Color.Yellow\r\n" + - " treeNode1.Checked = True\r\n" + - " treeNode1.ForeColor = System.Drawing.Color.FromArgb(0, 64, 64)\r\n" + - " treeNode1.Name = \"RootNode0\"\r\n" + - " treeNode1.NodeFont = System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 1)\r\n" + - " treeNode1.Text = \"RootNode0.Text\"\r\n" + - " treeNode1.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode2]))\r\n" + - " treeNode2.Name = \"ChildNode0\"\r\n" + - " treeNode2.Text = \"ChildNode0.Text\"\r\n" + - " treeNode2.NodeFont = System.Drawing.Font(\"Garamond\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)\r\n" + - " treeNode2.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode3]))\r\n" + - " treeNode3.Name = \"ChildNode1\"\r\n" + - " treeNode3.Text = \"ChildNode1.Text\"\r\n" + - " self._treeView1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._treeView1.Name = \"treeView1\"\r\n" + - " self._treeView1.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode1]))\r\n" + - " self._treeView1.Size = System.Drawing.Size(100, 100)\r\n" + - " self._treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._treeView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n"; - } - } - - public TreeView TreeView { - get { return Form.Controls[0] as TreeView; } - } - - public TreeNode RootTreeNode { - get { return TreeView.Nodes[0]; } - } - - public TreeNode FirstChildTreeNode { - get { return RootTreeNode.Nodes[0]; } - } - - [Test] - public void OneRootNode() - { - Assert.AreEqual(1, TreeView.Nodes.Count); - } - - [Test] - public void RootNodeHasOneChildNode() - { - Assert.AreEqual(1, RootTreeNode.Nodes.Count); - } - - [Test] - public void ChildNodeHasOneChildNode() - { - Assert.AreEqual(1, RootTreeNode.Nodes[0].Nodes.Count); - } - - [Test] - public void RootTreeNodeBackColor() - { - Assert.AreEqual(Color.Yellow, RootTreeNode.BackColor); - } - - [Test] - public void RootTreeNodeForeColor() - { - Assert.AreEqual(Color.FromArgb(0, 64, 64), RootTreeNode.ForeColor); - } - - [Test] - public void RootTreeNodeFontProperty() - { - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 1); - Assert.AreEqual(font, RootTreeNode.NodeFont); - } - - [Test] - public void RootTreeNodeCheckedProperty() - { - Assert.IsTrue(RootTreeNode.Checked); - } - - [Test] - public void ChildTreeNodeFontProperty() - { - Font font = new Font("Garamond", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0); - Assert.AreEqual(font, FirstChildTreeNode.NodeFont); - } - - /// - /// Ensures that we are not creating an instance with a name of NodeFont. - /// - [Test] - public void InstancesCreated() - { - foreach (CreatedInstance instance in ComponentCreator.CreatedInstances) { - if (instance.InstanceType == typeof(Font)) { - Assert.IsNull(instance.Name); - } - } - Assert.IsTrue(ComponentCreator.CreatedInstances.Count > 0); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs deleted file mode 100644 index 5819e000d5..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class LoadUserControlWithDoublePropertyTestFixture - { - MockComponentCreator componentCreator = new MockComponentCreator(); - DoublePropertyUserControl userControl; - Form form; - - public string PythonCode { - get { - Type type = typeof(DoublePropertyUserControl); - componentCreator.AddType(type.FullName, type); - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._userControl = ICSharpCode.Scripting.Tests.Utils.DoublePropertyUserControl()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " self._userControl.DoubleValue = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Controls.Add(self._userControl)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonComponentWalker walker = new PythonComponentWalker(componentCreator); - form = walker.CreateComponent(PythonCode) as Form; - userControl = form.Controls[0] as DoublePropertyUserControl; - } - - [TestFixtureTearDown] - public void TearDownFixture() - { - form.Dispose(); - } - - [Test] - public void UserControlDoubleProperty() - { - Assert.AreEqual(0, userControl.DoubleValue); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MergeFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MergeFormTestFixture.cs deleted file mode 100644 index 9bf545da78..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MergeFormTestFixture.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the GeneratedInitializeComponentMethod class - /// can merge the changes into the text editor. - /// - [TestFixture] - public class MergeFormTestFixture - { - TextDocument document; - MockResourceService resourceService; - MockResourceWriter resourceWriter; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - resourceService = new MockResourceService(); - resourceService.SetResourceWriter(resourceWriter); - - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - PythonParser parser = new PythonParser(); - ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(499, 309); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null); - MockTextEditorOptions options = new MockTextEditorOptions(); - PythonDesignerGenerator generator = new PythonDesignerGenerator(options); - generator.Merge(host, adapter, compilationUnit, serializationManager); - } - } - } - - [Test] - public void MergedDocumentText() - { - string expectedText = GetTextEditorCode().Replace(GetTextEditorInitializeComponentMethod(), GetGeneratedInitializeComponentMethod()); - Assert.AreEqual(expectedText, document.Text); - } - - string GetGeneratedCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\t\r\n" + - GetGeneratedInitializeComponentMethod(); - } - - string GetGeneratedInitializeComponentMethod() - { - return "\tdef InitializeComponent(self):\r\n" + - "\t\tself.SuspendLayout()\r\n" + - "\t\t# \r\n" + - "\t\t# MainForm\r\n" + - "\t\t# \r\n" + - "\t\tself.ClientSize = System.Drawing.Size(499, 309)\r\n" + - "\t\tself.Name = \"MainForm\"\r\n" + - "\t\tself.ResumeLayout(False)\r\n"; - } - - string GetTextEditorCode() - { - return "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\t\r\n" + - GetTextEditorInitializeComponentMethod(); - } - - string GetTextEditorInitializeComponentMethod() - { - return "\tdef InitializeComponent(self):\r\n" + - "\t\tpass\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs deleted file mode 100644 index 70a71b5c9c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; -using IronPython.Compiler.Ast; -using Microsoft.Scripting; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the PythonFormVisitor throws an exception if no InitializeComponent or - /// InitializeComponent method can be found. - /// - [TestFixture] - public class MissingInitializeComponentMethodTestFixture : IComponentCreator - { - string pythonCode = "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def __init__(self):\r\n" + - " self.MissingMethod()\r\n" + - "\r\n" + - " def MissingMethod(self):\r\n" + - " pass\r\n"; - [Test] - [ExpectedException(typeof(PythonComponentWalkerException))] - public void PythonFormWalkerExceptionThrown() - { - PythonComponentWalker walker = new PythonComponentWalker(this); - walker.CreateComponent(pythonCode); - Assert.Fail("Exception should have been thrown before this."); - } - - /// - /// Check that the PythonComponentWalker does not try to walk the class body if it is null. - /// IronPython 2.6.1 now throws an ArgumentNullException if null is passed for the - /// class body. - /// - [Test] - public void ClassWithNoBodyCannotBeCreated() - { - ArgumentNullException ex = - Assert.Throws(delegate { CreateClassWithNullBody(); }); - - Assert.AreEqual("body", ex.ParamName); - } - - void CreateClassWithNullBody() - { - ClassDefinition classDef = new ClassDefinition("classWithNoBody", null, null); - } - - /// - /// Make sure we do not get an ArgumentOutOfRangeException when walking the - /// AssignmentStatement. - /// - [Test] - public void NoLeftHandSideExpressionsInAssignment() - { - List lhs = new List(); - AssignmentStatement assign = new AssignmentStatement(lhs.ToArray(), null); - PythonComponentWalker walker = new PythonComponentWalker(this); - walker.Walk(assign); - } - - public IComponent CreateComponent(Type componentClass, string name) - { - throw new NotImplementedException(); - } - - public void Add(IComponent component, string name) - { - throw new NotImplementedException(); - } - - public IComponent GetComponent(string name) - { - return null; - } - - public IComponent RootComponent { - get { return null; } - } - - public object CreateInstance(Type type, ICollection arguments, string name, bool addToContainer) - { - throw new NotImplementedException(); - } - - public Type GetType(string typeName) - { - throw new NotImplementedException(); - } - - public PropertyDescriptor GetEventProperty(EventDescriptor e) - { - return null; - } - - public object GetInstance(string name) - { - return null; - } - - public IResourceReader GetResourceReader(CultureInfo info) - { - return null; - } - - public IResourceWriter GetResourceWriter(CultureInfo info) - { - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/NoNewLineAfterInitializeComponentTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/NoNewLineAfterInitializeComponentTestFixture.cs deleted file mode 100644 index 2bb7f16ad9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/NoNewLineAfterInitializeComponentTestFixture.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the code can be generated if there is no new line after the InitializeComponent method. - /// - [TestFixture] - public class NoNewLineAfterInitializeComponentMethodTestFixture - { - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - PythonParser parser = new PythonParser(); - ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - UserControl userControl = (UserControl)host.RootComponent; - userControl.ClientSize = new Size(489, 389); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(userControl); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(userControl, "userControl1"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null); - MockTextEditorOptions options = new MockTextEditorOptions(); - PythonDesignerGenerator generator = new PythonDesignerGenerator(options); - generator.Merge(host, adapter, compilationUnit, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "from System.Windows.Forms import UserControl\r\n" + - "\r\n" + - "class MyUserControl(UserControl):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\t\r\n" + - "\tdef InitializeComponent(self):\r\n" + - "\t\tself.SuspendLayout()\r\n" + - "\t\t# \r\n" + - "\t\t# userControl1\r\n" + - "\t\t# \r\n" + - "\t\tself.Name = \"userControl1\"\r\n" + - "\t\tself.Size = System.Drawing.Size(489, 389)\r\n" + - "\t\tself.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, document.Text); - } - - /// - /// No new line after the pass statement for InitializeComponent method. - /// - string GetTextEditorCode() - { - return "from System.Windows.Forms import UserControl\r\n" + - "\r\n" + - "class MyUserControl(UserControl):\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\t\r\n" + - "\tdef InitializeComponent(self):\r\n" + - "\t\tpass"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs deleted file mode 100644 index 4d7f9f9228..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the the project's root namespace is passed to the PythonDesigner - /// - [TestFixture] - public class ProjectRootNamespacePassedToMergeTestFixture - { - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - PythonParser parser = new PythonParser(); - MockProjectContent projectContent = new MockProjectContent(); - MockProject project = new MockProject(); - project.RootNamespace = "RootNamespace"; - projectContent.Project = project; - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"test.py", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add picture box - PictureBox pictureBox = (PictureBox)host.CreateComponent(typeof(PictureBox), "pictureBox1"); - pictureBox.Location = new Point(0, 0); - pictureBox.Image = new Bitmap(10, 10); - pictureBox.Size = new Size(100, 120); - pictureBox.TabIndex = 0; - form.Controls.Add(pictureBox); - - MockTextEditorOptions options = new MockTextEditorOptions(); - options.ConvertTabsToSpaces = true; - options.IndentationSize = 4; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - AvalonEditDocumentAdapter adapter = new AvalonEditDocumentAdapter(document, null); - PythonDesignerGenerator generator = new PythonDesignerGenerator(options); - generator.Merge(host, adapter, compilationUnit, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - " \r\n" + - " def InitializeComponent(self):\r\n" + - " resources = System.Resources.ResourceManager(\"RootNamespace.MainForm\", System.Reflection.Assembly.GetEntryAssembly())\r\n" + - " self._pictureBox1 = System.Windows.Forms.PictureBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " self._pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " self._pictureBox1.Location = System.Drawing.Point(0, 0)\r\n" + - " self._pictureBox1.Name = \"pictureBox1\"\r\n" + - " self._pictureBox1.Size = System.Drawing.Size(100, 120)\r\n" + - " self._pictureBox1.TabIndex = 0\r\n" + - " self._pictureBox1.TabStop = False\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Controls.Add(self._pictureBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, document.Text, document.Text); - } - - string GetTextEditorCode() - { - return - "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - " \r\n" + - " def InitializeComponent(self):\r\n" + - " pass\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonBaseClassTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonBaseClassTests.cs deleted file mode 100644 index 10a4baf8f1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonBaseClassTests.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using System; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class PythonBaseClassTests - { - [Test] - public void FormBaseClass() - { - string code = "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual("System.Windows.Forms.Form", PythonComponentWalker.GetBaseClassName(classDef)); - } - - [Test] - public void NoBaseClass() - { - string code = "class MainForm:\r\n" + - " def InitializeComponent(self):\r\n" + - " pass\r\n"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual(String.Empty, PythonComponentWalker.GetBaseClassName(classDef)); - } - - [Test] - public void UnqualifiedBaseClass() - { - string code = "class MainForm(Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual("Form", PythonComponentWalker.GetBaseClassName(classDef)); - } - - ClassDefinition GetClassDefinition(string code) - { - PythonParser parser = new PythonParser(); - PythonAst ast = parser.CreateAst(@"test.py", new StringTextBuffer(code)); - SuiteStatement suite = ast.Body as SuiteStatement; - return suite.Statements[0] as ClassDefinition; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeBuilderTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeBuilderTests.cs deleted file mode 100644 index bec3c493db..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeBuilderTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class PythonCodeBuilderTests - { - PythonCodeBuilder codeBuilder; - - [SetUp] - public void Init() - { - codeBuilder = new PythonCodeBuilder(); - codeBuilder.IndentString = "\t"; - } - - /// - /// Check that the "self._components = System.ComponentModel.Container()" line is generated - /// the once and before any other lines of code. - /// - [Test] - public void AppendCreateComponentsContainerTwice() - { - codeBuilder.IndentString = " "; - codeBuilder.IncreaseIndent(); - codeBuilder.AppendIndentedLine("self._listView = System.Windows.Forms.ListView()"); - codeBuilder.InsertCreateComponentsContainer(); - codeBuilder.InsertCreateComponentsContainer(); - - string expectedCode = - " self._components = System.ComponentModel.Container()\r\n" + - " self._listView = System.Windows.Forms.ListView()\r\n"; - - Assert.AreEqual(expectedCode, codeBuilder.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeDeserializerTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeDeserializerTests.cs deleted file mode 100644 index f9b5517712..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonCodeDeserializerTests.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class PythonCodeDeserializerTests - { - PythonCodeDeserializer deserializer; - MockComponentCreator componentCreator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - deserializer = new PythonCodeDeserializer(componentCreator); - } - - [Test] - [ExpectedException(typeof(ArgumentNullException))] - public void NullIronPythonAstNode() - { - Node node = null; - deserializer.Deserialize(node); - } - - [Test] - public void UnknownTypeName() - { - string pythonCode = "self.Cursors = System.Windows.Forms.UnknownType.AppStarting"; - Assert.IsNull(DeserializeRhsAssignment(pythonCode)); - } - - [Test] - public void UnknownPropertyName() - { - string pythonCode = "self.Cursors = System.Windows.Forms.Cursors.UnknownCursorsProperty"; - Assert.IsNull(DeserializeRhsAssignment(pythonCode)); - } - - [Test] - public void UnknownTypeNameInCallExpression() - { - string pythonCode = "self.Cursors = System.Windows.Forms.UnknownType.CreateDefaultCursor()"; - Assert.IsNull(DeserializeRhsAssignment(pythonCode)); - } - - [Test] - public void EnumReturnedInArgumentsPassedToConstructor() - { - string pythonCode = "self.Font = System.Drawing.Font(\"Times New Roman\", System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point)"; - AssignmentStatement assignment = PythonParserHelper.GetAssignmentStatement(pythonCode); - - List expectedArgs = new List(); - expectedArgs.Add("Times New Roman"); - expectedArgs.Add(FontStyle.Regular); - expectedArgs.Add(GraphicsUnit.Point); - - List args = deserializer.GetArguments(assignment.Right as CallExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void EnumBitwiseOr() - { - string pythonCode = "self.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom"; - - AnchorStyles expectedStyles = AnchorStyles.Top | AnchorStyles.Bottom; - Assert.AreEqual(expectedStyles, DeserializeRhsAssignment(pythonCode)); - } - - [Test] - public void MultipleEnumBitwiseOr() - { - string pythonCode = "self.textBox1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left"; - - AnchorStyles expectedStyles = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; - Assert.AreEqual(expectedStyles, DeserializeRhsAssignment(pythonCode)); - } - - [Test] - public void DeserializeNameExpression() - { - string pythonCode = "self.Items = self"; - Assert.IsNull(DeserializeRhsAssignment(pythonCode)); - } - - /// - /// Deserializes the right hand side of the assignment. - /// - object DeserializeRhsAssignment(string pythonCode) - { - return deserializer.Deserialize(PythonParserHelper.GetAssignmentStatement(pythonCode).Right); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonControlFieldExpressionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonControlFieldExpressionTests.cs deleted file mode 100644 index 3b82acf1ee..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonControlFieldExpressionTests.cs +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class PythonControlFieldExpressionTests - { - [Test] - public void HasPrefixTest() - { - Assert.AreEqual("a", PythonControlFieldExpression.GetPrefix("a.b")); - } - - [Test] - public void NoDotHasPrefixTest() - { - Assert.AreEqual("a", PythonControlFieldExpression.GetPrefix("a")); - } - - [Test] - public void GetVariableName() - { - Assert.AreEqual("abc", PythonControlFieldExpression.GetVariableName("_abc")); - } - - [Test] - public void VariableNameHasOnlyUnderscore() - { - Assert.AreEqual(String.Empty, PythonControlFieldExpression.GetVariableName("_")); - } - - [Test] - public void VariableNameIsEmpty() - { - Assert.AreEqual(String.Empty, PythonControlFieldExpression.GetVariableName(String.Empty)); - } - - [Test] - public void FullMemberExpression() - { - CallExpression call = PythonParserHelper.GetCallExpression("self._a.b.Add()"); - Assert.AreEqual("self._a.b.Add", PythonControlFieldExpression.GetMemberName(call.Target as MemberExpression)); - } - - [Test] - public void NullMemberExpression() - { - Assert.AreEqual(String.Empty, PythonControlFieldExpression.GetMemberName(null)); - } - - [Test] - public void PythonControlFieldExpressionEquals() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self._textBox1.Name = \"abc\""); - PythonControlFieldExpression field1 = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - statement = PythonParserHelper.GetAssignmentStatement("self._textBox1.Name = \"def\""); - PythonControlFieldExpression field2 = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(field1, field2); - } - - [Test] - public void NullPassedToPythonControlFieldExpressionEquals() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self._textBox1.Name = \"abc\""); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - Assert.IsFalse(field.Equals(null)); - } - - [Test] - public void MethodName() - { - string code = "self.menuItem.Items.Add(self._fileMenuItem)"; - CallExpression expression = PythonParserHelper.GetCallExpression(code); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(expression); - AssertAreEqual(field, "menuItem", "Items", "Add", "self.menuItem.Items"); - } - - [Test] - public void MethodNameWithNoVariableName() - { - string code = "self.Items.Add(self._fileMenuItem)"; - CallExpression expression = PythonParserHelper.GetCallExpression(code); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(expression); - AssertAreEqual(field, String.Empty, "Items", "Add", "self.Items"); - } - - [Test] - public void SetToolTipMethodCall() - { - string code = "self._toolTip1.SetToolTip(self, \"Test\")"; - CallExpression expression = PythonParserHelper.GetCallExpression(code); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(expression); - AssertAreEqual(field, "toolTip1", "_toolTip1", "SetToolTip", "self._toolTip1"); - } - - [Test] - public void GetMemberNames() - { - string[] expected = new string[] { "a", "b" }; - string code = "a.b = 0"; - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement(code); - Assert.AreEqual(expected, PythonControlFieldExpression.GetMemberNames(statement.Left[0] as MemberExpression)); - } - - [Test] - public void GetObjectInMethodCall() - { - string pythonCode = "self._menuStrip1.Items.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._fileToolStripMenuItem,\r\n" + - " self._editToolStripMenuItem]))"; - - CallExpression callExpression = PythonParserHelper.GetCallExpression(pythonCode); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(callExpression); - - using (MenuStrip menuStrip = new MenuStrip()) { - MockComponentCreator creator = new MockComponentCreator(); - creator.Add(menuStrip, "menuStrip1"); - Assert.AreSame(menuStrip.Items, field.GetMember(creator)); - } - } - - [Test] - public void GetObjectForUnknownComponent() - { - string pythonCode = "self._menuStrip1.SuspendLayout()"; - - CallExpression callExpression = PythonParserHelper.GetCallExpression(pythonCode); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(callExpression); - - using (MenuStrip menuStrip = new MenuStrip()) { - MockComponentCreator creator = new MockComponentCreator(); - creator.Add(menuStrip, "unknown"); - Assert.IsNull(field.GetMember(creator)); - } - } - - [Test] - public void GetInstanceObjectInMethodCall() - { - string pythonCode = "treeNode1.Nodes.AddRange(System.Array[System.Windows.Forms.TreeNode](\r\n" + - " [treeNode2]))"; - - CallExpression callExpression = PythonParserHelper.GetCallExpression(pythonCode); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(callExpression); - - TreeNode treeNode1 = new TreeNode(); - TreeNode treeNode2 = new TreeNode(); - MockComponentCreator creator = new MockComponentCreator(); - creator.AddInstance(treeNode1, "treeNode1"); - creator.AddInstance(treeNode2, "treeNode2"); - object member = field.GetMember(creator); - Assert.AreSame(treeNode1.Nodes, member); - } - - [Test] - public void GetObjectInMethodCallFromSpecifiedObject() - { - string pythonCode = "self.Controls.AddRange(System.Array[System.Windows.Forms.ToolStripItem](\r\n" + - " [self._fileToolStripMenuItem,\r\n" + - " self._editToolStripMenuItem]))"; - - CallExpression callExpression = PythonParserHelper.GetCallExpression(pythonCode); - - using (Form form = new Form()) { - Assert.AreSame(form.Controls, PythonControlFieldExpression.GetMember(form, callExpression)); - } - } - - [Test] - public void LocalVariable() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("listViewItem1.TooltipText = \"abc\""); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - PythonControlFieldExpression expectedField = new PythonControlFieldExpression("TooltipText", "listViewItem1", String.Empty, "listViewItem1.TooltipText"); - Assert.AreEqual(expectedField, field); - } - - [Test] - public void LocalVariableIsNotSelfReference() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("listViewItem1.TooltipText = \"abc\""); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - Assert.IsFalse(field.IsSelfReference); - } - - [Test] - public void FieldIsNotSelfReference() - { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self.listView1.TooltipText = \"abc\""); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - Assert.IsTrue(field.IsSelfReference); - } - - [Test] - public void GetButtonObjectForSelfReference() - { - using (Button button = new Button()) { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self._button1.Size = System.Drawing.Size(10, 10)"); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(button, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonObject() - { - using (Button button = new Button()) { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("_button1.Size = System.Drawing.Size(10, 10)"); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(button, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonFlatAppearanceObjectForSelfReference() - { - using (Button button = new Button()) { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self._button1.FlatAppearance.BorderSize = 3"); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(button.FlatAppearance, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonFlatAppearanceObject() - { - using (Button button = new Button()) { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("_button1.FlatAppearance.BorderSize = 3"); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.AreEqual(button.FlatAppearance, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetInvalidTwoLevelDeepButtonPropertyDescriptorForSelfReference() - { - using (Button button = new Button()) { - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement("self._button1.InvalidProperty.BorderSize = 3"); - PythonControlFieldExpression field = PythonControlFieldExpression.Create(statement.Left[0] as MemberExpression); - - Assert.IsNull(field.GetObjectForMemberName(button)); - } - } - - [Test] - public void NullPropertyValueConversion() - { - using (Form form = new Form()) { - PropertyDescriptor descriptor = TypeDescriptor.GetProperties(form).Find("Text", true); - Assert.IsNull(PythonControlFieldExpression.ConvertPropertyValue(descriptor, null)); - } - } - - void AssertAreEqual(PythonControlFieldExpression field, string variableName, string memberName, string methodName, string fullMemberName) - { - string expected = "Variable: " + variableName + " Member: " + memberName + " Method: " + methodName + " FullMemberName: " + fullMemberName; - string actual = "Variable: " + field.VariableName + " Member: " + field.MemberName + " Method: " + field.MethodName + " FullMemberName: " + field.FullMemberName; - Assert.AreEqual(expected, actual, actual); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderProviderTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderProviderTestFixture.cs deleted file mode 100644 index 8dfc6e133e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonDesignerLoaderProviderTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel.Design.Serialization; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonDesignerLoaderProvider class. - /// - [TestFixture] - public class PythonDesignerLoaderProviderTestFixture - { - PythonDesignerLoaderProvider provider; - PythonDesignerGenerator generator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - provider = new PythonDesignerLoaderProvider(); - generator = new PythonDesignerGenerator(null); - } - - [Test] - public void PythonDesignerLoaderCreated() - { - DesignerLoader loader = provider.CreateLoader(generator); - using (IDisposable disposable = loader as IDisposable) { - Assert.IsInstanceOf(typeof(PythonDesignerLoader), loader); - } - } - - [Test] - public void CodeDomProviderIsNull() - { - Assert.IsNull(generator.CodeDomProvider); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs deleted file mode 100644 index a93846287c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonGeneratorTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.IO; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - [TestFixture] - public class PythonGeneratorTestFixture - { - PythonDesignerGenerator generator; - - [SetUp] - public void Init() - { - MockTextEditorOptions options = new MockTextEditorOptions(); - generator = new PythonDesignerGenerator(options); - } - - [Test] - public void GetMethodReplaceRegion() - { - MockMethod method = new MockMethod(MockClass.CreateMockClassWithoutAnyAttributes()); - DomRegion bodyRegion = new DomRegion(0, 4, 1, 4); - method.BodyRegion = bodyRegion; - DomRegion expectedRegion = new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine + 1, 1); - DomRegion region = generator.GetBodyRegionInDocument(method); - - Assert.AreEqual(expectedRegion, region); - } - - [Test] - public void GenerateEventHandlerWithEmptyMethodBody() - { - string eventHandler = generator.CreateEventHandler("button1_click", String.Empty, "\t"); - string expectedEventHandler = - "\tdef button1_click(self, sender, e):\r\n" + - "\t\tpass"; - Assert.AreEqual(expectedEventHandler, eventHandler); - } - - [Test] - public void GenerateEventHandlerWithNullMethodBody() - { - string eventHandler = generator.CreateEventHandler("button2_click", null, String.Empty); - string expectedEventHandler = - "def button2_click(self, sender, e):\r\n" + - "\tpass"; - Assert.AreEqual(expectedEventHandler, eventHandler); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs deleted file mode 100644 index 6eda15a51f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/PythonPropertyAssignmentToStringTests.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Globalization; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests the PythonPropertyValueAssignment class which generates the Python code for - /// the rhs of a property value assignment. - /// - [TestFixture] - public class PythonPropertyAssignmentToStringTests - { - [Test] - public void ConvertCustomColorToString() - { - Color customColor = Color.FromArgb(0, 192, 10); - Assert.AreEqual("System.Drawing.Color.FromArgb(0, 192, 10)", PythonPropertyValueAssignment.ToString(customColor)); - } - - [Test] - public void FontToString() - { - CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; - try { - System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE"); - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); - Assert.AreEqual("System.Drawing.Font(\"Times New Roman\", 8.25, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0)", - PythonPropertyValueAssignment.ToString(font)); - } finally { - System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; - } - } - - [Test] - public void SizeFToString() - { - SizeF sizeF = new SizeF(4, 10); - Assert.AreEqual("System.Drawing.SizeF(4, 10)", PythonPropertyValueAssignment.ToString(sizeF)); - } - - [Test] - public void AnchorStyleToString() - { - AnchorStyles anchorStyle = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - string expectedText = "System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right"; - Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(anchorStyle)); - } - - [Test] - public void AnchorStyleNoneToString() - { - AnchorStyles anchorStyle = AnchorStyles.None; - string expectedText = "System.Windows.Forms.AnchorStyles.None"; - Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(anchorStyle)); - } - - /// - /// Nested type will have a full name including a "+", for example, SpecialFolder type has a full name of: - /// - /// System.Environment+SpecialFolder - /// - /// So the PythonPropertyValueAssignment needs to replace the "+" with a ".". - /// - [Test] - public void SystemEnvironmentSpecialFolderNestedTypeToString() - { - Environment.SpecialFolder folder = Environment.SpecialFolder.ProgramFiles; - string expectedText = "System.Environment.SpecialFolder.ProgramFiles"; - Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(folder)); - } - - /// - /// Ensures that when the user types in "\t" the code for a string property in the forms designer - /// the actual string is generated is "\\t". - /// - [Test] - public void BackslashCharactersEncodedInStrings() - { - string text = @"c:\temp"; - string expectedText = "\"c:\\\\temp\""; - Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(text)); - } - - [Test] - public void DoubleQuoteCharactersEncodedInStrings() - { - string text = "c:\\te\"mp"; - string expectedText = "\"c:\\\\te\\\"mp\""; - Assert.AreEqual(expectedText, PythonPropertyValueAssignment.ToString(text)); - } - - [Test] - public void DefaultCursorToString() - { - Assert.AreEqual("System.Windows.Forms.Cursors.Default", PythonPropertyValueAssignment.ToString(Cursors.Default)); - } - - [Test] - public void NullConversion() - { - Assert.AreEqual("None", PythonPropertyValueAssignment.ToString(null)); - } - - [Test] - public void CharConversion() - { - Assert.AreEqual("\"*\"", PythonPropertyValueAssignment.ToString('*')); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs deleted file mode 100644 index acab4a4d35..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// When a MenuStrip is added to a form and then removed the python designer generates code - /// for the form's MainMenuStrip property even though the MenuStrip has been removed. - /// - [TestFixture] - public class RemoveMainMenuStripFromFormTestFixture - { - string generatedPythonCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - form.Controls.Add(menuStrip); - - descriptor = descriptors.Find("MainMenuStrip", false); - descriptor.SetValue(form, menuStrip); - - form.Controls.Remove(menuStrip); - host.Container.Remove(menuStrip); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - PythonCodeDomSerializer serializer = new PythonCodeDomSerializer(" "); - generatedPythonCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System.Drawing.Size(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(False)\r\n"; - - Assert.AreEqual(expectedCode, generatedPythonCode, generatedPythonCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs deleted file mode 100644 index 00889ed648..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// When a text box is not added to the form's Control collection in InitializeComponent then: - /// - /// 1) Text box should not be added to the form's Control collection when the form is created. - /// 2) Text box should be registered with the designer via the IComponentCreator.Add method. - /// 3) Text box should be created via the IComponentCreator.CreateInstance method. - /// - [TestFixture] - public class TextBoxNotAddedToFormTestFixture : LoadFormTestFixtureBase - { - public override string PythonCode { - get { - return "class MainForm(System.Windows.Forms.Form):\r\n" + - " def InitializeComponent(self):\r\n" + - " self._textBox1 = System.Windows.Forms.TextBox()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " self._textBox1.Name = \"textBox1\"\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.ResumeLayout(False)\r\n"; - } - } - - [Test] - public void AddedComponentsContainsTextBox() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - - AddedComponent c = new AddedComponent(instance.Object as IComponent, "textBox1"); - Assert.Contains(c, ComponentCreator.AddedComponents); - } - - [Test] - public void TextBoxIsNotAddedToForm() - { - Assert.AreEqual(0, Form.Controls.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/UnknownTypeTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/UnknownTypeTestFixture.cs deleted file mode 100644 index 6deb0f183a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Designer/UnknownTypeTestFixture.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronPython.Compiler.Ast; -using Microsoft.Scripting; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Designer -{ - /// - /// Tests that the PythonFormWalker throws a PythonFormWalkerException if a unknown type is used in the - /// form. - /// - [TestFixture] - public class UnknownTypeTestFixture - { - [TestFixtureSetUp] - public void SetUpFixture() - { - ResourceManager rm = new ResourceManager("PythonBinding.Tests.Strings", GetType().Assembly); - ResourceService.RegisterNeutralStrings(rm); - } - - [Test] - public void SelfAssignmentWithUnknownTypeRhs() - { - string pythonCode = "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - "\r\n" + - " def InitializeComponent(self):\r\n" + - " self.ClientSize = Unknown.Type(10)\r\n"; - - try { - PythonComponentWalker walker = new PythonComponentWalker(new MockComponentCreator()); - walker.CreateComponent(pythonCode); - Assert.Fail("Exception should have been thrown before this."); - } catch (PythonComponentWalkerException ex) { - string expectedMessage = String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), "Unknown.Type"); - Assert.AreEqual(expectedMessage, ex.Message); - } - } - - [Test] - public void LocalVariableAssignmentWithUnknownTypeRhs() - { - string pythonCode = "from System.Windows.Forms import Form\r\n" + - "\r\n" + - "class MainForm(System.Windows.Forms.Form):\r\n" + - " def __init__(self):\r\n" + - " self.InitializeComponent()\r\n" + - "\r\n" + - " def InitializeComponent(self):\r\n" + - " abc = Unknown.Type(10)\r\n"; - - try { - PythonComponentWalker walker = new PythonComponentWalker(new MockComponentCreator()); - walker.CreateComponent(pythonCode); - Assert.Fail("Exception should have been thrown before this."); - } catch (PythonComponentWalkerException ex) { - string expectedMessage = String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), "Unknown.Type"); - Assert.AreEqual(expectedMessage, ex.Message); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionOnLineWithSingleSpaceTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionOnLineWithSingleSpaceTestFixture.cs deleted file mode 100644 index 5818081887..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionOnLineWithSingleSpaceTestFixture.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class FindExpressionOnLineWithSingleSpaceTestFixture - { - ExpressionResult result; - - [SetUp] - public void Init() - { - string text = " "; - PythonExpressionFinder expressionFinder = new PythonExpressionFinder(); - result = expressionFinder.FindExpression(text, 1); - } - - [Test] - public void ExpressionResultExpressionIsEmptyString() - { - Assert.AreEqual(String.Empty, result.Expression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionWithImportOnPreviousLineTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionWithImportOnPreviousLineTestFixture.cs deleted file mode 100644 index 6db9fc87da..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindExpressionWithImportOnPreviousLineTestFixture.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class FindExpressionWithImportOnPreviousLineTestFixture - { - ExpressionResult result; - - [SetUp] - public void Init() - { - string text = "import\r\n"; - PythonExpressionFinder expressionFinder = new PythonExpressionFinder(); - int offset = 8; // Cursor is just after \r\n on second line. - result = expressionFinder.FindExpression(text, offset); - } - - [Test] - public void ExpressionResultExpressionIsEmptyString() - { - Assert.AreEqual(String.Empty, result.Expression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindImportExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindImportExpressionTestFixture.cs deleted file mode 100644 index ded81ce0f9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindImportExpressionTestFixture.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - /// - /// Checks that an import statement is correctly identified. - /// - [TestFixture] - public class FindImportExpressionTestFixture - { - PythonExpressionFinder expressionFinder; - - [TestFixtureSetUp] - public void SetUpFixture() - { - expressionFinder = new PythonExpressionFinder(); - } - - [Test] - public void ImportOnly() - { - string text = "import"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual("import", result.Expression); - } - - [Test] - public void ExpressionContextIsNamespaceForImportExpression() - { - string text = "import"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - - /// - /// Currently the expression finder returns the full import expression. - /// It should probably just return the namespace. - /// - [Test] - public void ImportWithNamespace() - { - string text = "import System"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual("import System", result.Expression); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - - [Test] - public void MultipleLinesWithImportAndNamespace() - { - string text = - "# Line to ignore\r\n" + - "import System"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual("import System", result.Expression); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - - [Test] - public void ImportWithExtraWhitespaceBeforeNamespace() - { - string text = "import System"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual(text, result.Expression); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - - [Test] - public void FromStatementBeforeImport() - { - string text = "from System import Test"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual(text, result.Expression); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - - /// - /// Expressions are case sensitive in Python. - /// - [Test] - public void UppercaseImportWithNamespace() - { - string text = "IMPORT Test"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual("Test", result.Expression); - } - - [Test] - public void FromStatementWithoutAnyImportPart() - { - string text = "from System"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual(text, result.Expression); - Assert.IsNotNull(result.Context as PythonImportExpressionContext); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindSystemConsoleExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindSystemConsoleExpressionTestFixture.cs deleted file mode 100644 index 7649412291..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FindSystemConsoleExpressionTestFixture.cs +++ /dev/null @@ -1,142 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - /// - /// Tests the PythonExpressionFinder can find the System.Console - /// expression in various forms. - /// - [TestFixture] - public class FindSystemConsoleExpressionTestFixture - { - PythonExpressionFinder expressionFinder; - - [TestFixtureSetUp] - public void SetUpFixture() - { - expressionFinder = new PythonExpressionFinder(); - } - - [Test] - public void NullTextExpression() - { - ExpressionResult result = expressionFinder.FindExpression(null, 10); - Assert.IsNull(result.Expression); - } - - /// - /// The offset passed to the expression finder points to the - /// last character in the expression. In the string below this is the - /// 'e'. - /// - [Test] - public void SystemConsoleOnly() - { - string text = "System.Console"; - AssertSystemConsoleExpressionFound(text, text.Length); - } - - [Test] - public void MultipleLinesContainingCarriageReturnAndNewLine() - { - string text = "\r\nSystem.Console"; - AssertSystemConsoleExpressionFound(text, text.Length); - } - - [Test] - public void MultipleLinesContainingCarriageReturn() - { - string text = "\rSystem.Console"; - AssertSystemConsoleExpressionFound(text, text.Length); - } - - - /// - /// Should find an empty string since the offset is after the carriage return character. - /// - [Test] - public void CarriageReturnAfterLastCharacter() - { - string text = "System.Console\r"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length); - Assert.AreEqual(String.Empty, result.Expression); - } - - [Test] - public void SpaceBeforeSystemConsoleText() - { - string text = " System.Console"; - AssertSystemConsoleExpressionFound(text, text.Length); - } - - [Test] - public void TabBeforeSystemConsoleText() - { - string text = "\tSystem.Console"; - AssertSystemConsoleExpressionFound(text, text.Length); - } - - [Test] - public void EmptyString() - { - string text = String.Empty; - ExpressionResult result = expressionFinder.FindExpression(text, 0); - Assert.IsNull(result.Expression); - } - - [Test] - public void OffsetTooSmall() - { - string text = "a"; - ExpressionResult result = expressionFinder.FindExpression(text, 0); - Assert.IsNull(result.Expression); - } - - [Test] - public void OffsetTooLarge() - { - string text = "a"; - ExpressionResult result = expressionFinder.FindExpression(text, text.Length + 1); - Assert.IsNull(result.Expression); - } - - [Test] - public void NegativeOffset() - { - string text = "a"; - ExpressionResult result = expressionFinder.FindExpression(text, -1); - Assert.IsNull(result.Expression); - } - - /// - /// Checks that the System.Console expression is found in the - /// text before the specified offset. - /// - void AssertSystemConsoleExpressionFound(string text, int offset) - { - ExpressionResult result = expressionFinder.FindExpression(text, offset); - Assert.AreEqual("System.Console", result.Expression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromImportNamespaceExpressionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromImportNamespaceExpressionTests.cs deleted file mode 100644 index b7185fd3c2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromImportNamespaceExpressionTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class FromImportNamespaceExpressionTests - { - ScriptEngine engine; - - [SetUp] - public void Init() - { - engine = Python.CreateEngine(); - } - - [Test] - public void FromModuleNameIsSystemForFromSystemExpression() - { - PythonImportExpression expression = new PythonImportExpression(engine, "from System"); - Assert.AreEqual("System", expression.Module); - Assert.IsFalse(expression.HasFromAndImport); - } - - [Test] - public void FromModuleNameIsEmptyWhenOnlyFromIsInExpression() - { - PythonImportExpression expression = new PythonImportExpression(engine, "from"); - Assert.AreEqual(String.Empty, expression.Module); - Assert.IsFalse(expression.HasFromAndImport); - } - - [Test] - public void FromModuleNameIsSystemForFromSystemExpressionWithWhitespaceBetweenImportAndSystem() - { - PythonImportExpression expression = new PythonImportExpression(engine, "from \t System"); - Assert.AreEqual("System", expression.Module); - Assert.IsFalse(expression.HasFromAndImport); - } - - [Test] - public void HasIdentifierReturnsFalseForFromMathImportWithoutIdentfier() - { - PythonImportExpression expression = new PythonImportExpression(engine, "from math import"); - Assert.IsFalse(expression.HasIdentifier); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromSystemImportTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromSystemImportTestFixture.cs deleted file mode 100644 index 1a024aa4b8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/FromSystemImportTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class FromSystemImportTestFixture - { - PythonImportExpression expression; - - [SetUp] - public void Init() - { - string text = "from System import "; - expression = new PythonImportExpression(Python.CreateEngine(), text); - } - - [Test] - public void HasFromImportAndImportReturnsTrue() - { - Assert.IsTrue(expression.HasFromAndImport); - } - - [Test] - public void ModuleNameIsSystem() - { - Assert.AreEqual("System", expression.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ImportNamespaceExpressionTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ImportNamespaceExpressionTests.cs deleted file mode 100644 index cbf951fbd3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ImportNamespaceExpressionTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ImportNamespaceExpressionTests - { - ScriptEngine engine; - - [SetUp] - public void Init() - { - engine = Python.CreateEngine(); - } - - [Test] - public void ModuleNameReturnedIsSystemForImportSystemExpression() - { - PythonImportExpression expression = new PythonImportExpression(engine, "import System"); - Assert.AreEqual("System", expression.Module); - } - - [Test] - public void ModuleNameReturnedIsSystemForImportSystemExpressionWithWhitespaceBetweenImportAndSystem() - { - string code = "import \t System"; - PythonImportExpression expression = new PythonImportExpression(engine, code); - Assert.AreEqual("System", expression.Module); - } - - [Test] - public void ModuleNameIsEmptyStringWhenExpressionIsEmptyString() - { - PythonImportExpression expression = new PythonImportExpression(engine, String.Empty); - Assert.AreEqual(String.Empty, expression.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/IsImportExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/IsImportExpressionTestFixture.cs deleted file mode 100644 index c31f83b71b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/IsImportExpressionTestFixture.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class IsImportExpressionTestFixture - { - [Test] - public void EmptyStringIsNotImportExpression() - { - string text = String.Empty; - int offset = 0; - Assert.IsFalse(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void ImportStringFollowedByWhitespaceIsImportExpression() - { - string text = "import "; - int offset = text.Length - 1; - Assert.IsTrue(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void ImportStringSurroundedByExtraWhitespaceIsImportExpression() - { - string text = " import "; - int offset = text.Length - 1; - Assert.IsTrue(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void ImportInsideAnotherStringIsNotImportExpression() - { - string text = "Start-import-End"; - int offset = text.Length - 1; - Assert.IsFalse(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void ImportSystemIsImportExpression() - { - string text = "import System"; - int offset = text.Length - 1; - Assert.IsTrue(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void IsImportExpressionReturnsFalseWhenOffsetIsMinusOne() - { - string text = "import a"; - int offset = -1; - Assert.IsFalse(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void IsImportExpressionReturnsTrueWhenExpressionContainsOnlyFromPart() - { - string text = "from a"; - int offset = text.Length - 1; - Assert.IsTrue(PythonImportExpression.IsImportExpression(text, offset)); - } - - [Test] - public void FromExpressionFollowedByWhitespaceIsImportExpression() - { - string text = "from "; - int offset = text.Length - 1; - Assert.IsTrue(PythonImportExpression.IsImportExpression(text, offset)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithIdentifierTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithIdentifierTestFixture.cs deleted file mode 100644 index e321ac6cac..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithIdentifierTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParseFromImportWithIdentifierTestFixture - { - PythonImportExpression importExpression; - - [SetUp] - public void Init() - { - string code = "from System import Console"; - importExpression = new PythonImportExpression(code); - } - - [Test] - public void HasImportAndFromReturnsTrue() - { - Assert.IsTrue(importExpression.HasFromAndImport); - } - - [Test] - public void ImportIdentifierIsConsole() - { - Assert.AreEqual("Console", importExpression.Identifier); - } - - [Test] - public void HasIdentifierReturnsTrue() - { - Assert.IsTrue(importExpression.HasIdentifier); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithoutImportedNameTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithoutImportedNameTestFixture.cs deleted file mode 100644 index 44e5aead6a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseFromImportWithoutImportedNameTestFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class FindExpressionFromImportWithoutImportedNameTestFixture - { - ExpressionResult expressionResult; - - [SetUp] - public void Init() - { - string code = "from System import "; - int offset = 19; - PythonExpressionFinder expressionFinder = new PythonExpressionFinder(); - expressionResult = expressionFinder.FindExpression(code, offset); - } - - [Test] - public void ExpressionResultContextIsImportExpression() - { - Assert.IsNotNull(expressionResult.Context as PythonImportExpressionContext); - } - - [Test] - public void ExpressionIsFullFromImportStatement() - { - Assert.AreSame("from System import ", expressionResult.Expression); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportExpressionOnlyTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportExpressionOnlyTestFixture.cs deleted file mode 100644 index 04d016118b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportExpressionOnlyTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParseImportExpressionOnlyTestFixture - { - PythonImportExpression importExpression; - - [SetUp] - public void Init() - { - string text = "import"; - importExpression = new PythonImportExpression(Python.CreateEngine(), text); - } - - [Test] - public void ModuleNameIsEmptyString() - { - Assert.AreEqual(String.Empty, importExpression.Module); - } - - [Test] - public void HasFromAndImportIsFalse() - { - Assert.IsFalse(importExpression.HasFromAndImport); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemConsoleExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemConsoleExpressionTestFixture.cs deleted file mode 100644 index 07dbde5844..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemConsoleExpressionTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParseImportSystemConsoleExpressionTestFixture - { - PythonImportExpression importExpression; - - [SetUp] - public void Init() - { - string text = "import System.Console"; - importExpression = new PythonImportExpression(Python.CreateEngine(), text); - } - - [Test] - public void ModuleNameIsSystem() - { - Assert.AreEqual("System.Console", importExpression.Module); - } - - [Test] - public void HasFromAndImportIsFalse() - { - Assert.IsFalse(importExpression.HasFromAndImport); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemExpressionTestFixture.cs deleted file mode 100644 index c1cbed498e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseImportSystemExpressionTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParseImportSystemExpressionTestFixture - { - PythonImportExpression importExpression; - - [SetUp] - public void Init() - { - string text = "import System"; - importExpression = new PythonImportExpression(Python.CreateEngine(), text); - } - - [Test] - public void ModuleNameIsSystem() - { - Assert.AreEqual("System", importExpression.Module); - } - - [Test] - public void HasFromAndImportIsFalse() - { - Assert.IsFalse(importExpression.HasFromAndImport); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementTestFixture.cs deleted file mode 100644 index d56ad4a15c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementTestFixture.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; - -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using ICSharpCode.PythonBinding; -using IronPython; -using IronPython.Compiler; -using IronPython.Compiler.Ast; -using IronPython.Hosting; -using IronPython.Runtime; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParsePartialFromImportStatementTestFixture - { - FromImportStatement fromStatement; - - public FromImportStatement ParseStatement(string text) - { - ScriptEngine engine = Python.CreateEngine(); - PythonContext context = HostingHelpers.GetLanguageContext(engine) as PythonContext; - - StringTextContentProvider textProvider = new StringTextContentProvider(text); - SourceUnit source = context.CreateSourceUnit(textProvider, String.Empty, SourceCodeKind.SingleStatement); - - PythonCompilerSink sink = new PythonCompilerSink(); - CompilerContext compilerContext = new CompilerContext(source, new PythonCompilerOptions(), sink); - - PythonOptions options = new PythonOptions(); - using (Parser parser = Parser.CreateParser(compilerContext, options)) { - return parser.ParseSingleStatement().Body as FromImportStatement; - } - } - - [Test] - public void FromSystemImportStatementFollowedByIdentifierHasModuleNameOfSystem() - { - string text = "from System import abc"; - fromStatement = ParseStatement(text); - Assert.AreEqual("System", fromStatement.Root.MakeString()); - } - - [Test] - public void FromSystemImportStatementFollowedByIdentifierHasIdentifierInNamesCollection() - { - FromSystemImportStatementFollowedByIdentifierHasModuleNameOfSystem(); - Assert.IsTrue(fromStatement.Names.Contains("abc")); - } - - [Test] - public void FromSystemImportStatementFollowedByEmptySpaceHasModuleNameOfSystem() - { - string text = "from System import "; - fromStatement = ParseStatement(text); - Assert.AreEqual("System", fromStatement.Root.MakeString()); - } - - [Test] - public void FromSystemStatementWithNoImportHasModuleNameOfSystem() - { - string text = "from System"; - fromStatement = ParseStatement(text); - Assert.AreEqual("System", fromStatement.Root.MakeString()); - } - - [Test] - public void FromStatementFollowedBySpaceCharButNoModuleNameHasModuleNameOfEmptyString() - { - string text = "from "; - fromStatement = ParseStatement(text); - Assert.AreEqual(String.Empty, fromStatement.Root.MakeString()); - } - - [Test] - [Ignore("Does not work")] - public void FromSystemImportStatementFollowedByIdentifierAsNameHasIdentifierAsNameInAsNamesCollection() - { - string text = "from System import abc as def"; - fromStatement = ParseStatement(text); - Assert.AreEqual("def", fromStatement.AsNames[0]); - } - - [Test] - [Ignore("Does not work")] - public void FromSystemImportStatementFollowedByIdentifierAsNameFollowedBySpaceHasIdentifierAsNameInAsNamesCollection() - { - string text = "from System import abc as def "; - fromStatement = ParseStatement(text); - Assert.AreEqual("def", fromStatement.AsNames[0]); - } - - [Test] - [Ignore("Does not work")] - public void FromSystemImportStatementFollowedByIdentifierAsNameFollowedByNewLineHasIdentifierAsNameInAsNamesCollection() - { - string text = "from System import abc as def\r\n"; - fromStatement = ParseStatement(text); - Assert.AreEqual("def", fromStatement.AsNames[0]); - } - - [Test] - [Ignore("Does not work")] - public void FromSystemImportStatementFollowedByMultipleIdentifierAsNameFollowedBySpaceHasIdentifierAsNameInAsNamesCollection() - { - string text = "from System import abc as def, ghi as jkl"; - fromStatement = ParseStatement(text); - Assert.AreEqual("def", fromStatement.AsNames[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementWithTokenizerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementWithTokenizerTestFixture.cs deleted file mode 100644 index 020e9a0525..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParsePartialFromImportStatementWithTokenizerTestFixture.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; - -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using ICSharpCode.PythonBinding; -using IronPython; -using IPyCompiler = IronPython.Compiler; -using IronPython.Compiler.Ast; -using IronPython.Hosting; -using IronPython.Runtime; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParsePartialFromImportStatementWithTokenizerTestFixture - { - IPyCompiler.Tokenizer tokenizer; - - public IPyCompiler.Tokenizer CreateTokenizer(string text) - { - ScriptEngine engine = Python.CreateEngine(); - PythonContext context = HostingHelpers.GetLanguageContext(engine) as PythonContext; - - StringTextContentProvider textProvider = new StringTextContentProvider(text); - SourceUnit source = context.CreateSourceUnit(textProvider, String.Empty, SourceCodeKind.SingleStatement); - - PythonCompilerSink sink = new PythonCompilerSink(); - IPyCompiler.PythonCompilerOptions options = new IPyCompiler.PythonCompilerOptions(); - - tokenizer = new IPyCompiler.Tokenizer(sink, options); - tokenizer.Initialize(source); - return tokenizer; - } - - [Test] - public void FirstTokenIsFrom() - { - string text = "from"; - tokenizer = CreateTokenizer(text); - IPyCompiler.Token token = tokenizer.GetNextToken(); - Assert.AreEqual(IPyCompiler.TokenKind.KeywordFrom, token.Kind); - } - - [Test] - public void TokenAfterFromIsEof() - { - FirstTokenIsFrom(); - IPyCompiler.Token token = tokenizer.GetNextToken(); - - Assert.AreEqual(IPyCompiler.TokenKind.EndOfFile, token.Kind); - } - - [Test] - public void FromSystemImportSecondTokenIsModule() - { - string text = "from System"; - IPyCompiler.Token token = GetSecondToken(text); - - Assert.AreEqual(IPyCompiler.TokenKind.Name, token.Kind); - } - - IPyCompiler.Token GetSecondToken(string text) - { - return GetToken(text, 2); - } - - IPyCompiler.Token GetToken(string text, int tokenNumber) - { - tokenizer = CreateTokenizer(text); - - IPyCompiler.Token token = null; - for (int i = 0; i < tokenNumber; ++i) { - token = tokenizer.GetNextToken(); - } - return token; - } - - [Test] - public void FromSystemImportSecondTokenValueIsSystem() - { - string text = "from System"; - IPyCompiler.Token token = GetSecondToken(text); - - Assert.AreEqual("System", token.Value as String); - } - - [Test] - public void FromSystemConsoleImportSecondTokenValueIsSystem() - { - string text = "from System.Console"; - IPyCompiler.Token token = GetSecondToken(text); - - Assert.AreEqual("System", token.Value as String); - } - - [Test] - public void FromSystemConsoleImportThirdTokenValueIsDotCharacter() - { - FromSystemConsoleImportSecondTokenValueIsSystem(); - IPyCompiler.Token token = tokenizer.GetNextToken(); - - Assert.AreEqual(IPyCompiler.TokenKind.Dot, token.Kind); - } - - [Test] - public void FromSystemImportThirdTokenIsImportToken() - { - string text = "from System import"; - IPyCompiler.Token token = GetThirdToken(text); - - Assert.AreEqual(IPyCompiler.TokenKind.KeywordImport, token.Kind); - } - - IPyCompiler.Token GetThirdToken(string text) - { - return GetToken(text, 3); - } - - [Test] - public void FromSystemImportIdentifierFourthTokenIsIndentifierToken() - { - string text = "from System import abc"; - IPyCompiler.Token token = GetFourthToken(text); - - Assert.AreEqual("abc", token.Value as String); - } - - IPyCompiler.Token GetFourthToken(string text) - { - return GetToken(text, 4); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseSimpleImportExpressionTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseSimpleImportExpressionTestFixture.cs deleted file mode 100644 index e61a029e35..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/ParseSimpleImportExpressionTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Compiler; -using IronPython.Hosting; -using Microsoft.Scripting.Hosting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class ParseSimpleImportExpressionTestFixture - { - PythonExpression expression; - - [SetUp] - public void Init() - { - string code = "import"; - ScriptEngine engine = Python.CreateEngine(); - expression = new PythonExpression(engine, code); - } - - [Test] - public void FirstTokenIsImportKeyword() - { - Token token = expression.GetNextToken(); - Assert.AreEqual(TokenKind.KeywordImport, token.Kind); - } - - [Test] - public void SecondTokenIsEndOfFile() - { - expression.GetNextToken(); - Token token = expression.GetNextToken(); - Assert.AreEqual(TokenKind.EndOfFile, token.Kind); - } - - [Test] - public void CurrentTokenIsNull() - { - Assert.IsNull(expression.CurrentToken); - } - - [Test] - public void GetNextTokenSetsCurrentTokenToKeywordImport() - { - expression.GetNextToken(); - Assert.AreEqual(TokenKind.KeywordImport, expression.CurrentToken.Kind); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/RemoveLastPartTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/RemoveLastPartTests.cs deleted file mode 100644 index 5f4e43bfe6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/RemoveLastPartTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - /// - /// Tests the PythonExpressionFinder's RemoveLastPart method. - /// - [TestFixture] - public class RemoveLastPartTests - { - PythonExpressionFinder expressionFinder; - - [TestFixtureSetUp] - public void SetUpFixture() - { - expressionFinder = new PythonExpressionFinder(); - } - - [Test] - public void NullString() - { - Assert.AreEqual(String.Empty, expressionFinder.RemoveLastPart(null)); - } - - [Test] - public void EmptyString() - { - Assert.AreEqual(String.Empty, expressionFinder.RemoveLastPart(String.Empty)); - } - - /// - /// Should remove the WriteLine part of the string. - /// - [Test] - public void SystemConsoleWriteLineString() - { - string expression = "System.Console.WriteLine"; - Assert.AreEqual("System.Console", expressionFinder.RemoveLastPart(expression)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/StringTextContentProviderTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/StringTextContentProviderTests.cs deleted file mode 100644 index da38d1d06e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Expressions/StringTextContentProviderTests.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Hosting; -using IronPython.Runtime; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using NUnit.Framework; - -namespace PythonBinding.Tests.Expressions -{ - [TestFixture] - public class StringTextContentProviderTests - { - [Test] - public void ReadToEndFromStringTextContentProvider() - { - string text = "abc"; - StringTextContentProvider provider = new StringTextContentProvider(text); - using (SourceCodeReader reader = provider.GetReader()) { - Assert.AreEqual("abc", reader.ReadToEnd()); - } - } - - [Test] - public void StringTextContentProviderIsMicrosoftScriptingTextContentProvider() - { - StringTextContentProvider provider = new StringTextContentProvider(String.Empty); - Assert.IsNotNull(provider as TextContentProvider); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs deleted file mode 100644 index 87059ebb51..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/AppSettingsPanelTestFixture.cs +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Gui -{ - /// - /// Tests the ApplicationSettingsPanel class. - /// - [TestFixture] - public class AppSettingsPanelTestFixture - { - DerivedApplicationSettingsPanel appSettingsPanel; - PythonProject project; - - [SetUp] - public void SetUp() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - - ProjectCreateInformation info = new ProjectCreateInformation(); - info.Solution = new Solution(new MockProjectChangeWatcher()); - info.ProjectName = "Test"; - info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj"; - info.RootNamespace = "Test"; - - project = new PythonProject(info); - - appSettingsPanel = new DerivedApplicationSettingsPanel(); - appSettingsPanel.Owner = project; - appSettingsPanel.LoadPanelContents(); - } - - [TearDown] - public void TearDown() - { - appSettingsPanel.Dispose(); - } - - [Test] - public void IsHelperInitialised() - { - Assert.IsNotNull(appSettingsPanel.Helper); - } - - [Test] - public void SetupFromManifestStreamResourceName() - { - Assert.AreEqual("ICSharpCode.PythonBinding.Resources.ApplicationSettingsPanel.xfrm", appSettingsPanel.SetupFromManifestResourceName); - } - - [Test] - public void AssemblyNameBoundToTextBox() - { - Assert.AreEqual("assemblyNameTextBox", appSettingsPanel.GetBoundStringControlName("AssemblyName")); - } - - [Test] - public void AssemblyNameTextEditBindMode() - { - Assert.AreEqual(TextBoxEditMode.EditEvaluatedProperty, appSettingsPanel.GetBoundControlTextBoxEditMode("AssemblyName")); - } - - [Test] - public void AssemblyNameTextBoxLocationButtonCreated() - { - Assert.IsTrue(appSettingsPanel.IsLocationButtonCreated("assemblyNameTextBox")); - } - - [Test] - public void RootNamespaceBoundToTextBox() - { - Assert.AreEqual("rootNamespaceTextBox", appSettingsPanel.GetBoundStringControlName("RootNamespace")); - } - - [Test] - public void RootNamespaceTextEditBindMode() - { - Assert.AreEqual(TextBoxEditMode.EditEvaluatedProperty, appSettingsPanel.GetBoundControlTextBoxEditMode("RootNamespace")); - } - - [Test] - public void RootNamespaceTextBoxLocationButtonCreated() - { - Assert.IsTrue(appSettingsPanel.IsLocationButtonCreated("rootNamespaceTextBox")); - } - - [Test] - public void ProjectFolder() - { - Assert.AreEqual(project.Directory, appSettingsPanel.Get("projectFolder").Text); - } - - [Test] - public void ProjectFile() - { - Assert.AreEqual(Path.GetFileName(project.FileName), appSettingsPanel.Get("projectFile").Text); - } - - [Test] - public void ProjectFileTextBoxIsReadOnly() - { - Assert.IsTrue(appSettingsPanel.Get("projectFile").ReadOnly); - } - - [Test] - public void AddConfigurationSelectorCalled() - { - Assert.IsTrue(appSettingsPanel.ConfigurationSelectorAddedToControl); - } - - [Test] - public void OutputTypeBoundToComboBox() - { - Assert.AreEqual("outputTypeComboBox", appSettingsPanel.GetBoundEnumControlName("OutputType")); - } - - [Test] - public void OutputTypeLocationButtonCreated() - { - Assert.IsTrue(appSettingsPanel.IsLocationButtonCreated("outputTypeComboBox")); - } - - [Test] - public void OutputName() - { - Assert.AreEqual("Test.exe", appSettingsPanel.Get("outputName").Text); - } - - [Test] - public void MainFileBoundToTextBox() - { - Assert.AreEqual("mainFileComboBox", appSettingsPanel.GetBoundStringControlName("MainFile")); - } - - [Test] - public void MainFileTextEditBindMode() - { - Assert.AreEqual(TextBoxEditMode.EditEvaluatedProperty, appSettingsPanel.GetBoundControlTextBoxEditMode("MainFile")); - } - - [Test] - public void MainFileTextBoxLocationButtonCreated() - { - Assert.IsTrue(appSettingsPanel.IsLocationButtonCreated("mainFileComboBox")); - } - - [Test] - public void MainFileBrowseButtonConnected() - { - Assert.AreEqual("mainFileComboBox", GetMainFileBrowseInfo().Target); - } - - [Test] - public void MainFileBrowseButtonTextEditMode() - { - Assert.AreEqual(TextBoxEditMode.EditEvaluatedProperty, GetMainFileBrowseInfo().TextBoxEditMode); - } - - [Test] - public void MainFileBrowseButtonFileFilter() - { - Assert.AreEqual("${res:SharpDevelop.FileFilter.AllFiles}|*.*", GetMainFileBrowseInfo().FileFilter); - } - - [Test] - public void OutputNameChangedAfterAssemblyNameChanged() - { - appSettingsPanel.Get("assemblyName").Text = "PythonTest"; - appSettingsPanel.CallAssemblyNameTextBoxTextChanged(); - Assert.AreEqual("PythonTest.exe", appSettingsPanel.Get("outputName").Text); - } - - [Test] - public void OutputTypeComboBoxSelectedIndexChanged() - { - appSettingsPanel.Get("outputType").SelectedIndex = 2; - appSettingsPanel.CallOutputTypeComboBoxSelectedIndexChanged(); - Assert.AreEqual("Test.dll", appSettingsPanel.Get("outputName").Text); - } - - BrowseButtonInfo GetMainFileBrowseInfo() - { - return appSettingsPanel.GetBrowseButtonInfo("mainFileBrowseButton"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs deleted file mode 100644 index 0e6cb9c8e6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/CompilingOptionsPanelTestFixture.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Gui -{ - /// - /// Tests the CompilingOptionsPanel. - /// - [TestFixture] - public class CompilingOptionsPanelTestFixture - { - DerivedCompilingOptionsPanel compilingOptionsPanel; - PythonProject project; - - [SetUp] - public void SetUp() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - - ProjectCreateInformation info = new ProjectCreateInformation(); - info.Solution = new Solution(new MockProjectChangeWatcher()); - info.ProjectName = "Test"; - info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj"; - info.RootNamespace = "Test"; - - project = new PythonProject(info); - - compilingOptionsPanel = new DerivedCompilingOptionsPanel(); - compilingOptionsPanel.Owner = project; - compilingOptionsPanel.LoadPanelContents(); - } - - [TearDown] - public void TearDown() - { - compilingOptionsPanel.Dispose(); - } - - [Test] - public void IsHelperInitialised() - { - Assert.IsNotNull(compilingOptionsPanel.Helper); - } - - [Test] - public void SetupFromManifestStreamResourceName() - { - Assert.AreEqual("ICSharpCode.PythonBinding.Resources.CompilingOptionsPanel.xfrm", compilingOptionsPanel.SetupFromManifestResourceName); - } - - [Test] - public void OutputPathBoundToTextBox() - { - Assert.AreEqual("outputPathTextBox", compilingOptionsPanel.GetBoundStringControlName("OutputPath")); - } - - [Test] - public void OutputPathTextEditBindMode() - { - Assert.AreEqual(TextBoxEditMode.EditRawProperty, compilingOptionsPanel.GetBoundControlTextBoxEditMode("OutputPath")); - } - - [Test] - public void OutputPathTextBoxLocationButtonCreated() - { - Assert.IsTrue(compilingOptionsPanel.IsLocationButtonCreated("outputPathTextBox")); - } - - [Test] - public void OutputPathBrowseButtonConnected() - { - Assert.AreEqual("outputPathTextBox", GetOutputPathBrowseFolderInfo().Target); - } - - [Test] - public void OutputPathBrowseButtonTextEditMode() - { - Assert.AreEqual(TextBoxEditMode.EditRawProperty, GetOutputPathBrowseFolderInfo().TextBoxEditMode); - } - - [Test] - public void OutputPathBrowseButtonFilter() - { - Assert.AreEqual("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", GetOutputPathBrowseFolderInfo().Description); - } - - [Test] - public void DebugInfoPathBoundToCheckBox() - { - Assert.AreEqual("debugInfoCheckBox", compilingOptionsPanel.GetBoundBooleanControlName("DebugInfo")); - } - - [Test] - public void DebugInfoTextBoxLocationButtonCreated() - { - Assert.IsTrue(compilingOptionsPanel.IsLocationButtonCreated("debugInfoCheckBox")); - } - - [Test] - public void AddConfigurationSelectorCalled() - { - Assert.IsTrue(compilingOptionsPanel.ConfigurationSelectorAddedToControl); - } - - [Test] - public void TargetCpuComboxBoxAdded() - { - Assert.IsTrue(compilingOptionsPanel.IsTargetCpuComboBoxCreated); - } - - [Test] - public void TargetCpuComboxBoxLocationButtonCreated() - { - Assert.IsTrue(compilingOptionsPanel.IsLocationButtonCreated("targetCpuComboBox")); - } - - BrowseFolderButtonInfo GetOutputPathBrowseFolderInfo() - { - return compilingOptionsPanel.GetBrowseFolderButtonInfo("outputPathBrowseButton"); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTests.cs deleted file mode 100644 index 9fdf1c0f93..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/DebugPythonCommandTests.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Debugging; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Gui -{ - [TestFixture] - public class DebugPythonCommandTestFixture - { - MockDebugger debugger; - RunDebugPythonCommand command; - - [TestFixtureSetUp] - public void SetUpFixture() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.py"); - - Properties p = new Properties(); - PythonAddInOptions options = new PythonAddInOptions(p); - options.PythonFileName = @"C:\IronPython\ipy.exe"; - - debugger = new MockDebugger(); - command = new RunDebugPythonCommand(workbench, options, debugger); - command.Run(); - } - - [Test] - public void Run_PythonFileOpen_DebuggerStartMethodCalled() - { - bool result = debugger.StartMethodCalled; - Assert.IsTrue(result); - } - - [Test] - public void Run_PythonFileOpen_IronPythonConsoleFileNamePassedToDebugger() - { - string fileName = debugger.ProcessStartInfo.FileName; - string expectedFileName = @"C:\IronPython\ipy.exe"; - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void Run_PythonFileOpen_DebugOptionsPassedToIronPythonConsole() - { - string args = debugger.ProcessStartInfo.Arguments; - string expectedArgs = "-X:Debug \"test.py\""; - Assert.AreEqual(expectedArgs, args); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs deleted file mode 100644 index 6868351b45..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/FormsDesignerDisplayBindingTestFixture.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Gui -{ - /// - /// Tests the PythonFormsDesignerDisplayBinding. - /// - [TestFixture] - public class FormsDesignerDisplayBindingTestFixture - { - DerivedPythonFormsDesignerDisplayBinding displayBinding; - MockTextEditorViewContent viewContent; - bool canAttachToDesignableClass; - ParseInformation parseInfo; - - [SetUp] - public void SetUp() - { - displayBinding = new DerivedPythonFormsDesignerDisplayBinding(); - viewContent = new MockTextEditorViewContent(); - parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - viewContent.PrimaryFileName = new FileName("test.py"); - viewContent.TextEditor.Document.Text = "text content"; - displayBinding.ParseServiceParseInfoToReturn = parseInfo; - displayBinding.IsParseInfoDesignable = true; - canAttachToDesignableClass = displayBinding.CanAttachTo(viewContent); - } - - [Test] - public void ReattachWhenParserServiceIsReady() - { - Assert.IsTrue(displayBinding.ReattachWhenParserServiceIsReady); - } - - [Test] - public void CanAttachToNullViewContent() - { - Assert.IsFalse(displayBinding.CanAttachTo(null)); - } - - [Test] - public void CanAttachToDesignableClass() - { - Assert.IsTrue(canAttachToDesignableClass); - } - - [Test] - public void CannotAttachToNonTextEditorViewContent() - { - MockViewContent viewContent = new MockViewContent(); - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void ParseInfoPassedToFormsDesignerIsDesignableMethod() - { - Assert.AreEqual(parseInfo, displayBinding.ParseInfoTestedForDesignability); - } - - [Test] - public void ParseInfoIsNotDesignable() - { - displayBinding.IsParseInfoDesignable = false; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void NullViewContentFileName() - { - viewContent.PrimaryFileName = null; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void FileNamePassedToGetParseInfo() - { - Assert.AreEqual("test.py", displayBinding.FileNamePassedToGetParseInfo); - } - - [Test] - public void TextContentPassedToGetParseInfo() - { - Assert.AreEqual("text content", displayBinding.TextContentPassedToGetParseInfo); - } - - [Test] - public void NonPythonFileNameCannotBeAttachedTo() - { - viewContent.PrimaryFileName = new FileName("test.cs"); - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void NullViewContentPrimaryFileName() - { - viewContent.PrimaryFileName = null; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void CreatesPythonFormsDesigner() - { - MockTextEditorViewContent view = new MockTextEditorViewContent(); - IViewContent[] views = displayBinding.CreateSecondaryViewContent(view, new MockTextEditorOptions()); - Assert.AreEqual(1, views.Length); - Assert.IsTrue(views[0] is FormsDesignerViewContent); - views[0].Dispose(); - } - - [Test] - public void FormDesignerNotCreatedIfAlreadyAttached() - { - MockTextEditorViewContent view = new MockTextEditorViewContent(); - IViewContent[] views = null; - using (FormsDesignerViewContent formsDesigner = new FormsDesignerViewContent(view, new MockOpenedFile("test.py"))) { - view.SecondaryViewContents.Add(formsDesigner); - views = displayBinding.CreateSecondaryViewContent(view, new MockTextEditorOptions()); - } - Assert.AreEqual(0, views.Length); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonFormattingStrategyTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonFormattingStrategyTests.cs deleted file mode 100644 index 8ba26e0dac..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/PythonFormattingStrategyTests.cs +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.AvalonEdit; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using NUnit.Framework; - -namespace PythonBinding.Tests.Gui -{ - [TestFixture] - public class PythonFormattingStrategyTests - { - TextEditor textEditor; - AvalonEditTextEditorAdapter textEditorAdapter; - PythonFormattingStrategy formattingStrategy; - - void CreatePythonFormattingStrategy() - { - MockTextEditorOptions textEditorOptions = new MockTextEditorOptions(); - textEditorOptions.IndentationSize = 4; - textEditor = new TextEditor(); - textEditor.Options = textEditorOptions; - - textEditorAdapter = new AvalonEditTextEditorAdapter(textEditor); - formattingStrategy = new PythonFormattingStrategy(); - } - - - [Test] - public void IndentLine_IndentLineAfterNewMethodDefinition_LineIsIndentedByOneTab() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def newMethod:\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def newMethod:\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_NoExtraIndentationRequiredAfterPrintLineStatement_SecondLineIsIndentedToSameLevelAsPrintStatementLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "\tprint 'abc'\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "\tprint 'abc'\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_IndentAfterPassStatementOnSecondLine_DecreasesIndentOnThirdLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\tpass\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\tpass\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_IndentAfterReturnValueStatementOnSecondLine_DecreasesIndentOnThirdLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\treturn 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\treturn 0\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_IndentAfterReturnStatementOnSecondLine_DecreasesIndentOnThirdLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\treturn\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\treturn\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - [Test] - public void IndentLine_ReturnStatementWithNoIndentPreviousLine_SecondLineIsNotIndented() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "return\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "return\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotReturnOnPreviousLineAndIsIndentedByOneTab_LineIsIndentedByOneTab() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "\treturnValue\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "\treturnValue\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RaiseStatementWithObjectOneSecondLine_DecreasesIndentOnThirdLineByOne() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\traise 'a'\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\traise 'a'\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RaiseStatementOnSecondLine_IndentOnThirdLineIsDecreasedByOne() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\traise\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\traise\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotRaiseStatementOnPreviousLine_LineIsIndentedToSameLevelAsPreviouisLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\traiseThis\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\traiseThis\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_BreakStatementOnSecondLine_DecreasesIndentOnThirdLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\tbreak\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\tbreak\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotBreakStatementOnPreviousLine_LineIsIndentedToSameLevelAsPreviousLine() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = - "def method1:\r\n" + - "\tbreakThis\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1:\r\n" + - "\tbreakThis\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_LineNumberOutOfRange_DoesNotThrowArgumentOutOfRangeException() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = "print 'hello'"; - - IDocumentLine line = textEditorAdapter.Document.GetLine(1); - Assert.DoesNotThrow(delegate { - formattingStrategy.IndentLine(textEditorAdapter, line); }); - string text = textEditor.Text; - - string expectedText = "print 'hello'"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void SurroundSelectionWithComment_CursorOnFirstLineAndNothingSelected_FirstLineIsCommented() - { - CreatePythonFormattingStrategy(); - - textEditor.Text = "print 'hello'"; - formattingStrategy.SurroundSelectionWithComment(textEditorAdapter); - string text = textEditor.Text; - - string expectedText = "#print 'hello'"; - - Assert.AreEqual(expectedText, text); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs deleted file mode 100644 index 65392c245d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Gui/RunPythonCommandTests.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Gui -{ - /// - /// Tests that the RunPythonCommand class runs the Python console - /// passing the filename of the python script active in SharpDevelop. - /// - [TestFixture] - public class RunPythonCommandTests - { - MockDebugger debugger; - RunPythonCommand command; - - [SetUp] - public void Init() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.py"); - - Properties p = new Properties(); - PythonAddInOptions options = new PythonAddInOptions(p); - options.PythonFileName = @"C:\IronPython\ipy.exe"; - - debugger = new MockDebugger(); - command = new RunPythonCommand(workbench, options, debugger); - command.Run(); - } - - [Test] - public void BaseClass_NewInstance_IsAbstractCommand() - { - Assert.IsNotNull(command as AbstractCommand); - } - - [Test] - public void Run_PythonFileOpen_DebuggerStartWithoutDebuggingMethodCalled() - { - bool result = debugger.StartWithoutDebuggingMethodCalled; - Assert.IsTrue(result); - } - - [Test] - public void Run_PythonFileOpen_CommandPromptExePassedToDebugger() - { - string fileName = debugger.ProcessStartInfo.FileName; - string expectedFileName = "cmd.exe"; - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void Run_PythonFileOpen_IronPythonConsoleAndPythonFileNameAndPausePassedAsCommandLineArguments() - { - string args = debugger.ProcessStartInfo.Arguments; - string expectedArgs = "/c \"\"C:\\IronPython\\ipy.exe\" \"test.py\"\" & pause"; - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void Run_PythonFileOpen_IronPythonConsoleWorkingDirectoryIsPathToPythonScriptFileBeingRun() - { - string workingDirectory = debugger.ProcessStartInfo.WorkingDirectory; - string expectedWorkingDirectory = @"C:\Projects"; - Assert.AreEqual(expectedWorkingDirectory, workingDirectory); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/AddInvalidSourceSpanToErrorSinkTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/AddInvalidSourceSpanToErrorSinkTestFixture.cs deleted file mode 100644 index 1578a74203..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/AddInvalidSourceSpanToErrorSinkTestFixture.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Runtime; -using Microsoft.Scripting; -using Microsoft.Scripting.Runtime; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that the python compiler sink does not throw an exception when an invalid SourceLocation is used. - /// - [TestFixture] - public class AddInvalidSourceSpanToErrorSinkTestFixture - { - [Test] - public void AddInvalidSourceSpan() - { - IronPython.Hosting.Python.CreateEngine(); - PythonCompilerSink sink = new PythonCompilerSink(); - SourceUnit source = DefaultContext.DefaultPythonContext.CreateSourceUnit(NullTextContentProvider.Null, @"D:\test.py", SourceCodeKind.InteractiveCode); - sink.Add(source, "Test", SourceSpan.Invalid, 1000, Severity.FatalError); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs deleted file mode 100644 index 0f4a95e36a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ClassWithBaseClassTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that a base class is added to the class. - /// - [TestFixture] - public class ClassWithBaseClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Test(Base):\r\n" + - "\tdef foo(self):\r\n" + - "\t\tpass"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void HasBaseClass() - { - IReturnType matchedBaseType = null; - foreach (IReturnType baseType in c.BaseTypes) { - if (baseType.Name == "Base") { - matchedBaseType = baseType; - break; - } - } - Assert.IsNotNull(matchedBaseType); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidCastInPythonParserTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidCastInPythonParserTestFixture.cs deleted file mode 100644 index 2d980b1db4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidCastInPythonParserTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using System; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// The IronPython 2.0.2 parser will throw an invalid cast exception for the following code: - /// - /// class Project(id): - /// def __init__ Project_ID(): - /// #i - /// - /// System.InvalidCastException: Unable to cast object of type 'IronPython.Compiler.Ast.ErrorExpression' to type 'IronPython.Compiler.Ast.NameExpression'. - /// at IronPython.Compiler.Parser.ParseParameter(Int32 position, Dictionary`2 names) - /// at IronPython.Compiler.Parser.ParseVarArgsList(TokenKind terminator) - /// at IronPython.Compiler.Parser.ParseFuncDef() - /// at IronPython.Compiler.Parser.ParseStmt() - /// at IronPython.Compiler.Parser.ParseSuite() - /// at IronPython.Compiler.Parser.ParseClassDef() - /// at IronPython.Compiler.Parser.ParseStmt() - /// at IronPython.Compiler.Parser.ParseFile(Boolean makeModule) - /// at ICSharpCode.PythonBinding.PythonParser.CreateAst(String fileName, String fileContent) - /// - /// This test just ensures that this bug is fixed with IronPython 2.6 - /// - [TestFixture] - public class InvalidCastInPythonParserTestFixture - { - string code = - "class Project(id): \r\n" + - " def __init__ Project_ID(): \r\n" + - " #i\r\n"; - - /// - /// Check that IronPython bug has been fixed exists. - /// - [Test] - public void CreateAstShouldNotThrowInvalidCastException() - { - PythonParser parser = new PythonParser(); - PythonAst ast = parser.CreateAst(@"d:\projects\test\test.py", new StringTextBuffer(code)); - } - - [Test] - public void ParseShouldNotThrowInvalidCastException() - { - PythonParser parser = new PythonParser(); - ICompilationUnit unit = parser.Parse(new DefaultProjectContent(), @"d:\projects\test\test.py", code); - Assert.AreEqual(1, unit.Classes.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidClassTestFixture.cs deleted file mode 100644 index 977310d633..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/InvalidClassTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that if one part of a class is invalid the parser - /// still returns a class as part of the compilation unit. - /// This is better than returning nothing. - /// - [TestFixture] - public class InvalidClassTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "import System\r\n" + - "\r\n" + - "class Class1:\r\n" + - " def __init__(self):\r\n" + - " Console.\r\n" + - " pass\r\n"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - } - - [Test] - public void OneClassFound() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void FileNameSet() - { - Assert.AreEqual(@"C:\test.py", compilationUnit.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MethodWithParametersTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MethodWithParametersTestFixture.cs deleted file mode 100644 index 1fad102cad..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MethodWithParametersTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Description of MethodWithParametersTestFixture. - /// - [TestFixture] - public class MethodWithParametersTestFixture - { - IMethod method; - IParameter senderParameter; - IParameter eventArgsParameter; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Test(Base):\r\n" + - "\tdef foo(self, sender, e):\r\n" + - "\t\tpass"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - IClass c = compilationUnit.Classes[0]; - method = c.Methods[0]; - if (method.Parameters.Count > 1) { - senderParameter = method.Parameters[0]; - eventArgsParameter = method.Parameters[1]; - } - } - } - - [Test] - public void MethodHasTwoParameters() - { - Assert.AreEqual(2, method.Parameters.Count); - } - - [Test] - public void FirstParameterIsSender() - { - Assert.AreEqual("sender", senderParameter.Name); - } - - [Test] - public void SecondParameterIsEventArgs() - { - Assert.AreEqual("e", eventArgsParameter.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MissingLastParameterFromMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MissingLastParameterFromMethodTestFixture.cs deleted file mode 100644 index 136cb0b1e6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/MissingLastParameterFromMethodTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that the python parser does not throw an exception - /// when the last parameter is missing from a method. - /// - [TestFixture] - public class MissingLastParameterFromMethodTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Class1:\r\n" + - " def method(arg1,arg2,"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - } - - [Test] - public void CompilationUnitIsNotNull() - { - Assert.IsNotNull(compilationUnit); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs deleted file mode 100644 index 90cf774b9d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassNestedInsideMethodTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassNestedInsideMethodTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [SetUp] - public void SetUpFixture() - { - string python = - "class MyClass:\r\n" + - " def firstMethod(self):\r\n" + - " class NestedClass:\r\n" + - " def firstNestedClassMethod(self):\r\n" + - " pass\r\n" + - "\r\n" + - " def secondMethod(self):\r\n" + - " pass\r\n" + - "\r\n"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void CompilationUnitHasOneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void MyClassHasTwoMethods() - { - Assert.AreEqual(2, c.Methods.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs deleted file mode 100644 index fe6ec61746..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Having a newline at the end of the class's last method was - /// causing the "pass" statement to be truncated when the constructor - /// was folded. This test fixture tests for that bug. - /// - [TestFixture] - public class ParseClassWithCtorTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold; - FoldingSection classFold; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Test:\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tpass\r\n"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - // Get folds. - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = python; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 1) { - classFold = folds[0]; - methodFold = folds[1]; - } - } - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 21; - int endLine = 3; - int endColumn = 7; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - [Test] - public void MethodFoldTextInsideFoldIsMethodBody() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\t\tpass", textInsideFold); - } - - [Test] - public void MethodIsConstructor() - { - Assert.IsTrue(method.IsConstructor); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithMethodTestFixture.cs deleted file mode 100644 index 41a1736f10..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseClassWithMethodTestFixture.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassWithMethodTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold = null; - FoldingSection classFold = null; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Test:\r\n" + - "\tdef foo(self):\r\n" + - "\t\tpass"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = python; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 0) { - classFold = folds[0]; - } - if (folds.Count > 1) { - methodFold = folds[1]; - } - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void ClassName() - { - Assert.AreEqual("Test", c.Name); - } - - [Test] - public void ClassBodyRegion() - { - int startLine = 1; - int startColumn = 12; - int endLine = 3; - int endColumn = 7; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - /// - /// The class declaration region needs to extend up to and - /// including the colon. - /// - [Test] - public void ClassRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 3; - int endColumn = 7; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - - [Test] - public void MethodName() - { - Assert.AreEqual("foo", method.Name); - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 16; - int endLine = 3; - int endColumn = 7; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - /// - /// The method region needs to extend up just after the colon. It does not include the body. - /// - [Test] - public void MethodRegion() - { - int startLine = 2; - int startColumn = 2; - int endLine = 2; - int endColumn = 16; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.Region.ToString()); - } - - [Test] - public void MethodFoldTextInsideFoldIsMethodBody() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\t\tpass", textInsideFold); - } - - [Test] - public void MethodIsNotConstructor() - { - Assert.IsFalse(method.IsConstructor); - } - - [Test] - public void MethodIsPublic() - { - ModifierEnum modifiers = ModifierEnum.Public; - Assert.AreEqual(modifiers, method.Modifiers); - } - - [Test] - public void ClassFoldTextInsideFoldIsClassBody() - { - string textInsideFold = document.GetText(classFold.StartOffset, classFold.Length); - Assert.AreEqual("\r\n\tdef foo(self):\r\n\t\tpass", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportAllTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportAllTestFixture.cs deleted file mode 100644 index d9bfaeae2f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportAllTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromMathImportAllTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from math import *"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void PythonImportContainsMathModuleName() - { - Assert.AreEqual("math", import.Module); - } - - [Test] - public void PythonImportImportsEverythingReturnsTrue() - { - Assert.IsTrue(import.ImportsEverything); - } - - [Test] - public void PythonImportGetIdentifierForAliasDoesNotThrowNullReferenceException() - { - string identifier = String.Empty; - Assert.DoesNotThrow(delegate { identifier = import.GetOriginalNameForAlias("unknown"); }); - Assert.IsNull(identifier); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportCosAndTanTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportCosAndTanTestFixture.cs deleted file mode 100644 index 2afdcd009c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromMathImportCosAndTanTestFixture.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromMathImportCosAndTanTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from math import cos, tan"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void UsingAsPythonImportHasCosIdentifier() - { - Assert.IsTrue(import.IsImportedName("cos")); - } - - [Test] - public void UsingAsPythonImportContainsMathModuleName() - { - Assert.AreEqual("math", import.Module); - } - - [Test] - public void UsingAsPythonImportHasTanIdentifier() - { - Assert.IsTrue(import.IsImportedName("tan")); - } - - [Test] - public void UsingAsPythonImportDoesNotHaveACosIdentifier() - { - Assert.IsFalse(import.IsImportedName("acos")); - } - - [Test] - public void PythonImportImportsEverythingReturnsFalse() - { - Assert.IsFalse(import.ImportsEverything); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitAsMyExitTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitAsMyExitTestFixture.cs deleted file mode 100644 index 110d8ebab2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitAsMyExitTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromSysImportExitAsMyExitTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from sys import exit as myexit"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void UsingAsPythonImportHasMyExitIdentifier() - { - Assert.IsTrue(import.IsImportedName("myexit")); - } - - [Test] - public void UsingAsPythonImportDoesNotHaveExitIdentifier() - { - Assert.IsFalse(import.IsImportedName("exit")); - } - - [Test] - public void PythonImportGetIdentifierFromAliasReturnsExitForMyExit() - { - Assert.AreEqual("exit", import.GetOriginalNameForAlias("myexit")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitTestFixture.cs deleted file mode 100644 index 8d0b58049a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportExitTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromSysImportExitTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from sys import exit"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void UsingAsPythonImportHasExitIdentifier() - { - Assert.IsTrue(import.IsImportedName("exit")); - } - - [Test] - public void UsingAsPythonImportDoesNotHaveUnknownIdentifier() - { - Assert.IsFalse(import.IsImportedName("unknown")); - } - - [Test] - public void UsingAsPythonImportContainsSysModuleName() - { - Assert.AreEqual("sys", import.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportMissingImportTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportMissingImportTestFixture.cs deleted file mode 100644 index 2112d6cf74..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportMissingImportTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromSysImportMissingImportTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from sys"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void UsingAsPythonImportDoesNotHaveEmptyStringIdentifier() - { - Assert.IsFalse(import.IsImportedName(String.Empty)); - } - - [Test] - public void UsingAsPythonImportDoesNotHaveNullIdentifier() - { - Assert.IsFalse(import.IsImportedName(null)); - } - - [Test] - public void UsingAsPythonImportContainsSysModuleName() - { - Assert.AreEqual("sys", import.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportWithoutImportedNameTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportWithoutImportedNameTestFixture.cs deleted file mode 100644 index ac0ef385aa..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseFromSysImportWithoutImportedNameTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseFromSysImportWithoutImportedNameTestFixture - { - ICompilationUnit compilationUnit; - PythonFromImport import; - - [SetUp] - public void Init() - { - string python = "from sys import"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonFromImport; - } - - [Test] - public void UsingAsPythonImportDoesNotHaveEmptyStringIdentifier() - { - Assert.IsFalse(import.IsImportedName(String.Empty)); - } - - [Test] - public void UsingAsPythonImportDoesNotHaveNullIdentifier() - { - Assert.IsFalse(import.IsImportedName(null)); - } - - [Test] - public void UsingAsPythonImportContainsSysModuleName() - { - Assert.AreEqual("sys", import.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportMultipleModulesTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportMultipleModulesTestFixture.cs deleted file mode 100644 index b3570a3fcd..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportMultipleModulesTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseImportMultipleModulesTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "import System, System.Console"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - } - - [Test] - public void OneUsingStatementCreatedByParser() - { - Assert.AreEqual(1, compilationUnit.UsingScope.Usings.Count); - } - - [Test] - public void FirstNamespaceImportedIsSystem() - { - Assert.AreEqual("System", compilationUnit.UsingScope.Usings[0].Usings[0]); - } - - [Test] - public void SecondNamespaceImportedIsSystemConsole() - { - Assert.AreEqual("System.Console", compilationUnit.UsingScope.Usings[0].Usings[1]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportSysTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportSysTestFixture.cs deleted file mode 100644 index 8cf12dd85e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportSysTestFixture.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseImportSysTestFixture - { - ICompilationUnit compilationUnit; - PythonImport import; - - [SetUp] - public void Init() - { - string python = "import sys"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - import = compilationUnit.UsingScope.Usings[0] as PythonImport; - } - - [Test] - public void PythonImportHasExitIdentifier() - { - Assert.AreEqual("sys", import.Module); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportTestFixture.cs deleted file mode 100644 index bb5d5febf8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseImportTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that import statements are added to the compilation - /// unit's Using property. - /// - [TestFixture] - public class ParseImportTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "import System"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - } - - [Test] - public void OneUsing() - { - Assert.AreEqual(1, compilationUnit.UsingScope.Usings.Count); - } - - [Test] - public void UsingSystem() - { - Assert.AreEqual("System", compilationUnit.UsingScope.Usings[0].Usings[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseInvalidPythonCodeTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseInvalidPythonCodeTestFixture.cs deleted file mode 100644 index 92dac30c20..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseInvalidPythonCodeTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that the python parser does not throw an exception - /// when the python code is invalid. - /// - [TestFixture] - public class ParseInvalidPythonCodeTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - } - - [Test] - public void CompilationUnitIsNotNull() - { - Assert.IsNotNull(compilationUnit); - } - - [Test] - public void FileNameSet() - { - Assert.AreEqual(@"C:\test.py", compilationUnit.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs deleted file mode 100644 index 35f06bd914..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Support folding when no classes are defined. - /// - [TestFixture] - public class ParseMethodsWithNoClassTestFixture - { - ICompilationUnit compilationUnit; - TextDocument document; - FoldingSection fooMethodFold = null; - FoldingSection barMethodFold = null; - IClass globalClass; - IMethod fooMethod; - IMethod barMethod; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "def foo():\r\n" + - "\tpass\r\n" + - "\r\n" + - "def bar(i):\r\n" + - "\tpass"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - - if (compilationUnit.Classes.Count > 0) { - globalClass = compilationUnit.Classes[0]; - if (globalClass.Methods.Count > 1) { - fooMethod = globalClass.Methods[0]; - barMethod = globalClass.Methods[1]; - } - } - - // Get folds. - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = python; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 1) { - fooMethodFold = folds[0]; - barMethodFold = folds[1]; - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void GlobalClassName() - { - Assert.AreEqual("test", globalClass.Name); - } - - [Test] - public void GlobalClassHasTwoMethods() - { - Assert.AreEqual(2, globalClass.Methods.Count); - } - - [Test] - public void FooMethodName() - { - Assert.AreEqual("foo", fooMethod.Name); - } - - [Test] - public void BarMethodName() - { - Assert.AreEqual("bar", barMethod.Name); - } - - [Test] - public void FooMethodDefaultReturnType() - { - Assert.AreEqual(globalClass, fooMethod.ReturnType.GetUnderlyingClass()); - } - - [Test] - public void BarMethodDefaultReturnType() - { - Assert.AreEqual(globalClass, barMethod.ReturnType.GetUnderlyingClass()); - } - - [Test] - public void FooMethodDeclaringType() - { - Assert.AreEqual(globalClass, fooMethod.DeclaringType); - } - - [Test] - public void FooMethodBodyRegion() - { - int startLine = 1; - int startColumn = 11; - int endLine = 2; - int endColumn = 6; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), fooMethod.BodyRegion.ToString()); - } - - /// - /// The method region needs to extend up just after the colon. It does not include the body. - /// - [Test] - public void FooMethodRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 1; - int endColumn = 11; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), fooMethod.Region.ToString()); - } - - [Test] - public void BarMethodBodyRegion() - { - int startLine = 4; - int startColumn = 12; - int endLine = 5; - int endColumn = 6; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), barMethod.BodyRegion.ToString()); - } - - /// - /// The method region needs to extend up just after the colon. It does not include the body. - /// - [Test] - public void BarMethodRegion() - { - int startLine = 4; - int startColumn = 1; - int endLine = 4; - int endColumn = 12; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), barMethod.Region.ToString()); - } - - [Test] - public void BarMethodHasOneParameter() - { - Assert.AreEqual(1, barMethod.Parameters.Count); - } - - [Test] - public void FooMethodTextInsideFoldIsFooMethodBody() - { - string textInsideFold = document.GetText(fooMethodFold.StartOffset, fooMethodFold.Length); - Assert.AreEqual("\r\n\tpass", textInsideFold); - } - - [Test] - public void BarMethodTextInsideFoldIsBarMethodBody() - { - string textInsideFold = document.GetText(barMethodFold.StartOffset, barMethodFold.Length); - Assert.AreEqual("\r\n\tpass", textInsideFold); - } - - [Test] - public void FooMethodCollapsedFoldTitleIsNull() - { - Assert.IsNull(fooMethodFold.Title); - } - - [Test] - public void BarMethodCollapsedFoldTitleIsNull() - { - Assert.IsNull(barMethodFold.Title); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseSingleClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseSingleClassTestFixture.cs deleted file mode 100644 index 3d4004fd3e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseSingleClassTestFixture.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests that the PythonParser class has a class in the returned - /// CompilationUnit. - /// - [TestFixture] - public class ParseSingleClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = "class Test:\r\n" + - "\tpass"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\Projects\Test\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void ClassName() - { - Assert.AreEqual("Test", c.Name); - } - - /// - /// The namespace of a class is the name of file containing the class excluding - /// the file extension. - /// - [Test] - public void FullyQualifiedClassName() - { - Assert.AreEqual("test.Test", c.FullyQualifiedName); - } - - [Test] - public void CompilationUnitFileName() - { - Assert.AreEqual(@"C:\Projects\Test\test.py", compilationUnit.FileName); - } - - [Test] - public void ClassBodyRegion() - { - int startLine = 1; - int startColumn = 12; - int endLine = 2; - int endColumn = 6; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - [Test] - public void ClassRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 2; - int endColumn = 6; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs deleted file mode 100644 index 63af947db8..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseTestClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = - "import unittest\r\n" + - "\r\n" + - "class simpleTest(unittest.TestCase):\r\n" + - " def testSuccess(self):\r\n" + - " assert True\r\n" + - "\r\n" + - " def testFailure(self):\r\n" + - " assert False\r\n" + - "\r\n"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.py", python); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void SimpleTestFirstBaseTypeIsUnitTestTestCase() - { - IReturnType baseType = c.BaseTypes[0]; - string actualBaseTypeName = baseType.FullyQualifiedName; - string expectedBaseTypeName = "unittest.TestCase"; - Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs deleted file mode 100644 index d9d224d25c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParseTestClassWithBaseClassTestFixture.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class ParseTestClassWithBaseClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - DefaultProjectContent projectContent; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string python = - "import unittest\r\n" + - "\r\n" + - "class BaseTest(unittest.TestCase):\r\n" + - " def testSuccess(self):\r\n" + - " assert True\r\n" + - "\r\n" + - "class DerivedTest(BaseTest):\r\n" + - " pass\r\n" + - "\r\n"; - - projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - string fileName = @"C:\test.py"; - compilationUnit = parser.Parse(projectContent, fileName, python); - projectContent.UpdateCompilationUnit(null, compilationUnit, fileName); - if (compilationUnit.Classes.Count > 1) { - c = compilationUnit.Classes[1]; - } - } - - [Test] - public void DerivedTestFirstBaseTypeIsBaseTestTestCase() - { - IReturnType baseType = c.BaseTypes[0]; - string actualBaseTypeName = baseType.FullyQualifiedName; - string expectedBaseTypeName = "test.BaseTest"; - Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName); - } - - [Test] - public void DerivedTestBaseClassNameIsBaseTest() - { - IClass baseClass = c.BaseClass; - string actualName = baseClass.FullyQualifiedName; - string expectedName = "test.BaseTest"; - Assert.AreEqual(expectedName, actualName); - } - - [Test] - public void ProjectContentGetClassReturnsBaseTest() - { - IClass c = projectContent.GetClass("test.BaseTest", 0); - Assert.AreEqual("test.BaseTest", c.FullyQualifiedName); - } - - [Test] - public void CompilationUnitUsingScopeNamespaceNameIsNamespaceTakenFromFileName() - { - string namespaceName = compilationUnit.UsingScope.NamespaceName; - string expectedNamespace = "test"; - Assert.AreEqual(expectedNamespace, namespaceName); - } - - [Test] - public void DerivedTestBaseClassHasTestCaseBaseClass() - { - IReturnType baseType = c.BaseTypes[0]; - IClass baseClass = baseType.GetUnderlyingClass(); - IReturnType baseBaseType = baseClass.BaseTypes[0]; - string actualBaseTypeName = baseBaseType.FullyQualifiedName; - string expectedBaseTypeName = "unittest.TestCase"; - Assert.AreEqual(expectedBaseTypeName, actualBaseTypeName); - } - - [Test] - public void CompilationUnitUsingScopeHasParentUsingScopeWithNamespaceNameOfEmptyString() - { - IUsingScope parentUsingScope = compilationUnit.UsingScope.Parent; - string namespaceName = parentUsingScope.NamespaceName; - Assert.AreEqual(String.Empty, namespaceName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs deleted file mode 100644 index e9d90b6141..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/ParserTestFixture.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Parsing -{ - /// - /// Tests the PythonParser. - /// - [TestFixture] - public class ParserTestFixture - { - PythonParser parser; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - parser = new PythonParser(); - } - - [Test] - public void CanParsePythonFileName() - { - Assert.IsTrue(parser.CanParse("test.py")); - } - - [Test] - public void CanParseTextFileName() - { - Assert.IsFalse(parser.CanParse("test.txt")); - } - - [Test] - public void CanParseNullFileName() - { - string fileName = null; - Assert.IsFalse(parser.CanParse(fileName)); - } - - [Test] - public void CanParseUpperCasePythonFileName() - { - Assert.IsTrue(parser.CanParse("TEST.PY")); - } - - [Test] - public void NoLexerTags() - { - Assert.AreEqual(0, parser.LexerTags.Length); - } - - [Test] - public void SetLexerTags() - { - PythonParser parser = new PythonParser(); - string[] tags = new string[] {"Test"}; - parser.LexerTags = tags; - - Assert.AreEqual(tags, parser.LexerTags); - } - - [Test] - public void LanguageProperties() - { - Assert.IsNotNull(parser.Language); - } - - [Test] - public void CannotParseNullProject() - { - IProject project = null; - Assert.IsFalse(parser.CanParse(project)); - } - - [Test] - public void CanParsePythonProject() - { - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - createInfo.OutputProjectFileName = @"C:\projects\test.pyproj"; - PythonProject project = new PythonProject(createInfo); - Assert.IsTrue(parser.CanParse(project)); - } - - [Test] - public void CannotParseNonPythonLanguageProject() - { - MockProject project = new MockProject(); - project.Language = "Test"; - Assert.IsFalse(parser.CanParse(project)); - } - - [Test] - public void ParseWithNullFileContent() - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - ICompilationUnit unit = parser.Parse(projectContent, null, (ICSharpCode.SharpDevelop.ITextBuffer)null); - Assert.IsInstanceOf(typeof(DefaultCompilationUnit), unit); - } - - [Test] - public void PythonExpressionFinderCreated() - { - IExpressionFinder expressionFinder = parser.CreateExpressionFinder(@"c:\Projects\test.py"); - Assert.IsInstanceOf(typeof(PythonExpressionFinder), expressionFinder); - } - - [Test] - public void Resolver() - { - Assert.IsInstanceOf(typeof(PythonResolver), parser.CreateResolver()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParseFieldTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParseFieldTests.cs deleted file mode 100644 index 44d8feab4d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParseFieldTests.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class PythonParserParseFieldTests - { - IClass myClass; - - void ParseCode(string code) - { - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - myClass = parseInfo.CompilationUnit.Classes[0]; - } - - [Test] - public void Parse_ClassHasOneFieldCalledCount_ReturnsParseInfoWithClassWithFieldCalledCount() - { - string code = - "class MyClass:\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - "\r\n"; - - ParseCode(code); - IField field = myClass.Fields[0]; - string name = field.Name; - string expectedName = "_count"; - - Assert.AreEqual(expectedName, name); - } - - [Test] - public void Parse_ClassFieldInitialisedTwice_ReturnsParseInfoWithClassWithOnlyOneField() - { - string code = - "class MyClass:\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - " self._count = 3\r\n" + - "\r\n"; - - ParseCode(code); - int howManyFields = myClass.Fields.Count; - int expectedNumberOfFields = 1; - - Assert.AreEqual(expectedNumberOfFields, howManyFields); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs deleted file mode 100644 index d1aba18cbd..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Parsing/PythonParserParsePropertyTests.cs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Parsing -{ - [TestFixture] - public class PythonParserParsePropertyTests - { - IProperty property; - - void ParseClassWithProperty() - { - string code = - "class MyClass:\r\n" + - " def __init__(self):\r\n" + - " self._count = 0\r\n" + - "\r\n" + - " def get_Count(self):\r\n" + - " return self._count\r\n" + - "\r\n" + - " def _set_Count(self, value):\r\n" + - " self._count = value\r\n" + - "\r\n" + - " Count = property(fget=get_Count, fset=set_Count)\r\n"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - property = parseInfo.CompilationUnit.Classes[0].Properties[0]; - } - - [Test] - public void Parse_ClassHasPropertyCalledCount_ReturnParseInfoWithClassWithPropertyCalledCount() - { - ParseClassWithProperty(); - string name = property.Name; - - string expectedName = "Count"; - - Assert.AreEqual(expectedName, name); - } - - /// - /// Dom regions are one based. - /// - [Test] - public void Parse_ClassHasPropertyCalledCount_PropertyRegion() - { - ParseClassWithProperty(); - DomRegion region = property.Region; - - DomRegion expectedRegion = new DomRegion( - beginLine: 11, - beginColumn: 5, - endLine: 11, - endColumn: 5 - ); - - Assert.AreEqual(expectedRegion, region); - } - - [Test] - public void Parse_ClassMethodHasNoPropertyButHasAssignmentStatementSetToValueFromFunctionCall_ParseInfoHasNoPropertyAdded() - { - string code = - "class MyClass:\r\n" + - " a = foo()\r\n" + - "\r\n"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - int count = parseInfo.CompilationUnit.Classes[0].Properties.Count; - - Assert.AreEqual(0, count); - } - - [Test] - public void Parse_ClassMethodHasNoPropertyButHasAssignmentStatementUsingMemberExpression_ParseInfoHasNoPropertyAddedAndNoExceptionThrown() - { - string code = - "class MyClass:\r\n" + - " a.b = foo()\r\n" + - "\r\n"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - int count = parseInfo.CompilationUnit.Classes[0].Properties.Count; - - Assert.AreEqual(0, count); - } - - [Test] - public void Parse_ClassMethodHasNoPropertyButHasAssignmentStatementSetToIntegerValue_ParseInfoHasNoPropertyAddedAndNoExceptionThrown() - { - string code = - "class MyClass:\r\n" + - " a = 1\r\n" + - "\r\n"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - int count = parseInfo.CompilationUnit.Classes[0].Properties.Count; - - Assert.AreEqual(0, count); - } - - [Test] - public void Parse_ClassMethodHasNoPropertyButHasAssignmentStatementSetToValueFromMemberExpressionCall_ParseInfoHasNoPropertyAddedAndNoExceptionThrown() - { - string code = - "class MyClass:\r\n" + - " a = foo.bar()\r\n" + - "\r\n"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - int count = parseInfo.CompilationUnit.Classes[0].Properties.Count; - - Assert.AreEqual(0, count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj deleted file mode 100644 index 2a94163f96..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj +++ /dev/null @@ -1,528 +0,0 @@ - - - - {23B517C9-1ECC-4419-A13F-0B7136D085CB} - Debug - AnyCPU - Library - PythonBinding.Tests - PythonBinding.Tests - False - False - 4 - false - v4.0 - - - ..\..\..\..\..\..\bin\UnitTests\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\..\bin\UnitTests\ - false - None - False - TRACE - False - - - False - Auto - 4194304 - x86 - 4096 - - - - - ..\..\RequiredLibraries\IronPython.dll - - - ..\..\RequiredLibraries\IronPython.Modules.dll - - - - - ..\..\RequiredLibraries\Microsoft.Dynamic.dll - - - ..\..\RequiredLibraries\Microsoft.Scripting.dll - - - ..\..\..\..\..\Tools\NUnit\nunit.framework.dll - False - - - 4.0 - - - 4.0 - - - - 4.0 - - - - - - - 4.0 - - - - 4.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PythonBinding.addin - - - - - - - - - - - - - - - - - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} - ICSharpCode.AvalonEdit - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - - - {7E4A7172-7FF5-48D0-B719-7CD959DD1AC9} - ICSharpCode.Core.Presentation - - - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288} - ICSharpCode.Core.WinForms - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - - - {8035765F-D51F-4A0C-A746-2FD100E19419} - ICSharpCode.SharpDevelop.Widgets - - - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181} - UnitTesting.Tests - - - {1F261725-6318-4434-A1B1-6C70CE4CD324} - UnitTesting - - - {0162E499-42D0-409B-AA25-EED21F75336B} - AvalonEdit.AddIn - - - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} - FormsDesigner - - - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD} - ICSharpCode.Scripting - - - {85C09AD8-183B-403A-869A-7226646218A9} - ICSharpCode.Scripting.Tests - - - {8D732610-8FC6-43BA-94C9-7126FD7FE361} - PythonBinding - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs deleted file mode 100644 index 654db06f6a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/CreateNewPythonProjectTestFixture.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Linq; -using System.Text; - -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.PythonLanguage -{ - /// - /// Tests the initial properties set in a newly created PythonProject. - /// - [TestFixture] - public class CreateNewPythonProjectTestFixture - { - ProjectCreateInformation info; - PythonProject project; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - - info = new ProjectCreateInformation(); - info.Solution = new Solution(new MockProjectChangeWatcher()); - info.ProjectName = "Test"; - info.OutputProjectFileName = @"C:\Projects\Test\Test.pyproj"; - info.RootNamespace = "Test"; - - project = new PythonProject(info); - } - - [Test] - public void Language() - { - Assert.AreEqual(PythonProjectBinding.LanguageName, project.Language); - } - - [Test] - public void Name() - { - Assert.AreEqual(info.ProjectName, project.Name); - } - - [Test] - public void Imports() - { - string[] paths = GetImportPaths(); - Assert.Contains(PythonProject.DefaultTargetsFile, paths, "Could not find Python default target. Actual imports: " + GetArrayAsString(paths)); - // using MSBuild.Construction, we only see the direct imports - //Assert.Contains(@"$(MSBuildBinPath)\Microsoft.Common.targets", paths, "Could not find Microsoft.Common.targets. Actual imports: " + GetArrayAsString(paths)); - } - - [Test] - public void ProjectLanguageProperties() - { - Assert.AreEqual(PythonLanguageProperties.Default, project.LanguageProperties); - } - - [Test] - public void DefaultItemTypeForPythonFileNameIsCompile() - { - Assert.AreEqual(ItemType.Compile, project.GetDefaultItemType(".py")); - } - - [Test] - public void DefaultItemTypeForUpperCasePythonFileNameIsCompile() - { - Assert.AreEqual(ItemType.Compile, project.GetDefaultItemType(".PY")); - } - - [Test] - public void DefaultItemTypeForNullPythonFileNameIsCompile() - { - Assert.AreEqual(ItemType.None, project.GetDefaultItemType(null)); - } - - /// - /// Gets the import paths from the project. - /// - string[] GetImportPaths() - { - lock (project.SyncRoot) { - return project.MSBuildProjectFile.Imports.Select(i=>i.Project).ToArray(); - } - } - - /// - /// Takes the import paths in the project and creates a string with each import - /// on a new line. - /// - string GetImportPathsAsText() - { - return GetArrayAsString(GetImportPaths()); - } - - string GetArrayAsString(string[] array) - { - StringBuilder text = new StringBuilder(); - foreach (string item in array) { - text.AppendLine(item); - } - return text.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs deleted file mode 100644 index cd7ac1bdc7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/ProjectBindingTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.PythonLanguage -{ - /// - /// Tests the PythonProjectBinding class. - /// - [TestFixture] - public class ProjectBindingTestFixture - { - PythonProjectBinding projectBinding; - PythonProject project; - - [TestFixtureSetUp] - public void SetUpFixture() - { - projectBinding = new PythonProjectBinding(); - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.ProjectName = "Python"; - createInfo.OutputProjectFileName = @"C:\Projects\Python.pyproj"; - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - project = projectBinding.CreateProject(createInfo) as PythonProject; - } - - [Test] - public void Language() - { - Assert.AreEqual("Python", projectBinding.Language); - } - - [Test] - public void IsPythonProject() - { - Assert.IsNotNull(project); - } - - [Test] - public void ProjectName() - { - Assert.AreEqual("Python", project.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguageBindingTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguageBindingTestFixture.cs deleted file mode 100644 index e018146706..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguageBindingTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using NUnit.Framework; - -namespace PythonBinding.Tests.PythonLanguage -{ - [TestFixture] - public class PythonLanguageBindingTestFixture - { - PythonLanguageBinding languageBinding; - - [SetUp] - public void Init() - { - languageBinding = new PythonLanguageBinding(); - } - - [Test] - public void FormattingStrategyIsPythonFormattingStrategy() - { - Assert.IsInstanceOf(typeof(PythonFormattingStrategy), languageBinding.FormattingStrategy); - } - - [Test] - public void ImplementsILanguageBinding() - { - Assert.IsNotNull(languageBinding as ILanguageBinding); - } - - [Test] - public void LanguagePropertiesIsPythonLanguageProperties() - { - Assert.IsInstanceOf(typeof(PythonLanguageProperties), languageBinding.Properties); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs deleted file mode 100644 index d38cc4c380..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonLanguage/PythonLanguagePropertiesTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.PythonLanguage -{ - [TestFixture] - public class PythonLanguagePropertiesTests - { - [Test] - public void HasCodeDomProvider() - { - Assert.IsNotNull(PythonLanguageProperties.Default.CodeDomProvider); - } - - [Test] - public void AllowObjectConstructionOutsideContextReturnsTrueToEnableMethodInsightForConstructors() - { - Assert.IsTrue(PythonLanguageProperties.Default.AllowObjectConstructionOutsideContext); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ImportModuleResolveResultTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ImportModuleResolveResultTests.cs deleted file mode 100644 index 6cf70a3837..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ImportModuleResolveResultTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ImportModuleResolveResultTests - { - [Test] - public void Name_ExpressionIsImportFollowedByName_MatchesNameAfterImport() - { - PythonImportExpression expression = new PythonImportExpression("import abc"); - PythonImportModuleResolveResult result = new PythonImportModuleResolveResult(expression); - string expectedName = "abc"; - Assert.AreEqual(expectedName, result.Name); - } - - [Test] - public void GetCompletionData_WhenImportNameIsEmptyString_ReturnsStandardMathPythonModule() - { - PythonImportExpression expression = new PythonImportExpression(String.Empty); - PythonImportModuleResolveResult result = new PythonImportModuleResolveResult(expression); - MockProjectContent projectContent = new MockProjectContent(); - - List completionItems = result.GetCompletionData(projectContent); - NamespaceEntry mathNamespaceCompletionItem = new NamespaceEntry("math"); - Assert.Contains(mathNamespaceCompletionItem, completionItems); - } - - [Test] - public void GetCompletionData_ClonedPythonModuleResult_ReturnsSameCompletionItems() - { - PythonImportExpression expression = new PythonImportExpression(String.Empty); - PythonImportModuleResolveResult result = new PythonImportModuleResolveResult(expression); - ResolveResult clonedResult = result.Clone(); - MockProjectContent projectContent = new MockProjectContent(); - - List completionItems = clonedResult.GetCompletionData(projectContent); - NamespaceEntry mathNamespaceCompletionItem = new NamespaceEntry("math"); - Assert.Contains(mathNamespaceCompletionItem, completionItems); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/InvalidResolveInputsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/InvalidResolveInputsTestFixture.cs deleted file mode 100644 index 1595eb0485..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/InvalidResolveInputsTestFixture.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that the PythonResolver.Resolve method handles - /// invalid input parameters. - /// - [TestFixture] - public class InvalidResolveInputsTestFixture - { - static readonly ParseInformation emptyParseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - - PythonResolver resolver; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - } - - [Test] - public void NullFileContent() - { - ExpressionResult result = new ExpressionResult("test", new DomRegion(0, 0), null, null); - Assert.IsNull(resolver.Resolve(result, emptyParseInfo, null)); - } - - [Test] - public void EmptyFileContent() - { - ExpressionResult result = new ExpressionResult("test", new DomRegion(0, 0), null, null); - Assert.IsNull(resolver.Resolve(result, emptyParseInfo, String.Empty)); - } - - [Test] - public void NullParseInfo() - { - ExpressionResult result = new ExpressionResult("test", new DomRegion(0, 0), null, null); - Assert.IsNull(resolver.Resolve(result, null, "test")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/MemberNameTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/MemberNameTests.cs deleted file mode 100644 index 19f4f7bd4c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/MemberNameTests.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class MemberNameTests - { - [Test] - public void MemberNameIsEqualReturnsTrueWhenNameAndTypeAreSame() - { - MemberName lhs = new MemberName("type", "member"); - MemberName rhs = new MemberName("type", "member"); - - Assert.IsTrue(lhs.Equals(rhs)); - } - - [Test] - public void MemberNameIsEqualsReturnsFalseWhenMemberNameIsNull() - { - MemberName lhs = new MemberName("type", "Member"); - Assert.IsFalse(lhs.Equals(null)); - } - - [Test] - public void MemberNamePropertyReturnsMemberName() - { - MemberName methodName = new MemberName("type", "method"); - Assert.AreEqual("method", methodName.Name); - } - - [Test] - public void MemberNameTypePropertyReturnsType() - { - MemberName methodName = new MemberName("type", "method"); - Assert.AreEqual("type", methodName.Type); - } - - [Test] - public void MemberNameIsEqualReturnsFalseWhenMemberNameIsDifferent() - { - MemberName lhs = new MemberName("type", "method1"); - MemberName rhs = new MemberName("type", "method2"); - - Assert.IsFalse(lhs.Equals(rhs)); - } - - [Test] - public void MemberNameIsEqualReturnsFalseWhenTypeNameIsDifferent() - { - MemberName lhs = new MemberName("type1", "method"); - MemberName rhs = new MemberName("type2", "method"); - - Assert.IsFalse(lhs.Equals(rhs)); - } - - [Test] - public void MemberNameToStringShowsTypeNameAndMemberName() - { - MemberName methodName = new MemberName("type", "method"); - string expectedText = "Type: type, Member: method"; - Assert.AreEqual(expectedText, methodName.ToString()); - } - - [Test] - public void CreateMemberNameWithNullStringReturnsMemberNameWithEmptyTypeAndMemberName() - { - MemberName methodName = new MemberName(null); - MemberName expectedMemberName = new MemberName(String.Empty, String.Empty); - Assert.AreEqual(expectedMemberName, methodName); - } - - [Test] - public void CreateMemberNameWithEmptyStringReturnsMemberNameWithEmptyTypeAndMemberName() - { - MemberName methodName = new MemberName(String.Empty); - MemberName expectedMemberName = new MemberName(String.Empty, String.Empty); - Assert.AreEqual(expectedMemberName, methodName); - } - - [Test] - public void CreateMemberNameWithSystemDotConsoleDotWriteLineReturnsMemberNameWriteLineAndTypeNameSystemDotConsole() - { - MemberName methodName = new MemberName("System.Console.WriteLine"); - MemberName expectedMemberName = new MemberName("System.Console", "WriteLine"); - - Assert.AreEqual(expectedMemberName, methodName); - } - - [Test] - public void CreateMemberNameWithExpressionWithoutDotCharReturnsMemberNameOfEmptyStringAndExpressionAsTypeName() - { - MemberName methodName = new MemberName("test"); - MemberName expectedMemberName = new MemberName("test", String.Empty); - Assert.AreEqual(expectedMemberName, methodName); - } - - [Test] - public void HasNameReturnsFalseForMemberNameWithEmptyStringForMemberName() - { - MemberName memberName = new MemberName("System", String.Empty); - Assert.IsFalse(memberName.HasName); - } - - [Test] - public void HasNameReturnsTrueForMemberNameWithNonEmptyStringForMemberName() - { - MemberName memberName = new MemberName("System", "Console"); - Assert.IsTrue(memberName.HasName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableAssignmentTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableAssignmentTests.cs deleted file mode 100644 index b7cde83fd1..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableAssignmentTests.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class PythonLocalVariableAssignmentTests - { - [Test] - public void TypeName_CallExpressionTargetIsNotNameOrMemberExpression_ReturnsEmptyStringAndDoesNotGetStuckInInfiniteLoop() - { - string code = "a = 2"; - AssignmentStatement statement = PythonParserHelper.GetAssignmentStatement(code); - Expression constantExpression = statement.Right; - - CallExpression callExpression = new CallExpression(constantExpression, new Arg[0]); - List expressions = new List(statement.Left); - statement = new AssignmentStatement(expressions.ToArray(), callExpression); - - PythonLocalVariableAssignment localVariableAssignment = new PythonLocalVariableAssignment(statement); - string typeName = localVariableAssignment.TypeName; - - Assert.AreEqual(String.Empty, typeName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableResolverTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableResolverTests.cs deleted file mode 100644 index a47830c330..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonLocalVariableResolverTests.cs +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class PythonLocalVariableResolverTests - { - string typeName; - - PythonLocalVariableResolver CreateResolver() - { - PythonClassResolver classResolver = new PythonClassResolver(); - return new PythonLocalVariableResolver(classResolver); - } - - void Resolve(string variableName, string code) - { - PythonLocalVariableResolver resolver = CreateResolver(); - typeName = resolver.Resolve(variableName, code); - } - - [Test] - public void Resolve_InstanceCreatedInCode_ReturnsInstanceType() - { - string code = "a = Class1()"; - Resolve("a", code); - string expectedTypeName = "Class1"; - - Assert.AreEqual(expectedTypeName, typeName); - } - - /// - /// Tests that the NameExpression in the resolver is reset so the second assignment - /// does not override the first. - /// - [Test] - public void Resolve_TwoInstancesCreatedInCode_ReturnsFirstInstanceType() - { - string code = - "a = Class1()\r\n" + - "b = Class2()"; - - Resolve("a", code); - string expectedTypeName = "Class1"; - - Assert.AreEqual(expectedTypeName, typeName); - } - - [Test] - public void Resolve_VariableIsAssignedToString_ReturnsNull() - { - string code = "a = \"test\""; - Resolve("a", code); - - Assert.IsNull(typeName); - } - - [Test] - public void Resolve_CodeIsNull_ReturnsNull() - { - Resolve("a", null); - - Assert.IsNull(typeName); - } - - [Test] - public void Resolve_InstanceCreatedWithNamespace_ReturnsFullyQualifiedTypeName() - { - string code = "a = Test.Class1()"; - Resolve("a", code); - string expectedTypeName = "Test.Class1"; - - Assert.AreEqual(expectedTypeName, typeName); - } - - [Test] - public void Resolve_InstanceCreatedWithTwoPartsToNamespace_ReturnsFullyQualifiedTypeName() - { - string code = "a = Root.Test.Class1()"; - Resolve("a", code); - string expectedTypeName = "Root.Test.Class1"; - - Assert.AreEqual(expectedTypeName, typeName); - } - - [Test] - public void Resolve_AssignmentToPropertyOnLocalVariableThenMethodCallOnLocalVariable_CorrectLocalVariableTypeReturned() - { - string code = - "connection = OracleClient.OracleConnection()\r\n" + - "connection.ConnectionString = connectionString\r\n" + - "connection.Open()\r\n" + - "connection"; - - Resolve("connection", code); - - Assert.AreEqual("OracleClient.OracleConnection", typeName); - } - - [Test] - public void Resolve_CalledTwiceFirstCallResolvesTypeNameSecondCallDoesNotResolve_ReturnsNull() - { - string code = "a = Class1()"; - - PythonLocalVariableResolver resolver = CreateResolver(); - resolver.Resolve("a", code); - string typeName = resolver.Resolve("b", code); - - Assert.IsNull(typeName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonSelfResolverTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonSelfResolverTests.cs deleted file mode 100644 index 2c7a053f82..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/PythonSelfResolverTests.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class PythonSelfResolverTests - { - PythonSelfResolver resolver; - ExpressionResult expression; - ParseInformation parseInfo; - PythonResolverContext context; - - [Test] - public void Resolve_NoCallingClass_ReturnsNull() - { - CreatePythonSelfResolver(); - CreateParseInfo(); - CreatePythonResolverContext(); - - ResolveResult result = resolver.Resolve(context); - Assert.IsNull(result); - } - - void CreatePythonSelfResolver() - { - resolver = new PythonSelfResolver(); - } - - void CreateParseInfo() - { - MockProjectContent projectContent = new MockProjectContent(); - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - parseInfo = new ParseInformation(unit); - } - - void CreatePythonResolverContext() - { - expression = new ExpressionResult("self"); - context = new PythonResolverContext(parseInfo, expression, String.Empty); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveBuiltInRoundMethodTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveBuiltInRoundMethodTests.cs deleted file mode 100644 index 110f52093b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveBuiltInRoundMethodTests.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveBuiltInRoundMethodTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("round", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "round\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsRound() - { - Assert.AreEqual("round", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - - [Test] - public void ResolveResultContainingTypeHasFourRoundMethods() - { - List exitMethods = GetRoundMethods(); - Assert.AreEqual(4, exitMethods.Count); - } - - List GetRoundMethods() - { - return GetRoundMethods(-1); - } - - List GetRoundMethods(int parameterCount) - { - List methods = MethodResolveResult.ContainingType.GetMethods(); - return PythonCompletionItemsHelper.FindAllMethodsFromCollection("round", parameterCount, methods.ToArray()); - } - - [Test] - public void BothRoundMethodsArePublic() - { - foreach (IMethod method in GetRoundMethods()) { - Assert.IsTrue(method.IsPublic); - } - } - - [Test] - public void BothRoundMethodsHaveClassWithNameOfSys() - { - foreach (IMethod method in GetRoundMethods()) { - Assert.AreEqual("__builtin__", method.DeclaringType.Name); - } - } - - [Test] - public void ThreeRoundMethodsHaveTwoParameters() - { - int parameterCount = 2; - Assert.AreEqual(3, GetRoundMethods(parameterCount).Count); - } - - [Test] - public void RoundMethodParameterNameIsNumber() - { - IParameter parameter = GetFirstRoundMethodParameter(); - Assert.AreEqual("number", parameter.Name); - } - - IParameter GetFirstRoundMethodParameter() - { - int parameterCount = 1; - List methods = GetRoundMethods(parameterCount); - IMethod method = methods[0]; - return method.Parameters[0]; - } - - [Test] - public void RoundMethodParameterReturnTypeIsDouble() - { - IParameter parameter = GetFirstRoundMethodParameter(); - Assert.AreEqual("Double", parameter.ReturnType.Name); - } - - [Test] - public void RoundMethodParameterConvertedToStringUsingAmbienceReturnsDoubleNumberString() - { - IAmbience ambience = new CSharpAmbience(); - string text = ambience.Convert(GetFirstRoundMethodParameter()); - Assert.AreEqual("double number", text); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassEventTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassEventTests.cs deleted file mode 100644 index aa9605277f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassEventTests.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests resolving events for the following classes: - /// - /// public class MyClass - /// { - /// public event EventHandler MyEvent; - /// } - /// - /// - [TestFixture] - public class ResolveClassEventTests - { - PythonResolverTestsHelper resolverHelper; - IEvent myClassEvent; - MockClass myClass; - IProperty eventHandlerTargetProperty; - - void CreateClassWithOneEvent() - { - // Define imports. - string code = - "from MyNamespace import MyClass"; - - resolverHelper = new PythonResolverTestsHelper(code); - myClass = resolverHelper.CreateClass("MyClass"); - myClassEvent = myClass.AddEvent("MyEvent"); - - AddEventHandlerClass(); - - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyNamespace.MyClass", myClass); - } - - void AddEventHandlerClass() - { - MockClass eventHandlerClass = resolverHelper.CreateClass("EventHandler"); - eventHandlerTargetProperty = eventHandlerClass.AddProperty("Target"); - myClassEvent.ReturnType = new DefaultReturnType(eventHandlerClass); - } - - [Test] - public void Resolve_ExpressionIsForEventOnClass_MemberResolveResultResolvedTypeIsClassEvent() - { - CreateClassWithOneEvent(); - resolverHelper.Resolve("MyClass.MyEvent"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(myClassEvent, resolvedMember); - } - - [Test] - public void Resolve_ExpressionIsForSecondEventOnClass_MemberResolveResultResolvedTypeIsSecondEvent() - { - CreateClassWithOneEvent(); - IEvent secondEvent = myClass.AddEvent("SecondEvent"); - resolverHelper.Resolve("MyClass.SecondEvent"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(secondEvent, resolvedMember); - } - - [Test] - public void Resolve_ExpressionIsForEventHandlerTargetProperty_MemberResolveResultResolvedTypeIsEventHandlerTargetProperty() - { - CreateClassWithOneEvent(); - resolverHelper.Resolve("MyClass.MyEvent.Target"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(eventHandlerTargetProperty, resolvedMember); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassFieldTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassFieldTests.cs deleted file mode 100644 index fd66cbffbb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassFieldTests.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests resolving events for the following classes: - /// - /// public class MyClass - /// { - /// public int MyField - /// } - /// - /// public class MyClassWithFields - /// { - /// public int MyField = 0; - /// } - /// - /// - [TestFixture] - public class ResolveClassFieldTests - { - PythonResolverTestsHelper resolverHelper; - IField myClassField; - MockClass myClass; - - void CreateClassWithOneEvent() - { - resolverHelper = new PythonResolverTestsHelper(); - myClass = resolverHelper.CreateClass("MyClass"); - myClassField = myClass.AddField("MyField"); - - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass); - } - - [Test] - public void Resolve_ExpressionIsForFieldOnClass_MemberResolveResultResolvedTypeIsClassField() - { - CreateClassWithOneEvent(); - resolverHelper.Resolve("MyClass.MyField"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(myClassField, resolvedMember); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassPropertyTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassPropertyTests.cs deleted file mode 100644 index dcd171d97c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveClassPropertyTests.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests resolving properties for the following classes: - /// - /// public class MyClass - /// { - /// public MyNestedPropertyClass MyProperty { get; set; } - /// } - /// - /// public class MyNestedPropertyClass - /// { - /// public object MyNestedProperty { get; set; } - /// } - /// - /// - [TestFixture] - public class ResolveClassPropertyTests - { - PythonResolverTestsHelper resolverHelper; - IProperty myClassProperty; - MockClass myClass; - IProperty nestedClassProperty; - - void CreateClassWithOneProperty() - { - resolverHelper = new PythonResolverTestsHelper(); - myClass = resolverHelper.CreateClass("MyClass"); - myClassProperty = myClass.AddProperty("MyProperty"); - - AddNestedPropertyToExistingProperty(); - - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass); - } - - void AddNestedPropertyToExistingProperty() - { - MockClass nestedPropertyClass = resolverHelper.CreateClass("MyNestedPropertyClass"); - nestedClassProperty = nestedPropertyClass.AddProperty("MyNestedProperty"); - myClassProperty.ReturnType = new DefaultReturnType(nestedPropertyClass); - } - - [Test] - public void Resolve_ExpressionIsForPropertyOnClassWithOneProperty_MemberResolveResultResolvedTypeIsMyClassProperty() - { - CreateClassWithOneProperty(); - resolverHelper.Resolve("MyClass.MyProperty"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(myClassProperty, resolvedMember); - } - - [Test] - public void Resolve_ExpressionIsForSecondPropertyOnClassWithTwoProperties_MemberResolveResultResolvedTypeIsSecondClassProperty() - { - CreateClassWithOneProperty(); - myClass.InsertPropertyAtStart("ExtraProperty"); - resolverHelper.Resolve("MyClass.MyProperty"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(myClassProperty, resolvedMember); - } - - [Test] - public void Resolve_ExpressionRefersToNestedProperty_MemberResolveResultResolvedTypeIsNestedProperty() - { - CreateClassWithOneProperty(); - AddNestedPropertyToExistingProperty(); - resolverHelper.Resolve("MyClass.MyProperty.MyNestedProperty"); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(nestedClassProperty, resolvedMember); - } - - [Test] - public void Resolve_ExpressionIsForPropertyOnLocalVariable_MemberResolveResultResolvedTypeIsMyClassProperty() - { - CreateClassWithOneProperty(); - string code = - "a = MyClass()\r\n" + - "a.MyProperty"; - - resolverHelper.Resolve("a.MyProperty", code); - IMember resolvedMember = resolverHelper.MemberResolveResult.ResolvedMember; - - Assert.AreEqual(myClassProperty, resolvedMember); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTests.cs deleted file mode 100644 index 24dd42bbd7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveConsoleWriteLineTests.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that the expression "Console.WriteLine" is correctly - /// resolved. - /// - [TestFixture] - public class ResolveConsoleWriteLineTests : ResolveTestsBase - { - MockClass systemConsoleClass; - - protected override ExpressionResult GetExpressionResult() - { - systemConsoleClass = new MockClass(projectContent, "System.Console"); - systemConsoleClass.AddMethod("WriteLine"); - projectContent.SetClassToReturnFromGetClass("Console", systemConsoleClass); - return new ExpressionResult("Console.WriteLine", new DomRegion(2, 2), null, null); - } - - protected override string GetPythonScript() - { - return - "import System\r\n" + - "Console.WriteLine\r\n"; - } - - /// - /// Gets the class name used in IProjectContent.GetClass call. - /// - [Test] - public void Resolve_ExpressionIsSystemConsoleWriteLine_ProjectContentGetClassNamePassedConsole() - { - string className = projectContent.GetClassName; - Assert.AreEqual("Console", className); - } - - [Test] - public void Resolve_ExpressionIsSystemConsoleWriteLine_MethodNameResolvedIsWriteLine() - { - MethodGroupResolveResult methodResolveResult = (MethodGroupResolveResult)resolveResult; - string name = methodResolveResult.Name; - string expectedName = "WriteLine"; - Assert.AreEqual(expectedName, name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitAsMyExitTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitAsMyExitTests.cs deleted file mode 100644 index 3fe282bb65..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitAsMyExitTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveExitMethodFromSysImportExitAsMyExitTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("myexit", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from sys import exit as myexit\r\n" + - "myexit\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsExit() - { - Assert.AreEqual("exit", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitTestFixture.cs deleted file mode 100644 index 0c002def17..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveExitMethodFromSysImportExitTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveExitMethodFromSysImportExitTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("exit", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from sys import exit\r\n" + - "exit\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsExit() - { - Assert.AreEqual("exit", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - - [Test] - public void ResolveResultContainingTypeHasTwoExitMethods() - { - List exitMethods = GetExitMethods(); - Assert.AreEqual(2, exitMethods.Count); - } - - List GetExitMethods() - { - List methods = MethodResolveResult.ContainingType.GetMethods(); - return PythonCompletionItemsHelper.FindAllMethodsFromCollection("exit", -1, methods.ToArray()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooWindowsWithImportSystemAsFooTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooWindowsWithImportSystemAsFooTests.cs deleted file mode 100644 index 91cd41279c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFooWindowsWithImportSystemAsFooTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveFooWindowsWithImportSystemAsFooTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockProjectContent referencedContent = new MockProjectContent(); - List namespaceItems = new List(); - referencedContent.AddExistingNamespaceContents("System.Windows.Forms", namespaceItems); - projectContent.ReferencedContents.Add(referencedContent); - - return new ExpressionResult("Foo.Windows"); - } - - protected override string GetPythonScript() - { - return - "import System as Foo\r\n" + - "Foo.Windows\r\n"; - } - - NamespaceResolveResult NamespaceResolveResult { - get { return resolveResult as NamespaceResolveResult; } - } - - [Test] - public void NamespaceResolveResultHasSystemWindowsNamespace() - { - Assert.AreEqual("System.Windows", NamespaceResolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromImportTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromImportTests.cs deleted file mode 100644 index 72e7eef54a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromImportTests.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that the PythonResolver resolves "from System" to - /// a namespace. - /// - [TestFixture] - public class ResolveFromImportTestFixture - { - PythonResolver resolver; - MockProjectContent mockProjectContent; - PythonImportModuleResolveResult resolveResult; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - - mockProjectContent = new MockProjectContent(); - DefaultCompilationUnit cu = new DefaultCompilationUnit(mockProjectContent); - cu.FileName = @"C:\Projects\Test\test.py"; - ParseInformation parseInfo = new ParseInformation(cu); - - string python = "from System"; - PythonExpressionFinder finder = new PythonExpressionFinder(); - ExpressionResult expressionResult = finder.FindExpression(python, python.Length); - resolveResult = resolver.Resolve(expressionResult, parseInfo, python) as PythonImportModuleResolveResult; - } - - [Test] - public void NamespaceResolveResultFound() - { - Assert.IsNotNull(resolveResult); - } - - [Test] - public void NamespaceName() - { - Assert.AreEqual("System", resolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromMathImportedMathModuleCompletionItemsTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromMathImportedMathModuleCompletionItemsTests.cs deleted file mode 100644 index 85506c33b4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromMathImportedMathModuleCompletionItemsTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveFromMathImportedMathModuleCompletionItemsTestFixture : ResolveTestsBase - { - List GetCompletionResults() - { - return resolveResult.GetCompletionData(projectContent); - } - - protected override ExpressionResult GetExpressionResult() - { - string code = GetPythonScript(); - PythonExpressionFinder finder = new PythonExpressionFinder(); - return finder.FindExpression(code, code.Length); - } - - protected override string GetPythonScript() - { - return "from math import"; - } - - [Test] - public void CompletionResultsContainCosMethodFromMathModule() - { - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("cos", GetCompletionResults()); - Assert.IsNotNull(method); - } - - [Test] - public void ExpressionResultContextShowItemReturnsTrueForIMethod() - { - MockProjectContent projectContent = new MockProjectContent(); - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - DefaultClass c = new DefaultClass(unit, "MyClass"); - DefaultMethod method = new DefaultMethod(c, "Test"); - - Assert.IsTrue(expressionResult.Context.ShowEntry(method)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromSystemImportEverythingTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromSystemImportEverythingTests.cs deleted file mode 100644 index cce211640c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveFromSystemImportEverythingTests.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveFromSystemImportEverythingTests : ResolveTestsBase - { - MockClass consoleClass; - - protected override ExpressionResult GetExpressionResult() - { - consoleClass = new MockClass(projectContent, "System.Console"); - projectContent.SetClassToReturnFromGetClass("System.Console", consoleClass); - - List namespaceItems = new List(); - projectContent.AddExistingNamespaceContents("System", namespaceItems); - - return new ExpressionResult("Console", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from System import *\r\n" + - "Console\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultResolvedClassIsConsoleClass() - { - Assert.AreEqual(consoleClass, TypeResolveResult.ResolvedClass); - } - - TypeResolveResult TypeResolveResult { - get { return (TypeResolveResult)resolveResult; } - } - - [Test] - public void ProjectContentNamespaceExistsReturnsTrueForSystem() - { - Assert.IsTrue(projectContent.NamespaceExists("System")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveImportsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveImportsTestFixture.cs deleted file mode 100644 index 541d16620b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveImportsTestFixture.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests the PythonResolver returns the correct namespaces for - /// an import statement when the user presses Ctrl+Space. - /// - [TestFixture] - public class ResolveImportsTestFixture - { - List results; - PythonResolver resolver; - MockProjectContent mockProjectContent; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - mockProjectContent = new MockProjectContent(); - List namespaceItems = new List(); - namespaceItems.Add(new NamespaceEntry("Test")); - mockProjectContent.AddExistingNamespaceContents(String.Empty, namespaceItems); - - ParseInformation parseInfo = new ParseInformation(new DefaultCompilationUnit(mockProjectContent)); - - results = resolver.CtrlSpace(0, "import".Length, parseInfo, "import", ExpressionContext.Namespace); - } - - [Test] - public void NamespaceName() - { - Assert.AreEqual(String.Empty, mockProjectContent.NamespacePassedToGetNamespaceContentsMethod); - } - - [Test] - public void TestNamespaceAdded() - { - Assert.Contains(new NamespaceEntry("Test"), results); - } - - [Test] - public void ContainsSysModule() - { - Assert.Contains(new NamespaceEntry("sys"), results); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTests.cs deleted file mode 100644 index cc6a543d55..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalClassInstanceTests.cs +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Given code: - /// - /// a = Class1() - /// - /// Check that the type of "a" can be obtained by the resolver. - /// - [TestFixture] - public class ResolveLocalClassInstanceTests - { - PythonResolverTestsHelper resolverHelper; - MockClass testClass; - - void CreateResolver() - { - CreateResolver(String.Empty); - } - - void CreateResolver(string code) - { - resolverHelper = new PythonResolverTestsHelper(code); - - testClass = resolverHelper.CreateClass("Test.Test1"); - resolverHelper.ProjectContent.ClassesInProjectContent.Add(testClass); - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("Test.Test1", testClass); - } - - [Test] - public void Resolve_LocalVariableIsCreatedOnPreviousLine_ResolveResultVariableNameIsA() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a"; - - resolverHelper.Resolve("a", python); - - string name = resolverHelper.LocalResolveResult.VariableName; - - Assert.AreEqual("a", name); - } - - [Test] - public void Resolve_LocalVariableIsCreatedOnPreviousLine_ResolveResultResolvedTypeIsTestClass() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a"; - - resolverHelper.Resolve("a", python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(testClass, underlyingClass); - } - - [Test] - public void Resolve_LocalVariableIsReDefinedAfterLineBeingConsidered_ResolveResultResolvedTypeIsTestClass() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a\r\n" + - "a = Unknown.Unknown()\r\n"; - - ExpressionResult expression = new ExpressionResult("a"); - expression.Region = new DomRegion( - beginLine: 2, - beginColumn: 0, - endLine: 2, - endColumn: 1); - - resolverHelper.Resolve(expression, python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(testClass, underlyingClass); - } - - [Test] - public void Resolve_LocalVariableIsReDefinedAfterLineBeingConsideredAndExpressionRegionEndLineIsMinusOne_ResolveResultResolvedTypeIsTestClass() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a\r\n" + - "a = Unknown.Unknown()\r\n"; - - ExpressionResult expression = new ExpressionResult("a"); - expression.Region = new DomRegion( - beginLine: 2, - beginColumn: 0, - endLine: -1, - endColumn: 1); - - resolverHelper.Resolve(expression, python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(testClass, underlyingClass); - } - - [Test] - public void Resolve_LocalVariableTypeIsImported_ResolveResultResolvedTypeDeterminedFromImportedTypes() - { - string python = - "from MyNamespace import MyClass\r\n" + - "\r\n" + - "a = MyClass()\r\n" + - "a"; - - CreateResolver(python); - - MockClass myClass = resolverHelper.CreateClass("MyNamespace.MyClass"); - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyNamespace.MyClass", myClass); - - resolverHelper.Resolve("a", python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(myClass, underlyingClass); - } - - [Test] - public void Resolve_LocalVariableMethodIsCalledOnPreviousLine_ResolveResultResolvedTypeIsTestClass() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a.foo()\r\n" + - "a"; - - resolverHelper.Resolve("a", python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(testClass, underlyingClass); - } - - [Test] - public void Resolve_LocalVariableMethodIsCalledAfterVariableOnItsOwnOnPreviousLine_ResolveResultResolvedTypeIsTestClass() - { - CreateResolver(); - - string python = - "a = Test.Test1()\r\n" + - "a\r\n" + - "a.foo()\r\n"; - - resolverHelper.Resolve("a", python); - - IReturnType resolvedType = resolverHelper.LocalResolveResult.ResolvedType; - IClass underlyingClass = resolvedType.GetUnderlyingClass(); - - Assert.AreEqual(testClass, underlyingClass); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalVariableMethodTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalVariableMethodTests.cs deleted file mode 100644 index 57adc7215d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveLocalVariableMethodTests.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveLocalVariableMethodTests - { - PythonResolverTestsHelper resolverHelper; - MockClass myClass; - - void CreateClassWithOneProperty() - { - resolverHelper = new PythonResolverTestsHelper(); - myClass = resolverHelper.CreateClass("MyClass"); - myClass.AddMethod("MyMethod"); - - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass); - } - - [Test] - public void Resolve_ExpressionIsForMethodOnLocalVariable_MethodGroupResolveResultNameIsMethodName() - { - CreateClassWithOneProperty(); - string code = - "a = MyClass()\r\n" + - "a.MyMethod"; - - resolverHelper.Resolve("a.MyMethod", code); - string methodName = resolverHelper.MethodGroupResolveResult.Name; - string expectedMethodName = "MyMethod"; - - Assert.AreEqual(expectedMethodName, methodName); - } - - [Test] - public void Resolve_ExpressionIsForMethodOnLocalVariable_MethodGroupResolveResultContainingTypeUnderlyingClassIsMyClass() - { - CreateClassWithOneProperty(); - string code = - "a = MyClass()\r\n" + - "a.MyMethod"; - - resolverHelper.Resolve("a.MyMethod", code); - IClass c = resolverHelper.MethodGroupResolveResult.ContainingType.GetUnderlyingClass(); - - Assert.AreEqual(myClass, c); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMemberWhenFieldHasNoReturnTypeTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMemberWhenFieldHasNoReturnTypeTests.cs deleted file mode 100644 index 3f9dd3f391..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMemberWhenFieldHasNoReturnTypeTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; - -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTestingUtils = UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveMemberWhenFieldHasNoReturnTypeTests - { - [Test] - public void Resolve_FieldHasNoReturnType_DoesNotThrowNullReferenceException() - { - MockProjectContent projectContent = new MockProjectContent(); - UnitTestingUtils.MockClass c = new UnitTestingUtils.MockClass(projectContent, "Test"); - projectContent.SetClassToReturnFromGetClass("self", c); - DefaultField field = c.AddField("randomNumber"); - field.ReturnType = null; - ParseInformation parseInfo = new ParseInformation(c.CompilationUnit); - - ExpressionResult expression = new ExpressionResult("self.randomNumber.randint", ExpressionContext.Default); - PythonClassResolver classResolver = new PythonClassResolver(); - PythonLocalVariableResolver localVariableResolver = new PythonLocalVariableResolver(classResolver); - PythonMemberResolver resolver = new PythonMemberResolver(classResolver, localVariableResolver); - - PythonResolverContext context = new PythonResolverContext(parseInfo, expression, "class Test:\r\npass"); - Assert.DoesNotThrow(delegate { resolver.Resolve(context); }); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodFromUnknownImportAllTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodFromUnknownImportAllTests.cs deleted file mode 100644 index 601573bf27..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodFromUnknownImportAllTests.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveMethodFromUnknownImportAllTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("methodcall", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from unknown import *\r\n" + - "methodcall\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsNull() - { - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodReturnValueTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodReturnValueTests.cs deleted file mode 100644 index 04c4d2c05d..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodReturnValueTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveMethodReturnValueTests - { - PythonResolverTestsHelper resolverHelper; - MockClass myClass; - DefaultMethod myMethod; - - void CreateResolver() - { - resolverHelper = new PythonResolverTestsHelper(); - myClass = resolverHelper.CreateClass("MyClass"); - myMethod = myClass.AddMethod("MyMethod"); - myMethod.ReturnType = new DefaultReturnType(myClass); - - resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass); - } - - [Test] - public void Resolve_ExpressionToResolveIsMethodCallWithNoParameters_ReturnsMemberResolveResultWithResolvedMemberAsMethod() - { - CreateResolver(); - string code = "MyClass.MyMethod()"; - resolverHelper.Resolve(code); - - MemberResolveResult result = resolverHelper.MemberResolveResult; - IMember resolvedMember = result.ResolvedMember; - - Assert.AreEqual(myMethod, resolvedMember); - } - - [Test] - public void Resolve_ExpressionToResolveIsMethodCallWithNoParameters_ReturnsMemberResolveResultWithMethodReturnValueAsResolvedType() - { - CreateResolver(); - string code = "MyClass.MyMethod()"; - resolverHelper.Resolve(code); - - MemberResolveResult result = resolverHelper.MemberResolveResult; - IReturnType resolvedType = result.ResolvedType; - IReturnType expectedResolvedType = myMethod.ReturnType; - - Assert.AreEqual(expectedResolvedType, resolvedType); - } - - [Test] - public void Resolve_ExpressionHasCloseParenthesisButNoOpenParenthesis_NoArgumentOutOfRangeExceptionThrownAndResolveResultIsNull() - { - CreateResolver(); - string code = "MyClass.MyMethod)"; - resolverHelper.Resolve(code); - - Assert.IsNull(resolverHelper.ResolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenFromImportIsUnknownTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenFromImportIsUnknownTests.cs deleted file mode 100644 index e9926b1dc0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenFromImportIsUnknownTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveMethodWhenFromImportIsUnknownTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("methodcall", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from unknown import methodcall\r\n" + - "methodcall\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsNull() - { - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenImportIsUnknownTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenImportIsUnknownTests.cs deleted file mode 100644 index 2bad88fc93..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveMethodWhenImportIsUnknownTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveMethodWhenImportIsUnknownTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("unknown.methodcall", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from unknown import methodcall\r\n" + - "unknown.methodcall\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsNull() - { - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveNullCtrlSpaceParseInfoTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveNullCtrlSpaceParseInfoTestFixture.cs deleted file mode 100644 index edef3d1fb7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveNullCtrlSpaceParseInfoTestFixture.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveNullCtrlSpaceParseInfoTestFixture - { - /// - /// Tests that the resolver handles the parse info being null - /// - [Test] - public void ResolveCtrlSpaceDoesNotThrowExceptionWhenNullParseInfoIsNull() - { - PythonResolver resolver = new PythonResolver(); - List results = resolver.CtrlSpace(0, 0, null, "abc", ExpressionContext.Namespace); - Assert.AreEqual(0, results.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveRandomRandintTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveRandomRandintTests.cs deleted file mode 100644 index d519ac31b4..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveRandomRandintTests.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveRandomRandintTests : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("self.randomNumber.randint", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import random\r\n" + - "\r\n" + - "class Test:\r\n" + - " def __init__(self):\r\n" + - " self.randomNumber = random.random()\r\n" + - " self.randomNumber.randint\r\n" + - "\r\n"; - } - - [Test] - public void Resolve_RandomModuleCannotBeFound_NoNullRefererenceExceptionThrown() - { - Assert.IsNotNull(resolveResult as PythonMethodGroupResolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSelfTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSelfTests.cs deleted file mode 100644 index 2162de620c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSelfTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSelfTests - { - IClass fooClass; - PythonResolverTestsHelper resolverHelper; - - void CreateResolver(string code) - { - resolverHelper = new PythonResolverTestsHelper(code); - fooClass = resolverHelper.CompilationUnit.Classes[0]; - } - - [Test] - public void Resolve_ExpressionIsSelf_ResolveResultResolvedTypeUnderlyingClassReturnsFooClass() - { - ResolveSelfExpression(); - IClass underlyingClass = resolverHelper.ResolveResult.ResolvedType.GetUnderlyingClass(); - - Assert.AreEqual(fooClass, underlyingClass); - } - - void ResolveSelfExpression() - { - string code = - "class Foo:\r\n" + - " def bar(self):\r\n" + - " self\r\n" + - "\r\n"; - - CreateResolver(code); - resolverHelper.Resolve("self"); - } - - void ResolveSelfMethodExpression() - { - string code = - "class Foo:\r\n" + - " def bar(self):\r\n" + - " return 0\r\n" + - "\r\n"; - - CreateResolver(code); - resolverHelper.Resolve("self.bar"); - } - - [Test] - public void Resolve_ExpressionIsSelf_ResolveResultCallingClassReturnsFooClass() - { - ResolveSelfExpression(); - IClass underlyingClass = resolverHelper.ResolveResult.CallingClass; - - Assert.AreEqual(fooClass, underlyingClass); - } - - [Test] - public void Resolve_ExpressionIsSelfFollowedByMethodCall_MethodGroupResolveResultNameIsMethodCalled() - { - ResolveSelfMethodExpression(); - string methodName = resolverHelper.MethodGroupResolveResult.Name; - - Assert.AreEqual("bar", methodName); - } - - [Test] - public void Resolve_ExpressionIsSelfFollowedByMethodCall_MethodGroupResolveResultContainingTypeUnderlyingClassIsFooClass() - { - ResolveSelfMethodExpression(); - IClass underlyingClass = resolverHelper.MethodGroupResolveResult.ContainingType.GetUnderlyingClass(); - - Assert.AreEqual(fooClass, underlyingClass); - } - - [Test] - public void Resolve_ClassPropertyReferencedThroughSelf_MemberResolveResultResolvedMemberIsNamePropertyOnFooClass() - { - string code = - "class Foo:\r\n" + - " def get_name(self):\r\n" + - " return 'test'\r\n" + - " name = property(fget=get_name)\r\n" + - "\r\n"; - - CreateResolver(code); - resolverHelper.Resolve("self.name"); - - IMember member = resolverHelper.MemberResolveResult.ResolvedMember; - IMember expectedMember = fooClass.Properties[0]; - - Assert.AreSame(expectedMember, member); - } - - [Test] - public void Resolve_PropertyReferencedThroughSelfButOutsideClass_ReturnsNull() - { - string code = String.Empty; - resolverHelper = new PythonResolverTestsHelper(code); - resolverHelper.Resolve("self.name"); - - ResolveResult result = resolverHelper.ResolveResult; - - Assert.IsNull(result); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleExitMethodTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleExitMethodTests.cs deleted file mode 100644 index fd28263f01..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleExitMethodTests.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSysModuleExitMethodTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("sys.exit", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import sys\r\n" + - "sys.exit\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsExit() - { - Assert.AreEqual("exit", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - - [Test] - public void ResolveResultContainingTypeHasTwoExitMethods() - { - List exitMethods = GetExitMethods(); - Assert.AreEqual(2, exitMethods.Count); - } - - List GetExitMethods() - { - return GetExitMethods(-1); - } - - List GetExitMethods(int parameterCount) - { - List methods = MethodResolveResult.ContainingType.GetMethods(); - return PythonCompletionItemsHelper.FindAllMethodsFromCollection("exit", parameterCount, methods.ToArray()); - } - - [Test] - public void BothExitMethodsArePublic() - { - foreach (IMethod method in GetExitMethods()) { - Assert.IsTrue(method.IsPublic); - } - } - - [Test] - public void BothExitMethodsHaveClassWithNameOfSys() - { - foreach (IMethod method in GetExitMethods()) { - Assert.AreEqual("sys", method.DeclaringType.Name); - } - } - - [Test] - public void OneExitMethodHasOneParameter() - { - int parameterCount = 1; - Assert.AreEqual(1, GetExitMethods(parameterCount).Count); - } - - [Test] - public void ExitMethodParameterNameIsCode() - { - IParameter parameter = GetFirstExitMethodParameter(); - Assert.AreEqual("code", parameter.Name); - } - - IParameter GetFirstExitMethodParameter() - { - int parameterCount = 1; - List methods = GetExitMethods(parameterCount); - IMethod method = methods[0]; - return method.Parameters[0]; - } - - [Test] - public void ExitMethodParameterReturnTypeIsObject() - { - IParameter parameter = GetFirstExitMethodParameter(); - Assert.AreEqual("Object", parameter.ReturnType.Name); - } - - [Test] - public void ExitMethodParameterConvertedToStringUsingAmbienceReturnsObjectCodeString() - { - IAmbience ambience = new CSharpAmbience(); - string text = ambience.Convert(GetFirstExitMethodParameter()); - Assert.AreEqual("object code", text); - } - - [Test] - public void ExitMethodReturnTypeConvertedToStringUsingAmbienceReturnsVoid() - { - IAmbience ambience = new CSharpAmbience(); - List methods = GetExitMethods(); - IReturnType returnType = methods[0].ReturnType; - string text = ambience.Convert(returnType); - Assert.AreEqual("void", text); - } - - [Test] - public void MethodGroupContainingTypeHasTwoExitMethods() - { - IReturnType returnType = MethodResolveResult.ContainingType; - List methods = PythonCompletionItemsHelper.FindAllMethodsFromCollection("exit", returnType.GetMethods()); - Assert.AreEqual(2, methods.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleImportedAsMySysTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleImportedAsMySysTests.cs deleted file mode 100644 index 6bbe0fa1c6..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleImportedAsMySysTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSysModuleImportedAsMySysTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("mysys", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import sys as mysys\r\n" + - "mysys\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultContainsExitMethod() - { - List items = GetCompletionItems(); - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("exit", items); - Assert.IsNotNull(method); - } - - List GetCompletionItems() - { - return resolveResult.GetCompletionData(projectContent); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleTestFixture.cs deleted file mode 100644 index badeccc1e0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleTestFixture.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSysModuleTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("sys", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import sys\r\n" + - "sys\r\n" + - "\r\n"; - } - - [Test] - public void CompilationUnitHasSysModuleInUsingsCollection() - { - Assert.AreEqual("sys", compilationUnit.UsingScope.Usings[0].Usings[0]); - } - - [Test] - public void ResolveResultContainsExitMethod() - { - List items = GetCompletionItems(); - IMethod method = PythonCompletionItemsHelper.FindMethodFromCollection("exit", items); - Assert.IsNotNull(method); - } - - List GetCompletionItems() - { - return resolveResult.GetCompletionData(projectContent); - } - - [Test] - public void MathModuleExpressionShouldNotHaveAnyCompletionItemsSinceMathModuleIsNotImported() - { - ExpressionResult result = new ExpressionResult("math", ExpressionContext.Default); - resolveResult = resolver.Resolve(result, parseInfo, GetPythonScript()); - - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleUnknownMethodTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleUnknownMethodTests.cs deleted file mode 100644 index 5fe54cdbef..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSysModuleUnknownMethodTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSysModuleUnknownMethodTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("sys.unknown", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import sys\r\n" + - "sys.unknown\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsNull() - { - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleOutsideClassTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleOutsideClassTestFixture.cs deleted file mode 100644 index cbc491e0c7..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleOutsideClassTestFixture.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that we can resolve System.Console even when - /// there is no class. This allows us to get code completion - /// in a simple python script without any classes being required. - /// - [TestFixture] - public class ResolveSystemConsoleOutsideClassTestFixture : ResolveSystemConsoleTestFixture - { - protected override string GetPythonScript() - { - return "import System\r\n" + - "System.Console\r\n"; - } - - /// - /// Creates a compilation unit with no classes. - /// - protected override ICompilationUnit CreateCompilationUnit(IProjectContent projectContent) - { - return new DefaultCompilationUnit(projectContent); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTests.cs deleted file mode 100644 index 990ee00303..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemConsoleTests.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests the PythonResolver correctly resolves the expression: - /// "System.Console" - /// - [TestFixture] - public class ResolveSystemConsoleTestFixture - { - PythonResolver resolver; - ICSharpCode.Scripting.Tests.Utils.MockProjectContent mockProjectContent; - ResolveResult resolveResult; - MockClass testClass; - ICompilationUnit compilationUnit; - MockClass systemConsoleClass; - ResolveResult invalidMostRecentCompilationUnitResolveResult; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - mockProjectContent = new ICSharpCode.Scripting.Tests.Utils.MockProjectContent(); - - systemConsoleClass = new MockClass(mockProjectContent, "System.Console"); - mockProjectContent.SetClassToReturnFromGetClass("System.Console", systemConsoleClass); - - compilationUnit = CreateCompilationUnit(mockProjectContent); - ParseInformation parseInfo = new ParseInformation(compilationUnit); - - string python = GetPythonScript(); - ExpressionResult expressionResult = new ExpressionResult("System.Console", new DomRegion(3, 2), null, null); - resolveResult = resolver.Resolve(expressionResult, parseInfo, python); - - // Check that the best compilation unit is used and the resolve - // still works. - invalidMostRecentCompilationUnitResolveResult = resolver.Resolve(expressionResult, parseInfo, python); - } - - [Test] - public void ResolveResultExists() - { - Assert.IsNotNull(resolveResult); - } - - [Test] - public void IsTypeResolveResult() - { - Assert.IsInstanceOf(typeof(TypeResolveResult), resolveResult); - } - - [Test] - public void ResolvedClass() - { - TypeResolveResult typeResolveResult = resolveResult as TypeResolveResult; - Assert.AreEqual(systemConsoleClass, typeResolveResult.ResolvedClass); - } - - [Test] - public void GetClassName() - { - Assert.AreEqual("System.Console", mockProjectContent.GetClassName); - } - - [Test] - public void ResolvedClassWithInvalidMostRecentCompilationUnit() - { - TypeResolveResult typeResolveResult = invalidMostRecentCompilationUnitResolveResult as TypeResolveResult; - Assert.AreEqual(systemConsoleClass, typeResolveResult.ResolvedClass); - } - - /// - /// Returns the Python script that will be used for testing. - /// - protected virtual string GetPythonScript() - { - return "import System\r\n" + - "class Test:\r\n" + - "\tdef __init__(self):\r\n" + - "\t\tSystem.Console\r\n"; - } - - /// - /// Creates a compilation unit with one class called Test. - /// - protected virtual ICompilationUnit CreateCompilationUnit(IProjectContent projectContent) - { - ICompilationUnit compilationUnit = new DefaultCompilationUnit(projectContent); - testClass = new MockClass(projectContent, "Test"); - compilationUnit.Classes.Add(testClass); - return compilationUnit; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportTests.cs deleted file mode 100644 index d4f9473dcf..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportTests.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests that the PythonResolver resolves "import System" to - /// a namespace. - /// - [TestFixture] - public class ResolveSystemImportTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - string code = GetPythonScript(); - PythonExpressionFinder finder = new PythonExpressionFinder(); - return finder.FindExpression(code, code.Length); - } - - protected override string GetPythonScript() - { - return "import System"; - } - - [Test] - public void NamespaceResolveResultFound() - { - Assert.IsNotNull(resolveResult); - } - - [Test] - public void NamespaceName() - { - PythonImportModuleResolveResult importResolveResult = (PythonImportModuleResolveResult)resolveResult; - Assert.AreEqual("System", importResolveResult.Name); - } - - [Test] - public void ExpressionResultContextShowItemReturnsTrueForNamespaceEntry() - { - NamespaceEntry entry = new NamespaceEntry("abc"); - Assert.IsTrue(expressionResult.Context.ShowEntry(entry)); - } - - [Test] - public void ExpressionResultContextShowItemReturnsFalseForNull() - { - Assert.IsFalse(expressionResult.Context.ShowEntry(null)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportedAsMySystemTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportedAsMySystemTests.cs deleted file mode 100644 index 3d2db57df0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemImportedAsMySystemTests.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSystemImportedAsMySystemTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - List namespaceItems = new List(); - DefaultClass consoleClass = new DefaultClass(compilationUnit, "System.Console"); - namespaceItems.Add(consoleClass); - projectContent.AddExistingNamespaceContents("System", namespaceItems); - - return new ExpressionResult("MySystem", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import System as MySystem\r\n" + - "MySystem.\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultContainsConsoleClass() - { - List items = GetCompletionItems(); - IClass consoleClass = PythonCompletionItemsHelper.FindClassFromCollection("Console", items); - Assert.IsNotNull(consoleClass); - } - - List GetCompletionItems() - { - return resolveResult.GetCompletionData(projectContent); - } - - [Test] - public void NamespaceResolveResultNameIsSystem() - { - NamespaceResolveResult namespaceResolveResult = resolveResult as NamespaceResolveResult; - Assert.AreEqual("System", namespaceResolveResult.Name); - } - - [Test] - public void MockProjectContentSystemNamespaceContentsIncludesConsoleClass() - { - List items = projectContent.GetNamespaceContents("System"); - IClass consoleClass = PythonCompletionItemsHelper.FindClassFromCollection("Console", items); - Assert.IsNotNull(consoleClass); - } - - [Test] - public void MockProjectContentNamespaceExistsReturnsTrueForSystem() - { - Assert.IsTrue(projectContent.NamespaceExists("System")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceTests.cs deleted file mode 100644 index edc90ee62b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests the PythonResolver correctly resolves the expression: - /// "System" - /// - [TestFixture] - public class ResolveSystemNamespaceTestFixture - { - PythonResolver resolver; - MockProjectContent mockProjectContent; - NamespaceResolveResult resolveResult; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resolver = new PythonResolver(); - mockProjectContent = new MockProjectContent(); - mockProjectContent.AddExistingNamespaceContents("System", new List()); - - string python = - "import System\r\n" + - "class Test:\r\n" + - " def __init__(self):\r\n" + - " System.\r\n"; - - PythonParser parser = new PythonParser(); - string fileName = @"C:\Projects\Test\test.py"; - DefaultCompilationUnit cu = parser.Parse(mockProjectContent, fileName, python) as DefaultCompilationUnit; - ParseInformation parseInfo = new ParseInformation(cu); - - ExpressionResult expressionResult = new ExpressionResult("System", new DomRegion(4, 2), null, null); - resolveResult = resolver.Resolve(expressionResult, parseInfo, python) as NamespaceResolveResult; - } - - [Test] - public void NamespaceExistsCalled() - { - Assert.IsTrue(mockProjectContent.NamespaceExistsCalled); - } - - [Test] - public void NamespaceSearchedFor() - { - Assert.AreEqual("System", mockProjectContent.NamespacePassedToNamespaceExistsMethod); - } - - [Test] - public void NamespaceResolveResultHasSystemNamespace() - { - Assert.AreEqual("System", resolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTests.cs deleted file mode 100644 index 526e519dfb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemNamespaceWithMissingImportTests.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSystemNamespaceWithMissingImportTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockClass systemConsoleClass = new MockClass(projectContent, "System.Console"); - List namespaceItems = new List(); - namespaceItems.Add(systemConsoleClass); - projectContent.AddExistingNamespaceContents("System", namespaceItems); - - return new ExpressionResult("System", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return "System\r\n"; - } - - [Test] - public void ResolveResultIsNullSinceSystemNamespaceIsNotImported() - { - Assert.IsNull(resolveResult); - } - - [Test] - public void ProjectContentNamespaceExistsReturnsTrueForSystemNamespace() - { - Assert.IsTrue(projectContent.NamespaceExists("System")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsFormsWithImportSystemTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsFormsWithImportSystemTests.cs deleted file mode 100644 index 346a217e85..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsFormsWithImportSystemTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSystemWindowsFormsWithImportSystemTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockProjectContent referencedContent = new MockProjectContent(); - List namespaceItems = new List(); - referencedContent.AddExistingNamespaceContents("System.Windows.Forms", namespaceItems); - projectContent.ReferencedContents.Add(referencedContent); - - return new ExpressionResult("System.Windows.Forms"); - } - - protected override string GetPythonScript() - { - return - "import System\r\n" + - "System.Windows.Forms\r\n"; - } - - NamespaceResolveResult NamespaceResolveResult { - get { return resolveResult as NamespaceResolveResult; } - } - - [Test] - public void NamespaceResolveResultHasSystemNamespace() - { - Assert.AreEqual("System.Windows.Forms", NamespaceResolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsWithImportSystemTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsWithImportSystemTests.cs deleted file mode 100644 index 2ae8167074..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWindowsWithImportSystemTests.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSystemWindowsWithImportSystemTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockProjectContent referencedContent = new MockProjectContent(); - List namespaceItems = new List(); - referencedContent.AddExistingNamespaceContents("System.Windows.Forms", namespaceItems); - projectContent.ReferencedContents.Add(referencedContent); - - return new ExpressionResult("System.Windows"); - } - - protected override string GetPythonScript() - { - return - "import System\r\n" + - "System.Windows\r\n"; - } - - NamespaceResolveResult NamespaceResolveResult { - get { return resolveResult as NamespaceResolveResult; } - } - - [Test] - public void NamespaceResolveResultHasSystemWindowsNamespace() - { - Assert.AreEqual("System.Windows", NamespaceResolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWithImportSystemWindowsTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWithImportSystemWindowsTests.cs deleted file mode 100644 index 9e931e9c86..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveSystemWithImportSystemWindowsTests.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveSystemWithImportSystemWindowsTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("System"); - } - - protected override string GetPythonScript() - { - return - "import System.Windows\r\n" + - "System\r\n"; - } - - NamespaceResolveResult NamespaceResolveResult { - get { return resolveResult as NamespaceResolveResult; } - } - - [Test] - public void NamespaceResolveResultHasSystemNamespace() - { - Assert.AreEqual("System", NamespaceResolveResult.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportAllTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportAllTests.cs deleted file mode 100644 index 44261f6b13..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportAllTests.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveTanMethodFromMathImportAllTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("tan", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from sys import *\r\n" + - "from math import *\r\n" + - "from socket import *\r\n" + - "\r\n" + - "tan\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsTan() - { - Assert.AreEqual("tan", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - - [Test] - public void ResolveResultContainingTypeHasOneTanMethods() - { - List tanMethods = GetTanMethods(); - Assert.AreEqual(1, tanMethods.Count); - } - - List GetTanMethods() - { - List methods = MethodResolveResult.ContainingType.GetMethods(); - return PythonCompletionItemsHelper.FindAllMethodsFromCollection("tan", -1, methods.ToArray()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportCosAndTanTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportCosAndTanTests.cs deleted file mode 100644 index c99946167b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTanMethodFromMathImportCosAndTanTests.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveTanMethodFromMathImportCosAndTanTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - return new ExpressionResult("tan", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from math import cos, tan\r\n" + - "tan\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsMethodGroupResolveResult() - { - Assert.IsTrue(resolveResult is MethodGroupResolveResult); - } - - [Test] - public void ResolveResultMethodNameIsTan() - { - Assert.AreEqual("tan", MethodResolveResult.Name); - } - - MethodGroupResolveResult MethodResolveResult { - get { return (MethodGroupResolveResult)resolveResult; } - } - - [Test] - public void ResolveResultContainingTypeHasOneTanMethods() - { - List tanMethods = GetTanMethods(); - Assert.AreEqual(1, tanMethods.Count); - } - - List GetTanMethods() - { - List methods = MethodResolveResult.ContainingType.GetMethods(); - return PythonCompletionItemsHelper.FindAllMethodsFromCollection("tan", -1, methods.ToArray()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTestsBase.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTestsBase.cs deleted file mode 100644 index cdb6d54427..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTestsBase.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - public abstract class ResolveTestsBase - { - protected ICompilationUnit compilationUnit; - protected MockProjectContent projectContent; - protected PythonResolver resolver; - protected ResolveResult resolveResult; - protected ParseInformation parseInfo; - protected ExpressionResult expressionResult; - - [SetUp] - public void InitBase() - { - projectContent = new MockProjectContent(); - PythonParser parser = new PythonParser(); - string fileName = @"C:\projects\test\test.py"; - compilationUnit = parser.Parse(projectContent, fileName, GetPythonScript()); - parseInfo = new ParseInformation(compilationUnit); - - resolver = new PythonResolver(); - - expressionResult = GetExpressionResult(); - resolveResult = resolver.Resolve(expressionResult, parseInfo, GetPythonScript()); - } - - protected abstract ExpressionResult GetExpressionResult(); - - protected abstract string GetPythonScript(); - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTests.cs deleted file mode 100644 index 67023c2e41..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportTextBoxTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveTextBoxFromSystemWindowsFormsImportTextBoxTests : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockClass textBoxClass = new MockClass(projectContent, "System.Windows.Forms.TextBox"); - projectContent.SetClassToReturnFromGetClass("System.Windows.Forms.TextBox", textBoxClass); - - return new ExpressionResult("TextBox", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from System.Windows.Forms import TextBox\r\n" + - "TextBox\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsTypeResolveResult() - { - Assert.IsTrue(resolveResult is TypeResolveResult); - } - - [Test] - public void ResolveResultResolveClassNameIsTextBox() - { - Assert.AreEqual("TextBox", TypeResolveResult.ResolvedClass.Name); - } - - TypeResolveResult TypeResolveResult { - get { return (TypeResolveResult)resolveResult; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsFooTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsFooTests.cs deleted file mode 100644 index 560be225de..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsFooTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveTextBoxFromSystemWindowsFormsImportedAsFooTests : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockClass textBoxClass = new MockClass(projectContent, "System.Windows.Forms.TextBox"); - projectContent.SetClassToReturnFromGetClass("System.Windows.Forms.TextBox", textBoxClass); - - return new ExpressionResult("Foo.TextBox", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "import System.Windows.Forms as Foo\r\n" + - "Foo.TextBox\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsTypeResolveResult() - { - Assert.IsTrue(resolveResult is TypeResolveResult); - } - - [Test] - public void ResolveResultResolveClassNameIsTextBox() - { - Assert.AreEqual("TextBox", TypeResolveResult.ResolvedClass.Name); - } - - TypeResolveResult TypeResolveResult { - get { return (TypeResolveResult)resolveResult; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTests.cs deleted file mode 100644 index e8ac8c6f87..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Dom.CSharp; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolveTextBoxFromSystemWindowsFormsImportedAsMyTextBoxTests : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - MockClass textBoxClass = new MockClass(projectContent, "System.Windows.Forms.TextBox"); - projectContent.SetClassToReturnFromGetClass("System.Windows.Forms.TextBox", textBoxClass); - - return new ExpressionResult("MyTextBox", ExpressionContext.Default); - } - - protected override string GetPythonScript() - { - return - "from System.Windows.Forms import TextBox as MyTextBox\r\n" + - "MyTextBox\r\n" + - "\r\n"; - } - - [Test] - public void ResolveResultIsTypeResolveResult() - { - Assert.IsTrue(resolveResult is TypeResolveResult); - } - - [Test] - public void ResolveResultResolveClassNameIsTextBox() - { - Assert.AreEqual("TextBox", TypeResolveResult.ResolvedClass.Name); - } - - TypeResolveResult TypeResolveResult { - get { return (TypeResolveResult)resolveResult; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveUnknownNamespaceTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveUnknownNamespaceTests.cs deleted file mode 100644 index 6478985072..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolveUnknownNamespaceTests.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - /// - /// Tests the PythonResolver does not return a namespace resolve result for - /// an unknown namespace. - /// - [TestFixture] - public class ResolveUnknownNamespaceTestFixture : ResolveTestsBase - { - protected override ExpressionResult GetExpressionResult() - { - projectContent.AddExistingNamespaceContents("System", new List()); - - return new ExpressionResult("Unknown", new DomRegion(3, 2), null, null); - } - - protected override string GetPythonScript() - { - return - "import System\r\n" + - "class Test:\r\n" + - " def __init__(self):\r\n" + - " Unknown\r\n"; - } - - [Test] - public void ResolveResultDoesNotExist() - { - Assert.IsNull(resolveResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextDottedImportedNameMatchTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextDottedImportedNameMatchTests.cs deleted file mode 100644 index abefce57db..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextDottedImportedNameMatchTests.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextDottedImportedNameMatchTests - { - [Test] - public void HasDottedImportNameReturnsTrueForSystemWithSystemWindowsFormsImported() - { - string code = "import System.Windows.Forms"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsTrue(resolverContext.HasDottedImportNameThatStartsWith("System")); - } - - [Test] - public void HasDottedImportNameReturnsFalseForMyNamespaceWithMyNamespaceTestImportedWithoutDtso() - { - string code = "import MyNamespaceTest"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsFalse(resolverContext.HasDottedImportNameThatStartsWith("MyNamespace")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForImportedNameTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForImportedNameTests.cs deleted file mode 100644 index ced44cc6ef..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForImportedNameTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextGetModuleForImportedNameTestFixture - { - PythonResolverContext resolverContext; - ParseInformation parseInfo; - - [SetUp] - public void Init() - { - string python = - "import math\r\n" + - "from sys import exit"; - - parseInfo = PythonParserHelper.CreateParseInfo(python); - resolverContext = new PythonResolverContext(parseInfo); - } - - [Test] - public void ResolverContextGetModuleForImportedNameReturnsSysForExitImportedName() - { - Assert.AreEqual("sys", resolverContext.GetModuleForImportedName("exit")); - } - - [Test] - public void ResolverContextGetModuleForImportedNameReturnsNullForUnknownImportedName() - { - Assert.IsNull(resolverContext.GetModuleForImportedName("unknown")); - } - - [Test] - public void ResolverContextUnaliasImportedNameReturnsExitForExitImportedName() - { - Assert.AreEqual("exit", resolverContext.UnaliasImportedName("exit")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForNameImportedAsDifferentNameTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForNameImportedAsDifferentNameTestFixture.cs deleted file mode 100644 index 9ef0b4e068..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModuleForNameImportedAsDifferentNameTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextGetModuleForNameImportedAsDifferentNameTestFixture - { - PythonResolverContext resolverContext; - ParseInformation parseInfo; - - [SetUp] - public void Init() - { - string python = - "from sys import exit as myexit"; - - parseInfo = PythonParserHelper.CreateParseInfo(python); - resolverContext = new PythonResolverContext(parseInfo); - } - - [Test] - public void ResolverContextGetModuleForNameReturnsSysForMyExitName() - { - Assert.AreEqual("sys", resolverContext.GetModuleForImportedName("myexit")); - } - - [Test] - public void ResolverContextGetModuleForImportedNameReturnsNullForExitImportedName() - { - Assert.IsNull(resolverContext.GetModuleForImportedName("exit")); - } - - [Test] - public void ResolverContextUnaliasImportedNameReturnsMyExitForExitImportedName() - { - Assert.AreEqual("exit", resolverContext.UnaliasImportedName("myexit")); - } - - [Test] - public void ResolverContextUnaliasImportedNameReturnsOriginalNameWhenNoAliasIsFound() - { - Assert.AreEqual("unknown", resolverContext.UnaliasImportedName("unknown")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModulesThatImportEverythingTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModulesThatImportEverythingTests.cs deleted file mode 100644 index a76dd3d20b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextGetModulesThatImportEverythingTests.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextGetImportAllModulesTests - { - [Test] - public void GetModulesThatImportEverythingReturnsEmptyCollectionIfNotImportAll() - { - string code = "from math import tan"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - - string[] expectedModules = new string[0]; - Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); - } - - [Test] - public void GetModulesThatImportEverythingReturnsSysForFromSysImportAllStatement() - { - string code = "from sys import *"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - - string[] expectedModules = new string[] { "sys" }; - Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); - } - - [Test] - public void GetModulesThatImportEverythingReturnsSysAndMathForFromSysImportAllStatement() - { - string code = - "from sys import *\r\n" + - "from math import *"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - - string[] expectedModules = new string[] { "sys", "math" }; - Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); - } - - [Test] - public void GetModulesThatImportEverythingIgnoresNonFromImportStatement() - { - string code = - "import math\r\n" + - "from sys import *"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - - string[] expectedModules = new string[] { "sys" }; - Assert.AreEqual(expectedModules, resolverContext.GetModulesThatImportEverything()); - } - - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextHasImportTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextHasImportTests.cs deleted file mode 100644 index 92dcb3f468..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextHasImportTests.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextHasImportTests - { - [Test] - public void HasImportReturnsFalseForImportThatDoesNotExistInCompilationUnit() - { - string code = "import abc"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsFalse(resolverContext.HasImport("Unknown")); - } - - [Test] - public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnit() - { - string code = "import abc"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsTrue(resolverContext.HasImport("abc")); - } - - [Test] - public void HasImportReturnsTrueForImportThatDoesExistInCompilationUnitWithSingleUsingWithMultipleNamespaces() - { - string code = "import abc, ghi"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsTrue(resolverContext.HasImport("ghi")); - } - - [Test] - public void HasImportReturnsFalseForFromImport() - { - string code = "from import sys"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsFalse(resolverContext.HasImport("sys")); - } - - [Test] - public void HasImportReturnsTrueForImportedAsName() - { - string code = "import sys as something"; - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - - PythonResolverContext resolverContext = new PythonResolverContext(parseInfo); - Assert.IsTrue(resolverContext.HasImport("something")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextPartialNamespaceExistsTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextPartialNamespaceExistsTests.cs deleted file mode 100644 index cb5f899491..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextPartialNamespaceExistsTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextPartialNamespaceExistsTests - { - ParseInformation parseInfo; - PythonResolverContext resolverContext; - - [SetUp] - public void Init() - { - MockProjectContent projectContent = new MockProjectContent(); - MockProjectContent winFormsReferenceProjectContent = new MockProjectContent(); - List namespaceItems = new List(); - winFormsReferenceProjectContent.AddExistingNamespaceContents("System.Windows.Forms", namespaceItems); - projectContent.ReferencedContents.Add(winFormsReferenceProjectContent); - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - parseInfo = new ParseInformation(unit); - - resolverContext = new PythonResolverContext(parseInfo); - } - - [Test] - public void PartialNamespaceExistsReturnsFalseForUnknownNamespace() - { - string ns = "unknown"; - Assert.IsFalse(resolverContext.PartialNamespaceExistsInProjectReferences(ns)); - } - - [Test] - public void PartialNamespaceExistsReturnsTrueForCompleteSystemWinFormsNamespaceMatch() - { - string ns = "System.Windows.Forms"; - Assert.IsTrue(resolverContext.PartialNamespaceExistsInProjectReferences(ns)); - } - - [Test] - public void PartialNamespaceExistsReturnsTrueForSystemWindowsNamespace() - { - string ns = "System.Windows"; - Assert.IsTrue(resolverContext.PartialNamespaceExistsInProjectReferences(ns)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextUnaliasImportedModuleNameTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextUnaliasImportedModuleNameTestFixture.cs deleted file mode 100644 index acd68b8381..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Resolver/ResolverContextUnaliasImportedModuleNameTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Resolver -{ - [TestFixture] - public class ResolverContextUnaliasImportedModuleNameTestFixture - { - PythonResolverContext resolverContext; - ParseInformation parseInfo; - - [SetUp] - public void Init() - { - string python = - "import math as m\r\n" + - "import sys as s"; - - parseInfo = PythonParserHelper.CreateParseInfo(python); - resolverContext = new PythonResolverContext(parseInfo); - } - - [Test] - public void ResolverContextUnaliasImportedModuleReturnsSysForImportedAsName() - { - Assert.AreEqual("sys", resolverContext.UnaliasImportedModuleName("s")); - } - - [Test] - public void ResolverContextUnaliasImportedModuleReturnsMathForImportedAsName() - { - Assert.AreEqual("math", resolverContext.UnaliasImportedModuleName("m")); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Strings.resx b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Strings.resx deleted file mode 100644 index 0a28739c88..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Strings.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Could not find type '{0}'. Are you missing an assembly reference? - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/TODO.txt b/src/AddIns/BackendBindings/Python/PythonBinding/Test/TODO.txt deleted file mode 100644 index bcb96474e9..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/TODO.txt +++ /dev/null @@ -1,106 +0,0 @@ - -* ProcessRunner.Start throws an exception since the python filename -cannot be found. - - try { - runner.Start(); - } catch (Win32Exception ex) { - if (ex.NativeErrorCode == Win32FileNotFoundErrorCode || ex.NativeErrorCode == Win32PathNotFoundErrorCode) { - throw new NAntAddInException(GetNAntNotFoundErrorMessage(AddInOptions.NAntFileName), ex); - } else { - throw; - } - } - -* ActiveWindow is null. -* PythonCompiler.ImageFileMachine -* PythonCompiler.StaticTypes - -* Main entry point: - -if __name __ == "__main__" or __name__ == sys.executable: - main(sys.argv[1:]) - -def main(args): - print "Hello, World!" - return 0 - -* CtrlSpaceHelper.AddUsing should be called in the PythonResolver when - the ExpressionContext is Importable. - - if (context == ExpressionContext.Importable) { - pc.AddNamespaceContents(result, String.Empty, pc.Language, true); - CtrlSpaceResolveHelper.AddUsing(result, pc.DefaultImports, pc); - return result; - } - -* Custom IExpressionFinder. - This is the only way to set the ExpressionContext to be Importable - or a Namespace. This cannot be done in the resolver. - -* Intellisense for built-in modules (e.g. sys). - IronPython does define classes for these built-in types so we - just need to work out a way to get access to them. The standard - methods are available via the BuiltIn class (e.g. dir, print). The - sys module is actually the SystemState class. Most of these classes - have attributes that mark them as PythonTypes or PythonModules. These - could potentially be used. There is also a PythonName property which - could be used to limit the methods returned for a built-in type and - map to the correct name. - -* Extend SharpDevelop by providing an IronPython macro window. - Ideally the code should be able to be debugged but this may be - too difficult. - - The script should be able to access SharpDevelop and control it. - - A macro recorder is out of scope. One way to do this would be - to rewrite SharpDevelop to use Command objects throughout. Otherwise - all calls to objects that are provided to the script needed to be - monitored and all calls recorded. - - Intellisense. Could use the same code used in the text editor. - - A way to load and run the scripts. - - A way to call a script from another script. - -* Intelligent completion after a from statement. - Typical statement is "from System import Console". At the moment - code completion after the import is incorrect here. It needs to - show items that are in the System namespace. - -* The PythonDesignerGenerator inserts an event handler at the end - of the active document. This is not correct. It should insert it at the - end of the form class. The file could contain multiple classes and - inserting the event handler at the end will not work in that case. - - * Python forms designer - default property values are incorrect. They should be based on the parent - control. For example: - - ParentControl has BorderStyle = FixedSingle when created. - ChildControl has ParentControl as base class. - BorderStyle set to None in designer for ChildControl. Code should then be generated for BorderStyle since this - is not the default - - * Event Handler loading code: - - Handle invalid event name. - Check that += operator used. - -* ContextMenuStrip - - If the context menu is added for the first time and left open and displayed on the form when - switching to the source code you see an OwnerItem property added to the context menu variable: - - self._contextMenuStrip1.OwnerItem = ContextMenuStrip - -* Look at fixing the compiled exe so it can be run from a different folder. - - See http://lists.ironpython.com/pipermail/users-ironpython.com/2009-April/009993.html - - * Support for ListViewSubItems - Font, Colors. - - * Timer - Honour the GenerateMember setting. - - * Look at creating code for non-visual components in the same order as Visual Studio. \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs deleted file mode 100644 index 2db4804f68..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/CreatePythonTestRunnerTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class CreatePythonTestRunnerTestFixture - { - PythonTestFramework testFramework; - - [TestFixtureSetUp] - public void SetUpFixture() - { - if (!PropertyService.Initialized) { - PropertyService.InitializeService(String.Empty, String.Empty, String.Empty); - } - } - - [SetUp] - public void Init() - { - testFramework = new PythonTestFramework(); - } - - [Test] - public void PythonTestFrameworkCreateTestRunnerReturnsPythonTestRunner() - { - Assert.IsInstanceOf(typeof(PythonTestRunner), testFramework.CreateTestRunner()); - } - - [Test] - public void PythonTestFrameworkCreateTestDebuggerReturnsPythonTestDebugger() - { - Assert.IsInstanceOf(typeof(PythonTestDebugger), testFramework.CreateTestDebugger()); - } - - [Test] - public void PythonTestFrameworkIsBuildNeededBeforeTestRunReturnsFalse() - { - Assert.IsFalse(testFramework.IsBuildNeededBeforeTestRun); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTests.cs deleted file mode 100644 index f9862e3a08..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonConsoleApplicationTests.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonConsoleApplicationTests - { - PythonConsoleApplication app; - PythonAddInOptions options; - - [SetUp] - public void Init() - { - options = new PythonAddInOptions(new Properties()); - options.PythonFileName = @"C:\IronPython\ipy.exe"; - app = new PythonConsoleApplication(options); - } - - [Test] - public void FileName_NewInstance_FileNameIsPythonFileNameFromAddInOptions() - { - string fileName = app.FileName; - string expectedFileName = @"C:\IronPython\ipy.exe"; - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void GetArguments_DebugIsTrue_ReturnsDebugOption() - { - app.Debug = true; - string args = app.GetArguments(); - string expectedCommandLine = "-X:Debug"; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetArguments_ScriptFileNameSet_ReturnsQuotedPythonScriptFileName() - { - app.ScriptFileName = @"d:\projects\my ipy\test.py"; - string args = app.GetArguments(); - string expectedCommandLine = "\"d:\\projects\\my ipy\\test.py\""; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetArguments_ScriptFileNameAndScriptCommandLineArgsSet_ReturnsQuotedPythonScriptFileNameAndItsCommandLineArguments() - { - app.Debug = true; - app.ScriptFileName = @"d:\projects\my ipy\test.py"; - app.ScriptCommandLineArguments = "@responseFile.txt -def"; - string args = app.GetArguments(); - string expectedCommandLine = - "-X:Debug \"d:\\projects\\my ipy\\test.py\" @responseFile.txt -def"; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetProcessStartInfo_NewInstance_ReturnsProcessStartInfoWithFileNameThatEqualsIronPythonConsoleApplicationExeFileName() - { - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedFileName = @"C:\IronPython\ipy.exe"; - - Assert.AreEqual(expectedFileName, startInfo.FileName); - } - - [Test] - public void GetProcessStartInfo_DebugIsTrue_ReturnsProcessStartInfoWithDebugFlagSetInArguments() - { - app.Debug = true; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedCommandLine = "-X:Debug"; - - Assert.AreEqual(expectedCommandLine, startInfo.Arguments); - } - - [Test] - public void GetProcessStartInfo_WorkingDirectorySet_ReturnsProcessStartInfoWithMatchingWorkingDirectory() - { - app.WorkingDirectory = @"d:\temp"; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedDirectory = @"d:\temp"; - Assert.AreEqual(expectedDirectory, startInfo.WorkingDirectory); - } - - [Test] - public void GetProcessStartInfo_ChangingPythonOptionsFileName_ProcessStartInfoFileNameMatchesChange() - { - options.PythonFileName = @"d:\temp\test\ipy.exe"; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedFileName = @"d:\temp\test\ipy.exe"; - Assert.AreEqual(expectedFileName, startInfo.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs deleted file mode 100644 index f1a06dfaf2..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonStandardLibraryPathTests.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.PythonBinding; -using NUnit.Framework; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonStandardLibraryPathTests - { - [Test] - public void PathsPropertyReturnsPython26LibDirectory() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib"); - string[] expectedPaths = new string[] { @"c:\python26\lib" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - - [Test] - public void HasPathReturnsTrueForNonEmptyPathString() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib"); - Assert.IsTrue(path.HasPath); - } - - [Test] - public void HasPathReturnsFalseForEmptyPathString() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(String.Empty); - Assert.IsFalse(path.HasPath); - } - - [Test] - public void DirectoryPropertyReturnsPython26LibDirectoryAndPython26LibTkDirectory() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\python26\lib;c:\python26\lib\lib-tk"); - string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - - [Test] - public void DirectoryPropertyReturnsPython26LibDirectoryAndPython26LibTkDirectorySetInPathProperty() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(String.Empty); - path.Path = @"c:\python26\lib;c:\python26\lib\lib-tk"; - string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - - [Test] - public void DirectoriesAreClearedWhenPathIsSetToDifferentValue() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp"); - path.Path = @"c:\python26\lib;c:\python26\lib\lib-tk"; - string[] expectedPaths = new string[] { @"c:\python26\lib", @"c:\python26\lib\lib-tk" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - - [Test] - public void EmptyDirectoryInPathNotAddedToDirectories() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp;;c:\python\lib"); - string[] expectedPaths = new string[] { @"c:\temp", @"c:\python\lib" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - - [Test] - public void DirectoryWithJustWhitespaceIsNotAddedToPath() - { - PythonStandardLibraryPath path = new PythonStandardLibraryPath(@"c:\temp; ;c:\python\lib"); - string[] expectedPaths = new string[] { @"c:\temp", @"c:\python\lib" }; - Assert.AreEqual(expectedPaths, path.Directories); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs deleted file mode 100644 index 86d09a737a..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestDebuggerRunsSelectedTestMethodTestFixture - { - MockDebuggerService debuggerService; - UnitTesting.Tests.Utils.MockDebugger debugger; - MockMessageService messageService; - MockCSharpProject project; - PythonTestDebugger testDebugger; - MockTestResultsMonitor testResultsMonitor; - SelectedTests selectedTests; - MockMethod methodToTest; - PythonAddInOptions options; - MockScriptingFileService fileService; - StringBuilder responseFileText; - StringWriter responseFileStringWriter; - PythonStandardLibraryPath standardLibraryPath; - - [SetUp] - public void Init() - { - CreateTestDebugger(); - CreateTestMethod(); - } - - void CreateTestDebugger() - { - debuggerService = new MockDebuggerService(); - debugger = debuggerService.MockDebugger; - messageService = new MockMessageService(); - testResultsMonitor = new MockTestResultsMonitor(); - options = new PythonAddInOptions(new Properties()); - options.PythonFileName = @"c:\ironpython\ipy.exe"; - standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib"); - fileService = new MockScriptingFileService(); - testDebugger = new PythonTestDebugger(debuggerService, messageService, testResultsMonitor, options, standardLibraryPath, fileService); - } - - void CreateTestMethod() - { - project = new MockCSharpProject(); - MockClass c = new MockClass("MyNamespace.MyTestClass"); - methodToTest = new MockMethod(c, "MyTestMethod"); - } - - void RunTestsOnSelectedTestMethod() - { - fileService.SetTempFileName(@"d:\temp\tmp66.tmp"); - CreateTemporaryResponseFileWriter(); - - selectedTests = new SelectedTests(project, null, null, methodToTest); - testDebugger.Start(selectedTests); - } - - void CreateTemporaryResponseFileWriter() - { - responseFileText = new StringBuilder(); - responseFileStringWriter = new StringWriter(responseFileText); - fileService.SetTextWriter(responseFileStringWriter); - } - - [Test] - public void TestDebuggerProcessFileNameIsIronPythonConsoleExeTakenFromAddInOptions() - { - RunTestsOnSelectedTestMethod(); - - string expectedFileName = @"c:\ironpython\ipy.exe"; - Assert.AreEqual(expectedFileName, debugger.ProcessStartInfo.FileName); - } - - [Test] - public void DisposingTestRunnerDeletesTemporaryResponseFile() - { - fileService.FileNameDeleted = null; - RunTestsOnSelectedTestMethod(); - testDebugger.Dispose(); - - string expectedFileName = @"d:\temp\tmp66.tmp"; - Assert.AreEqual(expectedFileName, fileService.FileNameDeleted); - } - - [Test] - public void DisposingTestRunnerDisposesTestResultsMonitor() - { - RunTestsOnSelectedTestMethod(); - testDebugger.Dispose(); - Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled); - } - - [Test] - public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName() - { - AddInPathHelper helper = new AddInPathHelper("PythonBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin"; - - RunTestsOnSelectedTestMethod(); - - string expectedCommandLine = - "-X:Debug " + - "\"c:\\sharpdevelop\\addins\\pythonbinding\\TestRunner\\sdtest.py\" " + - "\"@d:\\temp\\tmp66.tmp\""; - - Assert.AreEqual(expectedCommandLine, debugger.ProcessStartInfo.Arguments); - } - - [Test] - public void PythonTestResultReturnedFromTestFinishedEvent() - { - TestResult testResult = null; - testDebugger.TestFinished += delegate(object source, TestFinishedEventArgs e) { - testResult = e.Result; - }; - TestResult testResultToFire = new TestResult("test"); - testResultsMonitor.FireTestFinishedEvent(testResultToFire); - - Assert.IsInstanceOf(typeof(PythonTestResult), testResult); - } - - [Test] - public void ResponseFileTextContainsPythonLibraryPathFromPythonStandardLibraryPathObjectIfNotDefinedInAddInOptions() - { - standardLibraryPath.Path = @"c:\python\lib;c:\python\lib\lib-tk"; - options.PythonLibraryPath = String.Empty; - testResultsMonitor.FileName = @"c:\temp\test-results.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedText = - "/p:\"c:\\python\\lib\"\r\n" + - "/p:\"c:\\python\\lib\\lib-tk\"\r\n" + - "/r:\"c:\\temp\\test-results.txt\"\r\n" + - "MyNamespace.MyTestClass.MyTestMethod\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs deleted file mode 100644 index 10d55fa4ed..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestClassTests.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestFrameworkIsTestClassTests - { - PythonTestFramework testFramework; - - [SetUp] - public void Init() - { - testFramework = new PythonTestFramework(); - } - - [Test] - public void CreateClassWithUnitTestTestCaseBaseTypeReturnsClassWithFirstBaseTypeEqualToTestCase() - { - IClass c = MockClass.CreateClassWithBaseType("unittest.TestCase"); - string name = c.BaseTypes[0].FullyQualifiedName; - string expectedName = "unittest.TestCase"; - Assert.AreEqual(expectedName, name); - } - - [Test] - public void IsTestClassReturnsTrueWhenClassFirstBaseTypeIsUnitTestTestCase() - { - MockClass c = MockClass.CreateClassWithBaseType("unittest.TestCase"); - Assert.IsTrue(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsFalseWhenClassHasNoBaseTypes() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - Assert.IsFalse(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsFalseForNull() - { - Assert.IsFalse(testFramework.IsTestClass(null)); - } - - [Test] - public void IsTestClassReturnsFalseWhenFirstBaseTypeIsSystemWindowsFormsForm() - { - MockClass c = MockClass.CreateClassWithBaseType("System.Windows.Forms.Form"); - Assert.IsFalse(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsTrueWhenDerivedClassHasBaseClassDerivedFromTestCase() - { - MockClass baseClass = MockClass.CreateClassWithBaseType("unittest.TestCase"); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - DefaultReturnType returnType = new DefaultReturnType(baseClass); - c.BaseTypes.Add(returnType); - - Assert.IsTrue(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsTrueWhenClassFirstBaseTypeIsUnitTest2TestCase() - { - MockClass c = MockClass.CreateClassWithBaseType("unittest2.TestCase"); - Assert.IsTrue(testFramework.IsTestClass(c)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMemberTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMemberTests.cs deleted file mode 100644 index 6ce342126f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestMemberTests.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestFrameworkIsTestMemberTests - { - PythonTestFramework testFramework; - - void CreateTestFramework() - { - testFramework = new PythonTestFramework(); - } - - [Test] - public void IsTestMember_MethodThatStartsWithTest_ReturnsTrue() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - MockMethod method = new MockMethod(c, "testRunThis"); - - bool result = testFramework.IsTestMember(method); - - Assert.IsTrue(result); - } - - [Test] - public void IsTestMember_NullPassed_ReturnsFalse() - { - CreateTestFramework(); - bool result = testFramework.IsTestMember(null); - - Assert.IsFalse(result); - } - - [Test] - public void IsTestMember_MethodThatDoesNotStartWithTest_ReturnsFalse() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - MockMethod method = new MockMethod(c, "RunThis"); - - bool result = testFramework.IsTestMember(method); - - Assert.IsFalse(result); - } - - [Test] - public void IsTestMember_FieldThatStartsWithTest_ReturnsFalse() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - var field = new DefaultField(c, "testField"); - - bool result = testFramework.IsTestMember(field); - - Assert.IsFalse(result); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs deleted file mode 100644 index 661d7557a0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestFrameworkIsTestProjectTests.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestFrameworkIsTestProjectTests - { - PythonTestFramework testFramework; - - [TestFixtureSetUp] - public void SetUpFixture() - { - PythonMSBuildEngineHelper.InitMSBuildEngine(); - } - - [SetUp] - public void Init() - { - testFramework = new PythonTestFramework(); - } - - [Test] - public void IsTestProjectReturnsFalseForNull() - { - Assert.IsFalse(testFramework.IsTestProject(null)); - } - - [Test] - public void IsTestProjectReturnsTrueForPythonProject() - { - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - createInfo.OutputProjectFileName = @"C:\projects\test.pyproj"; - PythonProject project = new PythonProject(createInfo); - - Assert.IsTrue(testFramework.IsTestProject(project)); - } - - [Test] - public void IsTestProjectReturnsFalseForNonPythonProject() - { - MockProject project = new MockProject(); - Assert.IsFalse(testFramework.IsTestProject(project)); - } - - [Test] - public void IsTestProjectReturnsFalseForNullPythonProject() - { - PythonProject project = null; - Assert.IsFalse(testFramework.IsTestProject(project)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs deleted file mode 100644 index 967d8bbc26..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultFailureTestFixture.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.PythonBinding; -using ICSharpCode.UnitTesting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestResultFailureTestFixture - { - PythonTestResult pythonTestResult; - string stackTraceText; - - [SetUp] - public void Init() - { - TestResult testResult = new TestResult("MyTest"); - testResult.ResultType = TestResultType.Failure; - testResult.Message = "test failed"; - - stackTraceText = - "Traceback (most recent call last):\r\n" + - " File \"d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py\", line 16, in testAssertEquals\r\n" + - " self.assertEqual(10, 15, 'wrong size after resize')\r\n" + - "AssertionError: wrong size after resize"; - - testResult.StackTrace = stackTraceText; - pythonTestResult = new PythonTestResult(testResult); - } - - [Test] - public void TestResultNameIsMyTest() - { - Assert.AreEqual("MyTest", pythonTestResult.Name); - } - - [Test] - public void TestResultTypeIsFailure() - { - Assert.AreEqual(TestResultType.Failure, pythonTestResult.ResultType); - } - - [Test] - public void TestResultMessageIsTestFailed() - { - Assert.AreEqual("test failed", pythonTestResult.Message); - } - - [Test] - public void PythonTestResultHasStackTraceFromOriginalTestResult() - { - Assert.AreEqual(stackTraceText, pythonTestResult.StackTrace); - } - - [Test] - public void StackTraceFilePositionHasExpectedFileName() - { - string expectedFileName = "d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py"; - Assert.AreEqual(expectedFileName, pythonTestResult.StackTraceFilePosition.FileName); - } - - [Test] - public void StackTraceFilePositionLineIs16() - { - Assert.AreEqual(16, pythonTestResult.StackTraceFilePosition.Line); - } - - [Test] - public void StackTraceFilePositionColumnIsOne() - { - Assert.AreEqual(1, pythonTestResult.StackTraceFilePosition.Column); - } - - [Test] - public void ChangingStackTraceToEmptyStringSetsStackTraceFilePositionToEmpty() - { - pythonTestResult.StackTraceFilePosition = new FilePosition("test.cs", 10, 2); - pythonTestResult.StackTrace = String.Empty; - Assert.IsTrue(pythonTestResult.StackTraceFilePosition.IsEmpty); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs deleted file mode 100644 index 50ed4011e3..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestResultStackTraceLineNumberOverflowTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.UnitTesting; -using NUnit.Framework; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestResultLineNumberOverflowTestFixture - { - PythonTestResult pythonTestResult; - string stackTraceText; - - [SetUp] - public void Init() - { - TestResult testResult = new TestResult("MyTest"); - testResult.ResultType = TestResultType.Failure; - testResult.Message = "test failed"; - - stackTraceText = - "Traceback (most recent call last):\r\n" + - " File \"d:\\temp\\test\\PyTests\\Tests\\MyClassTest.py\", line 4294967296, in testAssertEquals\r\n" + - " self.assertEqual(10, 15, 'wrong size after resize')\r\n" + - "AssertionError: wrong size after resize"; - - testResult.StackTrace = stackTraceText; - pythonTestResult = new PythonTestResult(testResult); - } - - [Test] - public void StackTraceFilePositionIsEmpty() - { - Assert.IsTrue(pythonTestResult.StackTraceFilePosition.IsEmpty); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs deleted file mode 100644 index 2b48449353..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerResponseFileTestFixture.cs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; -using ICSharpCode.Core.Services; -using ICSharpCode.PythonBinding; -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestRunnerResponseFileTestFixture - { - PythonTestRunnerResponseFile responseFile; - StringBuilder responseFileText; - StringWriter writer; - - [SetUp] - public void Init() - { - responseFileText = new StringBuilder(); - writer = new StringWriter(responseFileText); - responseFile = new PythonTestRunnerResponseFile(writer); - } - - [Test] - public void WriteTestAddsTestNameToResponseFile() - { - responseFile.WriteTest("MyTests"); - - Assert.AreEqual("MyTests\r\n", responseFileText.ToString()); - } - - [Test] - public void WritePathAddsQuotedSysPathCommandLineArgument() - { - responseFile.WritePath(@"c:\mytests"); - - string expectedText = "/p:\"c:\\mytests\"\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteResultsFileNameAddsQuotedResultsFileNameCommandLineArgument() - { - responseFile.WriteResultsFileName(@"c:\temp\tmp66.tmp"); - - string expectedText = "/r:\"c:\\temp\\tmp66.tmp\"\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void DisposeMethodDisposesTextWriterPassedInConstructor() - { - responseFile.Dispose(); - Assert.Throws(delegate { writer.Write("test"); }); - } - - [Test] - public void WriteTestsWritesSelectedTestMethodNameWhenMethodSelected() - { - MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes(); - method.FullyQualifiedName = "MyNamespace.MyTests.MyTestMethod"; - SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, null, method); - - responseFile.WriteTests(tests); - - string expectedText = "MyNamespace.MyTests.MyTestMethod\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsWritesSelectedTestClassNameWhenOnlyClassSelected() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - c.FullyQualifiedName = "MyNamespace.MyTests"; - SelectedTests tests = new SelectedTests(new MockCSharpProject(), null, c, null); - - responseFile.WriteTests(tests); - - string expectedText = "MyNamespace.MyTests\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsWritesSelectedTestNamespaceWhenOnlyNamespaceSelected() - { - SelectedTests tests = new SelectedTests(new MockCSharpProject(), "MyNamespace", null, null); - responseFile.WriteTests(tests); - - string expectedText = "MyNamespace\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsWritesNamespacesForAllFilesInProjectWhenOnlyProjectSelected() - { - MockCSharpProject project = new MockCSharpProject(); - - FileProjectItem item = new FileProjectItem(project, ItemType.Compile); - item.FileName = @"c:\projects\mytests\nonTestClass.py"; - ProjectService.AddProjectItem(project, item); - - item = new FileProjectItem(project, ItemType.Compile); - item.FileName = @"c:\projects\mytests\TestClass.py"; - ProjectService.AddProjectItem(project, item); - - SelectedTests tests = new SelectedTests(project); - - responseFile.WriteTests(tests); - - string expectedText = - "nonTestClass\r\n" + - "TestClass\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsWritesNothingToResponseFileWhenMethodAndClassAndNamespaceAndProjectIsNull() - { - SelectedTests tests = new SelectedTests(null); - responseFile.WriteTests(tests); - Assert.AreEqual(String.Empty, responseFileText.ToString()); - } - - [Test] - public void WriteTestsDoesNotThrowNullReferenceExceptionWhenNonFileProjectItemInProject() - { - MockCSharpProject project = new MockCSharpProject(); - WebReferenceUrl webRef = new WebReferenceUrl(project); - webRef.Include = "test"; - ProjectService.AddProjectItem(project, webRef); - - FileProjectItem item = new FileProjectItem(project, ItemType.Compile); - item.FileName = @"c:\projects\mytests\myTests.py"; - ProjectService.AddProjectItem(project, item); - - SelectedTests tests = new SelectedTests(project); - responseFile.WriteTests(tests); - - string expectedText = "myTests\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsWritesDirectoriesForReferencedProjectsToSysPathCommandLineArguments() - { - MockCSharpProject referencedProject = new MockCSharpProject(); - referencedProject.FileName = @"c:\projects\pyproject\pyproject.pyproj"; - - MockCSharpProject unitTestProject = new MockCSharpProject(); - ProjectReferenceProjectItem projectRef = new ProjectReferenceProjectItem(unitTestProject, referencedProject); - projectRef.FileName = @"c:\projects\pyproject\pyproject.pyproj"; - ProjectService.AddProjectItem(unitTestProject, projectRef); - - MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes(); - method.FullyQualifiedName = "MyNamespace.MyTests.MyTestMethod"; - - SelectedTests tests = new SelectedTests(unitTestProject, null, null, method); - responseFile.WriteTests(tests); - - string expectedText = - "/p:\"c:\\projects\\pyproject\"\r\n" + - "MyNamespace.MyTests.MyTestMethod\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs deleted file mode 100644 index 39f258dfc0..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using PythonBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace PythonBinding.Tests.Testing -{ - [TestFixture] - public class PythonTestRunnerRunsSelectedTestMethodTestFixture - { - MockCSharpProject project; - PythonTestRunner testRunner; - MockProcessRunner processRunner; - MockTestResultsMonitor testResultsMonitor; - SelectedTests selectedTests; - MockMethod methodToTest; - PythonAddInOptions options; - MockScriptingFileService fileService; - StringBuilder responseFileText; - StringWriter responseFileStringWriter; - PythonStandardLibraryPath standardLibraryPath; - MockMessageService messageService; - - [SetUp] - public void Init() - { - CreateTestRunner(); - CreateTestMethod(); - } - - void CreateTestRunner() - { - processRunner = new MockProcessRunner(); - testResultsMonitor = new MockTestResultsMonitor(); - options = new PythonAddInOptions(new Properties()); - options.PythonFileName = @"c:\ironpython\ipy.exe"; - fileService = new MockScriptingFileService(); - messageService = new MockMessageService(); - standardLibraryPath = new PythonStandardLibraryPath(@"c:\python\lib"); - PythonTestRunnerContext context = new PythonTestRunnerContext(processRunner, - testResultsMonitor, - messageService, - options, - standardLibraryPath, - fileService); - - testRunner = new PythonTestRunner(context); - } - - void CreateTestMethod() - { - project = new MockCSharpProject(); - MockClass c = new MockClass("MyNamespace.MyTestClass"); - methodToTest = new MockMethod(c, "MyTestMethod"); - } - - void RunTestsOnSelectedTestMethod() - { - fileService.SetTempFileName(@"d:\temp\tmp66.tmp"); - CreateTemporaryResponseFileWriter(); - - selectedTests = new SelectedTests(project, null, null, methodToTest); - testRunner.Start(selectedTests); - } - - void CreateTemporaryResponseFileWriter() - { - responseFileText = new StringBuilder(); - responseFileStringWriter = new StringWriter(responseFileText); - fileService.SetTextWriter(responseFileStringWriter); - } - - [Test] - public void TestRunnerProcessFileNameIsIronPythonConsoleExeTakenFromAddInOptions() - { - RunTestsOnSelectedTestMethod(); - - string expectedFileName = @"c:\ironpython\ipy.exe"; - Assert.AreEqual(expectedFileName, processRunner.CommandPassedToStartMethod); - } - - [Test] - public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName() - { - AddInPathHelper helper = new AddInPathHelper("PythonBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin"; - - RunTestsOnSelectedTestMethod(); - - string expectedCommandLine = - "\"c:\\sharpdevelop\\addins\\pythonbinding\\TestRunner\\sdtest.py\" " + - "\"@d:\\temp\\tmp66.tmp\""; - - Assert.AreEqual(expectedCommandLine, processRunner.CommandArgumentsPassedToStartMethod); - } - - [Test] - public void ResponseFileCreatedUsingTempFileName() - { - RunTestsOnSelectedTestMethod(); - - Assert.AreEqual(@"d:\temp\tmp66.tmp", fileService.CreateTextWriterInfoPassedToCreateTextWriter.FileName); - } - - [Test] - public void ResponseFileCreatedWithUtf8Encoding() - { - RunTestsOnSelectedTestMethod(); - - Assert.AreEqual(Encoding.UTF8, fileService.CreateTextWriterInfoPassedToCreateTextWriter.Encoding); - } - - [Test] - public void ResponseFileCreatedWithAppendSetToFalse() - { - RunTestsOnSelectedTestMethod(); - - Assert.IsFalse(fileService.CreateTextWriterInfoPassedToCreateTextWriter.Append); - } - - [Test] - public void DisposingTestRunnerDeletesTemporaryResponseFile() - { - fileService.FileNameDeleted = null; - RunTestsOnSelectedTestMethod(); - testRunner.Dispose(); - - string expectedFileName = @"d:\temp\tmp66.tmp"; - Assert.AreEqual(expectedFileName, fileService.FileNameDeleted); - } - - [Test] - public void DisposingTestRunnerDisposesTestResultsMonitor() - { - RunTestsOnSelectedTestMethod(); - testRunner.Dispose(); - Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled); - } - - [Test] - public void ResponseFileTextContainsPythonLibraryPathAndTestResultsFileNameAndFullyQualifiedTestMethod() - { - standardLibraryPath.Path = String.Empty; - options.PythonLibraryPath = @"c:\python26\lib"; - testResultsMonitor.FileName = @"c:\temp\test-results.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedText = - "/p:\"c:\\python26\\lib\"\r\n" + - "/r:\"c:\\temp\\test-results.txt\"\r\n" + - "MyNamespace.MyTestClass.MyTestMethod\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void ResponseFileTextDoesNotContainPythonLibraryPathIfItIsAnEmptyString() - { - options.PythonLibraryPath = String.Empty; - standardLibraryPath.Path = String.Empty; - testResultsMonitor.FileName = @"c:\temp\test-results.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedText = - "/r:\"c:\\temp\\test-results.txt\"\r\n" + - "MyNamespace.MyTestClass.MyTestMethod\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void ResponseFileTextContainsPythonLibraryPathFromPythonStandardLibraryPathObjectIfNotDefinedInAddInOptions() - { - standardLibraryPath.Path = @"c:\python\lib"; - options.PythonLibraryPath = String.Empty; - testResultsMonitor.FileName = @"c:\temp\test-results.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedText = - "/p:\"c:\\python\\lib\"\r\n" + - "/r:\"c:\\temp\\test-results.txt\"\r\n" + - "MyNamespace.MyTestClass.MyTestMethod\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void ResponseFileTextWriterDisposedAfterTestsRun() - { - RunTestsOnSelectedTestMethod(); - Assert.Throws(delegate { responseFileStringWriter.Write("test"); }); - } - - [Test] - public void ProcessRunnerWorkingDirectoryIsDirectoryContainingProject() - { - RunTestsOnSelectedTestMethod(); - - string expectedDirectory = @"c:\projects\MyTests"; - string actualDirectory = processRunner.WorkingDirectory; - - Assert.AreEqual(expectedDirectory, actualDirectory); - } - - [Test] - public void PythonTestResultReturnedFromTestFinishedEvent() - { - TestResult testResult = null; - testRunner.TestFinished += delegate(object source, TestFinishedEventArgs e) { - testResult = e.Result; - }; - TestResult testResultToFire = new TestResult("test"); - testResultsMonitor.FireTestFinishedEvent(testResultToFire); - - Assert.IsInstanceOf(typeof(PythonTestResult), testResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseButtonInfo.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseButtonInfo.cs deleted file mode 100644 index c0852cd302..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseButtonInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Holds information about the property associated with a - /// browse button in an options panel. - /// - public struct BrowseButtonInfo - { - public string Target; - public string FileFilter; - public TextBoxEditMode TextBoxEditMode; - - public BrowseButtonInfo(string target, string fileFilter, TextBoxEditMode textBoxEditMode) - { - Target = target; - FileFilter = fileFilter; - TextBoxEditMode = textBoxEditMode; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseFolderButtonInfo.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseFolderButtonInfo.cs deleted file mode 100644 index 7ed1ef395e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/BrowseFolderButtonInfo.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Holds information about the property associated with a - /// browse folder button in an options panel. - /// - public struct BrowseFolderButtonInfo - { - public string Target; - public string Description; - public TextBoxEditMode TextBoxEditMode; - - public BrowseFolderButtonInfo(string target, string description, TextBoxEditMode textBoxEditMode) - { - Target = target; - Description = description; - TextBoxEditMode = textBoxEditMode; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedApplicationSettingsPanel.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedApplicationSettingsPanel.cs deleted file mode 100644 index ae1206bbdb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedApplicationSettingsPanel.cs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Derived version of the ApplicationSettingsPanel class so we - /// can access various protected methods and variables when - /// testing the base class. - /// - public class DerivedApplicationSettingsPanel : ApplicationSettingsPanel - { - string setupFromManifestResourceName; - bool configurationSelectorAddedToControl; - Dictionary boundStringControls = new Dictionary(); - Dictionary boundEnumControls = new Dictionary(); - Dictionary boundTextEditModes = new Dictionary(); - List locationButtonsCreated = new List(); - Dictionary browseButtons = new Dictionary(); - - public DerivedApplicationSettingsPanel() - { - } - - public ConfigurationGuiHelper Helper { - get { return helper; } - } - - /// - /// Returns the resource name used to create the stream when - /// initialising the XmlUserControl. - /// - public string SetupFromManifestResourceName { - get { return setupFromManifestResourceName; } - } - - /// - /// Gets the name of the control that was bound to the specified - /// property. - /// - public string GetBoundStringControlName(string propertyName) - { - if (boundStringControls.ContainsKey(propertyName)) { - return boundStringControls[propertyName]; - } - return null; - } - - /// - /// Gets the name of the control that was bound to the specified - /// enum property. - /// - public string GetBoundEnumControlName(string propertyName) - { - if (boundEnumControls.ContainsKey(propertyName)) { - return boundEnumControls[propertyName]; - } - return null; - } - - /// - /// Gets the TextBoxEditMode used the control bound to the - /// specified property. - /// - public TextBoxEditMode GetBoundControlTextBoxEditMode(string propertyName) - { - return boundTextEditModes[propertyName]; - } - - /// - /// Returns whether the specified control has an associated - /// location button. - /// - public bool IsLocationButtonCreated(string controlName) - { - return locationButtonsCreated.Contains(controlName); - } - - /// - /// Returns whether the configuration selector control was added - /// to this control. - /// - public bool ConfigurationSelectorAddedToControl { - get { return configurationSelectorAddedToControl; } - } - - /// - /// Gets the browse button info for the specified browse button - /// control. - /// - public BrowseButtonInfo GetBrowseButtonInfo(string browseButtonName) - { - return browseButtons[browseButtonName]; - } - - /// - /// Calls the AssemblyNameTextBoxTextChanged method which - /// should update the output name text field due to changes - /// in the assembly name. - /// - public void CallAssemblyNameTextBoxTextChanged() - { - base.AssemblyNameTextBoxTextChanged(null, new EventArgs()); - } - - /// - /// Calls the OutputTypeComboBoxSelectedIndexChanged method which - /// should update the output name text field due to changes in the - /// output type. - /// - public void CallOutputTypeComboBoxSelectedIndexChanged() - { - base.OutputTypeComboBoxSelectedIndexChanged(null, new EventArgs()); - } - - /// - /// Called in ApplicationSettingsPanel.LoadPanelContents when - /// initialising the XmlUserControl. - /// - protected override void SetupFromManifestResource(string resource) - { - setupFromManifestResourceName = resource; - base.SetupFromManifestResource(resource); - } - - /// - /// Called when binding a string property to a control. - /// - protected override ConfigurationGuiBinding BindString(string control, string property, TextBoxEditMode textBoxEditMode) - { - boundStringControls.Add(property, control); - boundTextEditModes.Add(property, textBoxEditMode); - return base.BindString(control, property, textBoxEditMode); - } - - /// - /// Called when binding a enum property to a control. - /// - protected override ConfigurationGuiBinding BindEnum(string control, string property) - { - boundEnumControls.Add(property, control); - return base.BindEnum(control, property); - } - - /// - /// Called when a location button is associated with a control. - /// - protected override ChooseStorageLocationButton CreateLocationButton(ConfigurationGuiBinding binding, string controlName) - { - locationButtonsCreated.Add(controlName); - return base.CreateLocationButton(binding, controlName); - } - - /// - /// If the control is this control then we flag that the - /// configuration selector has been added. - /// - protected override void AddConfigurationSelector(Control control) - { - if (control == this) { - configurationSelectorAddedToControl = true; - } - base.AddConfigurationSelector(control); - } - - /// - /// Connects the browse button control to the target control. - /// - protected override void ConnectBrowseButtonControl(string browseButton, string target, string fileFilter, TextBoxEditMode textBoxEditMode) - { - BrowseButtonInfo browseButtonInfo = new BrowseButtonInfo(target, fileFilter, textBoxEditMode); - browseButtons.Add(browseButton, browseButtonInfo); - base.ConnectBrowseButtonControl(browseButton, target, fileFilter, textBoxEditMode); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedCompilingOptionsPanel.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedCompilingOptionsPanel.cs deleted file mode 100644 index 7706355e59..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedCompilingOptionsPanel.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Derived version of the CompilingOptionsPanel class so we - /// can access various protected methods and variables when - /// testing the base class. - /// - public class DerivedCompilingOptionsPanel : CompilingOptionsPanel - { - string setupFromManifestResourceName; - bool configurationSelectorAddedToControl; - Dictionary boundStringControls = new Dictionary(); - Dictionary boundBooleanControls = new Dictionary(); - Dictionary boundTextEditModes = new Dictionary(); - List locationButtonsCreated = new List(); - Dictionary browseFolderButtons = new Dictionary(); - bool createdTargetCpuComboBox; - - public DerivedCompilingOptionsPanel() - { - } - - public ConfigurationGuiHelper Helper { - get { return helper; } - } - - /// - /// Returns the resource name used to create the stream when - /// initialising the XmlUserControl. - /// - public string SetupFromManifestResourceName { - get { return setupFromManifestResourceName; } - } - - /// - /// Returns whether the target cpu combo box was created. - /// - public bool IsTargetCpuComboBoxCreated { - get { return createdTargetCpuComboBox; } - } - - /// - /// Gets the name of the control that was bound to the specified - /// property. - /// - public string GetBoundStringControlName(string propertyName) - { - if (boundStringControls.ContainsKey(propertyName)) { - return boundStringControls[propertyName]; - } - return null; - } - - /// - /// Gets the name of the control that was bound to the specified - /// property. - /// - public string GetBoundBooleanControlName(string propertyName) - { - if (boundBooleanControls.ContainsKey(propertyName)) { - return boundBooleanControls[propertyName]; - } - return null; - } - - /// - /// Gets the TextBoxEditMode used the control bound to the - /// specified property. - /// - public TextBoxEditMode GetBoundControlTextBoxEditMode(string propertyName) - { - return boundTextEditModes[propertyName]; - } - - /// - /// Returns whether the specified control has an associated - /// location button. - /// - public bool IsLocationButtonCreated(string controlName) - { - return locationButtonsCreated.Contains(controlName); - } - - /// - /// Gets the browse button info for the specified browse button - /// control. - /// - public BrowseFolderButtonInfo GetBrowseFolderButtonInfo(string browseButtonName) - { - return browseFolderButtons[browseButtonName]; - } - - /// - /// Returns whether the configuration selector control was added - /// to this control. - /// - public bool ConfigurationSelectorAddedToControl { - get { return configurationSelectorAddedToControl; } - } - - /// - /// Called in CompilingOptionsPanel.LoadPanelContents when - /// initialising the XmlUserControl. - /// - protected override void SetupFromManifestResource(string resource) - { - setupFromManifestResourceName = resource; - base.SetupFromManifestResource(resource); - } - - /// - /// Called when binding a string property to a control. - /// - protected override ConfigurationGuiBinding BindString(string control, string property, TextBoxEditMode textBoxEditMode) - { - boundStringControls.Add(property, control); - boundTextEditModes.Add(property, textBoxEditMode); - return base.BindString(control, property, textBoxEditMode); - } - - /// - /// Called when binding a boolean property to a control. - /// - protected override ConfigurationGuiBinding BindBoolean(string control, string property, bool defaultValue) - { - boundBooleanControls.Add(property, control); - return base.BindBoolean(control, property, defaultValue); - } - - /// - /// Called when associating a location button with a property. - /// - protected override ChooseStorageLocationButton CreateLocationButton(ConfigurationGuiBinding binding, string controlName) - { - locationButtonsCreated.Add(controlName); - return base.CreateLocationButton(binding, controlName); - } - - protected override ConfigurationGuiBinding CreatePlatformTargetComboBox() - { - createdTargetCpuComboBox = true; - return base.CreatePlatformTargetComboBox(); - } - - /// - /// Connects the browse folder button control to the target control. - /// - protected override void ConnectBrowseFolderButtonControl(string browseButton, string target, string description, TextBoxEditMode textBoxEditMode) - { - BrowseFolderButtonInfo browseButtonInfo = new BrowseFolderButtonInfo(target, description, textBoxEditMode); - browseFolderButtons.Add(browseButton, browseButtonInfo); - base.ConnectBrowseFolderButtonControl(browseButton, target, description, textBoxEditMode); - } - - /// - /// If the control is this control then we flag that the - /// configuration selector has been added. - /// - protected override void AddConfigurationSelector(Control control) - { - if (control == this) { - configurationSelectorAddedToControl = true; - } - base.AddConfigurationSelector(control); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedConvertProjectToPythonProjectCommand.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedConvertProjectToPythonProjectCommand.cs deleted file mode 100644 index 1261dd0c1e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedConvertProjectToPythonProjectCommand.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Text; - -using ICSharpCode.Core; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - public struct SourceAndTargetFile - { - public FileProjectItem Source; - public FileProjectItem Target; - - public SourceAndTargetFile(FileProjectItem source, FileProjectItem target) - { - this.Source = source; - this.Target = target; - } - } - - /// - /// Used to test the ConvertProjectToPythonProjectCommand class. - /// - public class DerivedConvertProjectToPythonProjectCommand : ConvertProjectToPythonProjectCommand - { - List sourceAndTargetFilesPassedToBaseClass = new List(); - List savedFiles = new List(); - List parseableFileContent = new List(); - IProjectContent projectContent; - Encoding fileServiceDefaultEncoding = Encoding.ASCII; - - public List SourceAndTargetFilesPassedToBaseClass { - get { return sourceAndTargetFilesPassedToBaseClass; } - } - - public Encoding FileServiceDefaultEncoding { - get { return fileServiceDefaultEncoding; } - set { fileServiceDefaultEncoding = value; } - } - - /// - /// Gets the files converted and saved. - /// - public List SavedFiles { - get { return savedFiles; } - } - - /// - /// Sets the project content to be returned from the GetProjectContent method. - /// - public IProjectContent ProjectContent { - get { return projectContent; } - set { projectContent = value; } - } - - public void AddParseableFileContent(string fileName, string content) - { - parseableFileContent.Add(new ConvertedFile(fileName, content, null)); - } - - public void CallConvertFile(FileProjectItem source, FileProjectItem target) - { - ConvertFile(source, target); - } - - public IProject CallCreateProject(string directory, IProject sourceProject) - { - return base.CreateProject(directory, sourceProject); - } - - public void CallCopyProperties(IProject source, IProject target) - { - base.CopyProperties(source, target); - } - - protected override void LanguageConverterConvertFile(FileProjectItem source, FileProjectItem target) - { - sourceAndTargetFilesPassedToBaseClass.Add(new SourceAndTargetFile(source, target)); - } - - protected override void SaveFile(string fileName, string content, Encoding encoding) - { - savedFiles.Add(new ConvertedFile(fileName, content, encoding)); - } - - protected override string GetParseableFileContent(string fileName) - { - foreach (ConvertedFile file in parseableFileContent) { - if (file.FileName == fileName) { - return file.Text; - } - } - return null; - } - - protected override IProjectContent GetProjectContent(IProject project) - { - return projectContent; - } - - protected override Encoding GetDefaultFileEncoding() - { - return fileServiceDefaultEncoding; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonConsoleHost.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonConsoleHost.cs deleted file mode 100644 index 8bb930ee41..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonConsoleHost.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Utils; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; - -namespace PythonBinding.Tests.Console -{ - public class DerivedPythonConsoleHost : PythonConsoleHost - { - ScriptingConsoleOutputStream outputStream; - - public DerivedPythonConsoleHost(IScriptingConsoleTextEditor textEditor) - : base(textEditor, new FakeControlDispatcher()) - { - } - - public Type GetProvider() - { - return base.Provider; - } - - public CommandLine CallCreateCommandLine() - { - return base.CreateCommandLine(); - } - - public IConsole CallCreateConsole(ScriptEngine engine, CommandLine commandLine, ConsoleOptions options) - { - return base.CreateConsole(engine, commandLine, options); - } - - public OptionsParser CallCreateOptionsParser() - { - return base.CreateOptionsParser(); - } - - /// - /// Gets the output stream class passed to SetOutput method. - /// - public ScriptingConsoleOutputStream OutputStream { - get { return outputStream; } - } - - protected override void SetOutput(ScriptingConsoleOutputStream stream) - { - outputStream = stream; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerGenerator.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerGenerator.cs deleted file mode 100644 index c85710fa19..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonDesignerGenerator.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using System.Collections; -using System.ComponentModel; -using System.Reflection; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Gui; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Gives access to various protected methods - /// of the PythonDesignerGenerator class for testing. - /// - public class DerivedPythonDesignerGenerator : PythonDesignerGenerator - { - ParseInformation parseInfoToReturnFromParseFile; - - public DerivedPythonDesignerGenerator() : this(new MockTextEditorOptions()) - { - } - - public DerivedPythonDesignerGenerator(ITextEditorOptions textEditorOptions) - : base(textEditorOptions) - { - } - - /// - /// Gets or sets the parse information that will be returned from the - /// ParseFile method. - /// - public ParseInformation ParseInfoToReturnFromParseFileMethod { - get { return parseInfoToReturnFromParseFile; } - set { parseInfoToReturnFromParseFile = value; } - } - - protected override ParseInformation ParseFile(string fileName, string textContent) - { - return parseInfoToReturnFromParseFile; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonFormsDesignerDisplayBinding.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonFormsDesignerDisplayBinding.cs deleted file mode 100644 index f169414b4f..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/DerivedPythonFormsDesignerDisplayBinding.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using System; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; - -namespace PythonBinding.Tests.Utils -{ - public class DerivedPythonFormsDesignerDisplayBinding : PythonFormsDesignerDisplayBinding - { - ParseInformation parseInfo; - ParseInformation parseServiceParseInfo; - bool isParseInfoDesignable; - string fileNamePassedToGetParseInfo; - string textContentNamePassedToGetParseInfo; - - public DerivedPythonFormsDesignerDisplayBinding() - { - } - - /// - /// Gets the parse info passed to the Forms Designer's IsDesignable method. - /// - public ParseInformation ParseInfoTestedForDesignability { - get { return parseInfo; } - } - - /// - /// Gets or sets the parse info that will be returned from the - /// GetParseInfo method. - /// - public ParseInformation ParseServiceParseInfoToReturn { - get { return parseServiceParseInfo; } - set { parseServiceParseInfo = value; } - } - - /// - /// Gets or sets what the IsDesignable method should return. - /// - public bool IsParseInfoDesignable { - get { return isParseInfoDesignable; } - set { isParseInfoDesignable = value; } - } - - /// - /// Gets the filename passed to the GetParseInfo method. - /// - public string FileNamePassedToGetParseInfo { - get { return fileNamePassedToGetParseInfo; } - } - - /// - /// Gets the text content passed to the GetParseInfo method. - /// - public string TextContentPassedToGetParseInfo { - get { return textContentNamePassedToGetParseInfo; } - } - - /// - /// Gets the parse information from the parse service - /// for the specified file. - /// - protected override ParseInformation GetParseInfo(string fileName, ITextBuffer textBuffer) - { - fileNamePassedToGetParseInfo = fileName; - textContentNamePassedToGetParseInfo = textBuffer.Text; - return parseServiceParseInfo; - } - - /// - /// Determines whether the specified parse information contains - /// a class which is designable. - /// - protected override bool IsDesignable(ParseInformation parseInfo) - { - this.parseInfo = parseInfo; - return isParseInfoDesignable; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeCompletionItemProvider.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeCompletionItemProvider.cs deleted file mode 100644 index a20b927212..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeCompletionItemProvider.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace PythonBinding.Tests.Utils -{ - public class FakeCompletionItemProvider : AbstractCompletionItemProvider - { - public ITextEditor TextEditorPassedToShowCompletion; - - public override void ShowCompletion(ITextEditor editor) - { - TextEditorPassedToShowCompletion = editor; - } - - public override ICompletionItemList GenerateCompletionList(ITextEditor editor) - { - throw new NotImplementedException(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeInsightWindow.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeInsightWindow.cs deleted file mode 100644 index b18e2412db..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/FakeInsightWindow.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace PythonBinding.Tests.Utils -{ - public class FakeInsightWindow : IInsightWindow - { - #pragma warning disable 67 - public event EventHandler DocumentChanged; - public event EventHandler SelectedItemChanged; - public event EventHandler CaretPositionChanged; - public event EventHandler Closed; - #pragma warning restore 67 - - public bool IsClosed; - - public IList Items { - get { - throw new NotImplementedException(); - } - } - - public IInsightItem SelectedItem { - get { - throw new NotImplementedException(); - } - set { - throw new NotImplementedException(); - } - } - - public double Width { - get { - throw new NotImplementedException(); - } - set { - throw new NotImplementedException(); - } - } - - public double Height { - get { - throw new NotImplementedException(); - } - set { - throw new NotImplementedException(); - } - } - - public bool CloseAutomatically { - get { - throw new NotImplementedException(); - } - set { - throw new NotImplementedException(); - } - } - - public int StartOffset { get; set; } - - public int EndOffset { - get { - throw new NotImplementedException(); - } - set { - throw new NotImplementedException(); - } - } - - public void Close() - { - IsClosed = true; - } - - public void FireDocumentChangedEvent(TextChangeEventArgs e) - { - if (DocumentChanged != null) { - DocumentChanged(this, e); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs deleted file mode 100644 index 29e4d196ff..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonBindingAddInFile.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Reflection; -using System.Xml; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Utility class that reads the PythonBinding.addin file - /// that has been embedded as a resource into the test assembly. - /// - public sealed class PythonBindingAddInFile - { - PythonBindingAddInFile() - { - } - - /// - /// Returns the PythonBinding.addin file. - /// - public static TextReader ReadAddInFile() - { - Assembly assembly = Assembly.GetAssembly(typeof(PythonBindingAddInFile)); - string resourceName = String.Concat("PythonBinding.Tests.PythonBinding.addin"); - Stream resourceStream = assembly.GetManifestResourceStream(resourceName); - if (resourceStream != null) { - return new StreamReader(resourceStream); - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCodeDomSerializerHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCodeDomSerializerHelper.cs deleted file mode 100644 index 13243bf893..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCodeDomSerializerHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; - -namespace PythonBinding.Tests.Utils -{ - public class PythonCodeDomSerializerHelper - { - public static PythonCodeDomSerializer CreateSerializer() - { - return new PythonCodeDomSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCompletionItemsHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCompletionItemsHelper.cs deleted file mode 100644 index 56c4a24f9e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonCompletionItemsHelper.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; - -namespace PythonBinding.Tests.Utils -{ - public class PythonCompletionItemsHelper - { - delegate bool IsMatch(object item, string name); - - public static IMethod FindMethodFromCollection(string name, ICollection items) - { - return Find(name, items, IsMethodMatch) as IMethod; - } - - static object Find(string name, ICollection items, IsMatch match) - { - foreach (object item in items) { - if (match(item, name)) { - return item; - } - } - return null; - } - - static bool IsMethodMatch(object obj, string name) - { - return IsMethodMatch(obj, name, -1); - } - - static bool IsMethodMatch(object obj, string name, int parameterCount) - { - IMethod method = obj as IMethod; - if (method != null) { - if (method.Name == name) { - if (parameterCount >= 0) { - return method.Parameters.Count == parameterCount; - } - return true; - } - } - return false; - } - - public static List FindAllMethodsFromCollection(string name, int parameterCount, ICollection items) - { - List matchedMethods = new List(); - foreach (object item in items) { - if (IsMethodMatch(item, name, parameterCount)) { - matchedMethods.Add((IMethod)item); - } - } - return matchedMethods; - } - - public static List FindAllMethodsFromCollection(string name, ICollection items) - { - return FindAllMethodsFromCollection(name, -1, items); - } - - public static IField FindFieldFromCollection(string name, ICollection items) - { - return Find(name, items, IsFieldMatch) as IField; - } - - static bool IsFieldMatch(object obj, string name) - { - IField field = obj as IField; - if (field != null) { - return field.Name == name; - } - return false; - } - - public static IClass FindClassFromCollection(string name, ICollection items) - { - return Find(name, items, IsClassMatch) as IClass; - } - - static bool IsClassMatch(object obj, string name) - { - IClass c = obj as IClass; - if (c != null) { - return c.Name == name; - } - return false; - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonComponentWalkerHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonComponentWalkerHelper.cs deleted file mode 100644 index 0477294d9b..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonComponentWalkerHelper.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.Scripting; - -namespace PythonBinding.Tests.Utils -{ - public class PythonComponentWalkerHelper - { - public static IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return new PythonComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs deleted file mode 100644 index 8b83c681fb..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonMSBuildEngineHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.PythonBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Project; - -namespace PythonBinding.Tests.Utils -{ - public sealed class PythonMSBuildEngineHelper - { - PythonMSBuildEngineHelper() - { - } - - /// - /// The MSBuildEngine sets the PythonBinPath so if - /// the Python.Build.Tasks assembly is shadow copied it refers - /// to the shadow copied assembly not the original. This - /// causes problems for Python projects that refer to the - /// SharpDevelop.Python.Build.targets import via $(PythonBinPath) - /// so here we change it so it points to the real PythonBinPath - /// binary. - /// - public static void InitMSBuildEngine() - { - string relativePath = @"..\..\AddIns\BackendBindings\PythonBinding\"; - MSBuildEngineHelper.InitMSBuildEngine("PythonBinPath", relativePath, typeof(PythonParser)); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonParserHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonParserHelper.cs deleted file mode 100644 index cf2568a31e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonParserHelper.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; - -namespace PythonBinding.Tests.Utils -{ - public static class PythonParserHelper - { - /// - /// Parses the code and returns the first statement as an assignment statement. - /// - public static AssignmentStatement GetAssignmentStatement(string code) - { - return GetFirstStatement(code) as AssignmentStatement; - } - - /// - /// Parses the code and returns the first statement's expression as call expression. - /// - public static CallExpression GetCallExpression(string code) - { - ExpressionStatement expressionStatement = GetFirstStatement(code) as ExpressionStatement; - return expressionStatement.Expression as CallExpression; - } - - static Statement GetFirstStatement(string code) - { - PythonParser parser = new PythonParser(); - PythonAst ast = parser.CreateAst(@"snippet.py", new StringTextBuffer(code)); - SuiteStatement suiteStatement = (SuiteStatement)ast.Body; - return suiteStatement.Statements[0]; - } - - public static ParseInformation CreateParseInfo(string code) - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - PythonParser parser = new PythonParser(); - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"C:\test.py", code); - return new ParseInformation(compilationUnit); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonResolverTestsHelper.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonResolverTestsHelper.cs deleted file mode 100644 index 7ccf88ec19..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/PythonResolverTestsHelper.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Dom; -using UnitTesting.Tests.Utils; -using ScriptingUtils = ICSharpCode.Scripting.Tests.Utils; - -namespace PythonBinding.Tests.Utils -{ - public class PythonResolverTestsHelper - { - public ScriptingUtils.MockProjectContent ProjectContent; - public DefaultCompilationUnit CompilationUnit; - public ParseInformation ParseInfo; - public PythonResolver Resolver; - public ResolveResult ResolveResult; - - public PythonResolverTestsHelper(string code) - { - ProjectContent = new ScriptingUtils.MockProjectContent(); - PythonParser parser = new PythonParser(); - string fileName = @"test.py"; - CompilationUnit = parser.Parse(ProjectContent, fileName, code) as DefaultCompilationUnit; - - ParseInfo = new ParseInformation(CompilationUnit); - Resolver = new PythonResolver(); - } - - public PythonResolverTestsHelper() - : this(String.Empty) - { - } - - public ResolveResult Resolve(string expression) - { - ExpressionResult expressionResult = new ExpressionResult(expression); - PythonResolverContext context = new PythonResolverContext(ParseInfo, expressionResult, String.Empty); - ResolveResult = Resolver.Resolve(context); - return ResolveResult; - } - - public ResolveResult Resolve(string expression, string code) - { - ExpressionResult expressionResult = new ExpressionResult(expression); - return Resolve(expressionResult, code); - } - - public ResolveResult Resolve(ExpressionResult expressionResult, string code) - { - ResolveResult = Resolver.Resolve(expressionResult, ParseInfo, code); - return ResolveResult; - } - - public MemberResolveResult MemberResolveResult { - get { return ResolveResult as MemberResolveResult; } - } - - public LocalResolveResult LocalResolveResult { - get { return ResolveResult as LocalResolveResult; } - } - - public MethodGroupResolveResult MethodGroupResolveResult { - get { return ResolveResult as MethodGroupResolveResult; } - } - - public MockClass CreateClass(string name) - { - return new MockClass(ProjectContent, name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionBinding.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionBinding.cs deleted file mode 100644 index 6ed183f356..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionBinding.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Editor.CodeCompletion; -using System; -using ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; - -namespace PythonBinding.Tests.Utils -{ - /// - /// Derived PythonCodeCompletion class that gives us access to - /// various protected methods for testing. - /// - public class TestablePythonCodeCompletionBinding : PythonCodeCompletionBinding - { - public bool IsCodeCompletionWindowDisplayed; - public ITextEditor TextEditorPassedToShowCompletionWindow; - public AbstractCompletionItemProvider CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow; - public AbstractCompletionItemProvider KeywordCompletionItemProviderCreated; - - /// - /// Overrides the completion data provider creation to make sure - /// it is called at the correct time. - /// - protected override AbstractCompletionItemProvider CreateKeywordCompletionItemProvider() - { - KeywordCompletionItemProviderCreated = base.CreateKeywordCompletionItemProvider(); - return KeywordCompletionItemProviderCreated; - } - - public void CallBaseShowCodeCompletionWindow(AbstractCompletionItemProvider completionItemProvider, ITextEditor textEditor) - { - base.ShowCodeCompletionWindow(completionItemProvider, textEditor); - } - - /// - /// Overrides the base class method so a code completion window is - /// not displayed but the fact that this method is called is - /// recorded. - /// - protected override void ShowCodeCompletionWindow(AbstractCompletionItemProvider completionItemProvider, ITextEditor textEditor) - { - TextEditorPassedToShowCompletionWindow = textEditor; - IsCodeCompletionWindowDisplayed = true; - CompletionItemProviderUsedWhenDisplayingCodeCompletionWindow = completionItemProvider; - } - - public PythonInsightWindowHandler PythonInsightWindowHandler { - get { return base.insightHandler as PythonInsightWindowHandler; } - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionItemProvider.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionItemProvider.cs deleted file mode 100644 index 664512806c..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/TestablePythonCodeCompletionItemProvider.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.PythonBinding; -using ICSharpCode.SharpDevelop.Editor.CodeCompletion; - -namespace PythonBinding.Tests.Utils -{ - public class TestablePythonCodeCompletionItemProvider : PythonCodeCompletionItemProvider - { - public DefaultCompletionItemList CallBaseCreateCompletionItemList() - { - return base.CreateCompletionItemList(); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonCompletionItemsHelperTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonCompletionItemsHelperTests.cs deleted file mode 100644 index 6d38dbd64e..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonCompletionItemsHelperTests.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Utils.Tests -{ - [TestFixture] - public class PythonCompletionItemsHelperTests - { - [Test] - public void FindMethodFromArrayReturnsExpectedMethod() - { - DefaultClass c = CreateClass(); - DefaultMethod method = new DefaultMethod(c, "abc"); - - ArrayList items = new ArrayList(); - items.Add(method); - - Assert.AreEqual(method, PythonCompletionItemsHelper.FindMethodFromCollection("abc", items)); - } - - DefaultClass CreateClass() - { - return new DefaultClass(new DefaultCompilationUnit(new DefaultProjectContent()), "Test"); - } - - [Test] - public void FindMethodFromArrayReturnsNullForUnknownMethod() - { - DefaultClass c = new DefaultClass(new DefaultCompilationUnit(new DefaultProjectContent()), "Test"); - DefaultMethod method = new DefaultMethod(c, "abc"); - - ArrayList items = new ArrayList(); - items.Add(method); - - Assert.IsNull(PythonCompletionItemsHelper.FindMethodFromCollection("unknown", items)); - } - - [Test] - public void FindFieldFromArrayReturnsExpectedField() - { - DefaultClass c = CreateClass(); - DefaultField field = new DefaultField(c, "field"); - - ArrayList items = new ArrayList(); - items.Add(field); - - Assert.AreEqual(field, PythonCompletionItemsHelper.FindFieldFromCollection("field", items)); - } - - [Test] - public void FindFieldFromArrayReturnsExpectedNullForUnknownField() - { - DefaultClass c = CreateClass(); - DefaultField field = new DefaultField(c, "field"); - - ArrayList items = new ArrayList(); - items.Add(field); - - Assert.IsNull(PythonCompletionItemsHelper.FindFieldFromCollection("unknown-field-name", items)); - } - - [Test] - public void FindClassFromArrayReturnsExpectedClass() - { - DefaultClass c = CreateClass(); - - ArrayList items = new ArrayList(); - items.Add(c); - - Assert.AreEqual(c, PythonCompletionItemsHelper.FindClassFromCollection("Test", items)); - } - - [Test] - public void FindClassFromArrayReturnsExpectedNullForUnknownClassName() - { - DefaultClass c = CreateClass(); - - ArrayList items = new ArrayList(); - items.Add(c); - - Assert.IsNull(PythonCompletionItemsHelper.FindClassFromCollection("unknown-class-name", items)); - } - - [Test] - public void FindAllMethodsFromArrayReturnsExpectedMethods() - { - DefaultClass c = CreateClass(); - DefaultMethod method1 = new DefaultMethod(c, "abc"); - DefaultMethod method2 = new DefaultMethod(c, "abc"); - DefaultMethod method3 = new DefaultMethod(c, "def"); - - ArrayList items = new ArrayList(); - items.Add(method1); - items.Add(method2); - items.Add(method3); - - List expectedMethods = new List(); - expectedMethods.Add(method1); - expectedMethods.Add(method2); - - List methods = PythonCompletionItemsHelper.FindAllMethodsFromCollection("abc", items); - Assert.AreEqual(expectedMethods, methods); - } - - [Test] - public void FindAllMethodsFromArrayWithParameterCountReturnsExpectedMethods() - { - DefaultClass c = CreateClass(); - DefaultMethod method1 = new DefaultMethod(c, "abc"); - method1.Parameters.Add(CreateParameter("a")); - - DefaultMethod method2 = new DefaultMethod(c, "abc"); - method2.Parameters.Add(CreateParameter("a")); - method2.Parameters.Add(CreateParameter("b")); - - DefaultMethod method3 = new DefaultMethod(c, "abc"); - method3.Parameters.Add(CreateParameter("c")); - - ArrayList items = new ArrayList(); - items.Add(method1); - items.Add(method2); - items.Add(method3); - - List expectedMethods = new List(); - expectedMethods.Add(method1); - expectedMethods.Add(method3); - - int parameterCount = 1; - List methods = PythonCompletionItemsHelper.FindAllMethodsFromCollection("abc", parameterCount, items); - Assert.AreEqual(expectedMethods, methods); - } - - DefaultParameter CreateParameter(string name) - { - DefaultReturnType returnType = new DefaultReturnType(CreateClass()); - DomRegion region = new DomRegion(1, 1); - return new DefaultParameter(name, returnType, region); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonParserHelperTests.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonParserHelperTests.cs deleted file mode 100644 index 94044855af..0000000000 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/PythonParserHelperTests.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using IronPython.Compiler.Ast; -using NUnit.Framework; -using PythonBinding.Tests.Utils; - -namespace PythonBinding.Tests.Utils.Tests -{ - [TestFixture] - public class PythonParserHelperTests - { - [Test] - public void CreateParseInfoReturnsParseInfoWithSingleClass() - { - string code = - "class foo:\r\n" + - " pass"; - - ParseInformation parseInfo = PythonParserHelper.CreateParseInfo(code); - Assert.AreEqual("foo", parseInfo.CompilationUnit.Classes[0].Name); - } - - [Test] - public void GetAssignmentStatementReturnsFirstAssignmentStatementInCode() - { - string code = - "i = 10"; - - AssignmentStatement assignment = PythonParserHelper.GetAssignmentStatement(code); - NameExpression nameExpression = assignment.Left[0] as NameExpression; - - Assert.AreEqual("i", nameExpression.Name); - } - - [Test] - public void GetCallExpressionReturnsFirstCallStatementInCode() - { - string code = - "run()"; - - CallExpression call = PythonParserHelper.GetCallExpression(code); - NameExpression nameExpression = call.Target as NameExpression; - - Assert.AreEqual("run", nameExpression.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe b/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe deleted file mode 100644 index c879fd9bf2..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe.Config b/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe.Config deleted file mode 100644 index 3bdfc53608..0000000000 --- a/src/AddIns/BackendBindings/Python/RequiredLibraries/Chiron.exe.Config +++ /dev/null @@ -1,180 +0,0 @@ - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/DLLs/IronPython.Wpf.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/DLLs/IronPython.Wpf.dll deleted file mode 100644 index 0d2fd5b432..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/DLLs/IronPython.Wpf.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.Modules.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.Modules.dll deleted file mode 100755 index 109d59f433..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.Modules.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.dll deleted file mode 100755 index 592155a683..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/IronPython.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/License.Rtf b/src/AddIns/BackendBindings/Python/RequiredLibraries/License.Rtf deleted file mode 100644 index 3a7ceb4fde..0000000000 --- a/src/AddIns/BackendBindings/Python/RequiredLibraries/License.Rtf +++ /dev/null @@ -1,245 +0,0 @@ -{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;} -{\f37\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} -{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} -{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} -{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f39\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f40\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\f42\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f43\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f44\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f45\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\f46\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f47\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f379\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f380\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;} -{\f382\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f383\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f386\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f387\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);} -{\f409\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\f410\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\f412\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\f413\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} -{\f416\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\f417\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} -{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} -{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} -{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} -{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} -{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;} -{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} -{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} -{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} -{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} -{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0; -\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\*\defchp -\fs22\loch\af31506\hich\af31506\dbch\af31505 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1 -\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe1033\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 Normal;} -{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 Default Paragraph Font;}{\* -\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \ql \li0\ri0\sa200\sl276\slmult1 -\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs22\lang1033\langfe1033\loch\f31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 -\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\s15\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs24\alang1025 \ltrch\fcs0 -\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext15 \ssemihidden \sunhideused \styrsid12260020 Normal (Web);}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \ssemihidden \sunhideused \styrsid12260020 Hyperlink;} -}{\*\listtable{\list\listtemplateid186961718{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li720 -\jclisttab\tx720\lin720 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'01.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li1440 -\jclisttab\tx1440\lin1440 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'02.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li2160 -\jclisttab\tx2160\lin2160 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'03.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li2880 -\jclisttab\tx2880\lin2880 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'04.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li3600 -\jclisttab\tx3600\lin3600 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'05.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li4320 -\jclisttab\tx4320\lin4320 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'06.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li5040 -\jclisttab\tx5040\lin5040 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'07.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li5760 -\jclisttab\tx5760\lin5760 }{\listlevel\levelnfc4\levelnfcn4\leveljc0\leveljcn0\levelfollow0\levelstartat1\lvltentative\levelspace0\levelindent0{\leveltext\'02\'08.;}{\levelnumbers\'01;}\rtlch\fcs1 \af0 \ltrch\fcs0 \hres0\chhres0 \fi-360\li6480 -\jclisttab\tx6480\lin6480 }{\listname ;}\listid259719883}}{\*\listoverridetable{\listoverride\listid259719883\listoverridecount0\ls1}}{\*\pgptbl {\pgp\ipgp2\itap0\li0\ri0\sb0\sa0}{\pgp\ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid11612883\rsid12260020} -{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author dinov}{\operator Dino Viehland}{\creatim\yr2007\mo10\dy30\hr14\min43}{\revtim\yr2010\mo7\dy8\hr11\min35} -{\version3}{\edmins1}{\nofpages3}{\nofwords1419}{\nofchars7907}{\*\company Microsoft}{\nofcharsws9308}{\vern32771}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}} -\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect -\widowctrl\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\horzdoc\dghspace120\dgvspace120\dghorigin1701 -\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind1\viewscale100\rsidroot11612883 \fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2 -\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6 -\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang -{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\qc \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12260020 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0 -\fs22\lang1033\langfe1033\loch\af31506\hich\af31506\dbch\af31505\cgrid\langnp1033\langfenp1033 {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 Apache License\line Version 2.0, January 2004\line }{\field\fldedit{\*\fldinst { -\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 HYPERLINK "http://www.apache.org/licenses/" }}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\ul\cf2\insrsid12260020\charrsid12260020 http://www.apache.org/licenses/}}} -\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 -\par }\pard \ltrpar\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12260020 {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart definitions}1. Definitions}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend definitions}. -\par "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. -\par "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. -\par "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. -\par "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. -\par "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. -\par "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. -\par "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). -\par "Derivative Works" shall mean any work, whether in Source or Object form, that is ba -sed on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works th -at remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. -\par "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that -Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, -" -submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are - managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." -\par "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart copyright}2. Grant of Copyright License}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend copyright} -. Subject to the terms and conditions of this License, each Contri -butor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative - Works in Source or Object form. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart patent}3. Grant of Patent License}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend patent} -. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this se -ction) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alon -e - or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution in -corporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart redistribution}4. Redistribution}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend redistribution} -. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0 \ltrch\fcs0 \dbch\af0\insrsid12260020\charrsid12260020 \hich\af0\dbch\af0\loch\f0 a.\tab}}\pard \ltrpar\ql \fi-360\li720\ri0\sb100\sa240\sbauto1\widctlpar -\jclisttab\tx720\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\pararsid12260020 {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 You must give any other recipients of t -he Work or Derivative Works a copy of this License; and -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0 \ltrch\fcs0 \dbch\af0\insrsid12260020\charrsid12260020 \hich\af0\dbch\af0\loch\f0 b.\tab}You must cause any modified files to carry prominent notices stating that You changed the files; and -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0 \ltrch\fcs0 \dbch\af0\insrsid12260020\charrsid12260020 \hich\af0\dbch\af0\loch\f0 c.\tab}You must retain, in the Source form of any Derivative Works that You distribute, all copyrigh -t, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and -\par {\listtext\pard\plain\ltrpar \rtlch\fcs1 \af0 \ltrch\fcs0 \dbch\af0\insrsid12260020\charrsid12260020 \hich\af0\dbch\af0\loch\f0 d.\tab}}\pard \ltrpar\ql \fi-360\li720\ri0\sb100\sa100\sbauto1\saauto1\widctlpar -\jclisttab\tx720\wrapdefault\aspalpha\aspnum\faauto\ls1\adjustright\rin0\lin720\itap0\pararsid12260020 {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivati -ve Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTI -C -E text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear -. - The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provide -d that such additional attribution notices cannot be construed as modifying the License. -\par }\pard \ltrpar\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12260020 {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 -You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribut -ion of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. -\par }\pard \ltrpar\ql \li0\ri0\sb100\sa100\sbauto1\saauto1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12260020 {\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart contributions -}5. Submission of Contributions}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend contributions}. Unless You explicitly stat -e otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall sup -ersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart trademarks}6. Trademarks}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend trademarks} -. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the -Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart no-warranty}7. Disclaimer of Warranty}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend no-warranty} -. Unless required by applicable law or agreed to in writing, Licensor provides the -Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, o -r FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart no-liability}8. Limitation of Liability}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend no-liability}. In no e -vent and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, -i -ncluding any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, com -puter failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. -\par }{\rtlch\fcs1 \ab\af0\afs24 \ltrch\fcs0 \b\f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkstart additional}9. Accepting Warranty or Additional Liability}{\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 {\*\bkmkend additional -}. While redistributing the Work or Derivative Works - thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and - -on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any - such warranty or additional liability. -\par See }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 HYPERLINK "http://www.codeplex.com/IronPython/Wiki/View.aspx?title=FAQ&referringTitle=Home" }}{\fldrslt {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 -\f0\fs24\ul\cf2\insrsid12260020\charrsid12260020 FAQ}}}\sectd \ltrsect\linex0\sectdefaultcl\sftnbj {\rtlch\fcs1 \af0\afs24 \ltrch\fcs0 \f0\fs24\insrsid12260020\charrsid12260020 for answers to frequently asked questions about this license. -\par }\pard \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid12260020 {\rtlch\fcs1 \af31507\afs24 \ltrch\fcs0 \insrsid11612883\charrsid12260020 -\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8 -72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7 -2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b -44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7 -065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000 -00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08 -84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc -52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353 -bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468 -656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c -070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7 -29e245eb2b260a0238fd010000ffff0300504b03041400060008000000210096b5ade296060000501b0000160000007468656d652f7468656d652f7468656d65 -312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87615b8116d8 -a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad79482a9c04 -98f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b5d8a314d3c -94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab999fb7b471 -7509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9699640f671 -9e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd5868b37a088d1 -e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d60cf03ac1a5 -193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f9e7ef3f2d1 -17d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be15c308d3f2 -8acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a99793849c26ae6 -6252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d32a423279a -668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2af074481847 -bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86e877f0034e -16bafb0e258ebb4faf06b769e888340b103d3311da9750aa9d0a1cd3e4efca31a3508f6d0c5c5c398602f8e2ebc71591f5b616e24dd893aa3261fb44f95d843b -5974bb5c04f4edafb95b7892ec1108f3f98de75dc97d5772bdff7cc95d94cf672db4b3da0a6557f70db629362d72bcb0431e53c6066acac80d699a6409fb44d0 -8741bdce9c0e4971624a2378cceaba830b05366b90e0ea23aaa241845368b0eb9e2612ca8c742851ca251ceccc70256d8d87265dd96361531f186c3d9058edf2 -c00eafe8e1fc5c509031bb4d680e9f39a3154de0accc56ae644441edd76156d7429d995bdd88664a9dc3ad50197c38af1a0c16d684060441db02565e85f3b966 -0d0713cc48a0ed6ef7dedc2dc60b17e92219e180643ed27acffba86e9c94c78ab90980d8a9f0913ee49d62b512b79626fb06dccee2a432bbc60276b9f7dec44b -7904cfbca4f3f6443ab2a49c9c2c41476dafd55c6e7ac8c769db1bc399161ee314bc2e75cf8759081743be1236ec4f4d6693e5336fb672c5dc24a8c33585b5fb -9cc24e1d4885545b58463634cc5416022cd19cacfccb4d30eb45296023fd35a458598360f8d7a4003bbaae25e331f155d9d9a5116d3bfb9a95523e51440ca2e0 -088dd844ec6370bf0e55d027a012ae264c45d02f708fa6ad6da6dce29c255df9f6cae0ec38666984b372ab5334cf640b37795cc860de4ae2816e95b21be5ceaf -8a49f90b52a51cc6ff3355f47e0237052b81f6800fd7b802239daf6d8f0b1571a8426944fdbe80c6c1d40e8816b88b8569082ab84c36ff0539d4ff6dce591a26 -ade1c0a7f669880485fd484582903d284b26fa4e2156cff62e4b9265844c4495c495a9157b440e091bea1ab8aaf7760f4510eaa69a6465c0e04ec69ffb9e65d0 -28d44d4e39df9c1a52ecbd3607fee9cec7263328e5d661d3d0e4f62f44acd855ed7ab33cdf7bcb8ae889599bd5c8b3029895b6825696f6af29c239b75a5bb1e6 -345e6ee6c28117e73586c1a2214ae1be07e93fb0ff51e133fb65426fa843be0fb515c187064d0cc206a2fa926d3c902e907670048d931db4c1a44959d366ad93 -b65abe595f70a75bf03d616c2dd959fc7d4e6317cd99cbcec9c58b34766661c7d6766ca1a9c1b327531486c6f941c638c67cd22a7f75e2a37be0e82db8df9f30 -254d30c1372581a1f51c983c80e4b71ccdd28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b010000270000007468656d652f74 -68656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384e4350d363f24 -51eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d262452282e3198 -720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe514173d9850528 -a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000000000000000 -000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000000000000000 -002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000140200007468 -656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d001400060008000000210096b5ade296060000501b000016000000000000000000 -00000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000270000000000 -00000000000000009b0900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000960a00000000} -{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d -617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 -6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 -656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} -{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; -\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; -\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; -\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; -\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 -4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000 -d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f0000000000000000000000002093 -a94acc1ecb01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Dynamic.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Dynamic.dll deleted file mode 100644 index 14b7ff99e0..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Dynamic.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.Metadata.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.Metadata.dll deleted file mode 100644 index 7d94df195f..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.Metadata.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.dll b/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.dll deleted file mode 100755 index 61556abb80..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/Microsoft.Scripting.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe b/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe deleted file mode 100755 index 51b875418b..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe.config b/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe.config deleted file mode 100644 index d84a930a86..0000000000 --- a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipy.exe.config +++ /dev/null @@ -1,22 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe b/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe deleted file mode 100644 index 97d1660474..0000000000 Binary files a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe and /dev/null differ diff --git a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe.config b/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe.config deleted file mode 100644 index d84a930a86..0000000000 --- a/src/AddIns/BackendBindings/Python/RequiredLibraries/ipyw.exe.config +++ /dev/null @@ -1,22 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.APACHE.html b/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.APACHE.html deleted file mode 100644 index 7b8e3f7693..0000000000 --- a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.APACHE.html +++ /dev/null @@ -1,214 +0,0 @@ - - - -Apache License, Version 2.0 - - - - -
-

-Apache License
-Version 2.0, January 2004
-http://www.apache.org/licenses/ -

-

-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -

-

1. Definitions.

-

- "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. -

-

- "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. -

-

- "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. -

-

- "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. -

-

- "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. -

-

- "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. -

-

- "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). -

-

- "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. -

-

- "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." -

-

- "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. -

-

2. Grant of Copyright License. -Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. -

-

3. Grant of Patent License. -Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. -

-

4. Redistribution. -You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: -

    -
  1. You must give any other recipients of the Work or - Derivative Works a copy of this License; and -

  2. - -
  3. You must cause any modified files to carry prominent notices - stating that You changed the files; and -

  4. - -
  5. You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and -

  6. - -
  7. If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License.
  8. -
- You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. -

-

5. Submission of Contributions. -Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. -

-

6. Trademarks. -This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. -

-

7. Disclaimer of Warranty. -Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. -

-

8. Limitation of Liability. -In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. -

-

9. Accepting Warranty or Additional Liability. -While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. -

-
- -

See FAQ for answers to frequently asked questions -about this license.

- - - - diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.CPL.txt b/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.CPL.txt deleted file mode 100644 index a8e6c050cc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.CPL.txt +++ /dev/null @@ -1,86 +0,0 @@ -Common Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - - a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.Ruby.txt b/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.Ruby.txt deleted file mode 100644 index 4a99f6f01a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/IronRuby/LICENSE.Ruby.txt +++ /dev/null @@ -1,58 +0,0 @@ -Ruby is copyrighted free software by Yukihiro Matsumoto . -You can redistribute it and/or modify it under either the terms of the GPL -(see COPYING.txt file), or the conditions below: - - 1. You may make and give away verbatim copies of the source form of the - software without restriction, provided that you duplicate all of the - original copyright notices and associated disclaimers. - - 2. You may modify your copy of the software in any way, provided that - you do at least ONE of the following: - - a) place your modifications in the Public Domain or otherwise - make them Freely Available, such as by posting said - modifications to Usenet or an equivalent medium, or by allowing - the author to include your modifications in the software. - - b) use the modified software only within your corporation or - organization. - - c) rename any non-standard executables so the names do not conflict - with standard executables, which must also be provided. - - d) make other distribution arrangements with the author. - - 3. You may distribute the software in object code or executable - form, provided that you do at least ONE of the following: - - a) distribute the executables and library files of the software, - together with instructions (in the manual page or equivalent) - on where to get the original distribution. - - b) accompany the distribution with the machine-readable source of - the software. - - c) give non-standard executables non-standard names, with - instructions on where to get the original software distribution. - - d) make other distribution arrangements with the author. - - 4. You may modify and include the part of the software into any other - software (possibly commercial). But some files in the distribution - are not written by the author, so that they are not under this terms. - - They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some - files under the ./missing directory. See each file for the copying - condition. - - 5. The scripts and library files supplied as input to or produced as - output from the software do not automatically fall under the - copyright of the software, but belong to whomever generated them, - and may be sold commercially, and may be aggregated with this - software. - - 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE. - diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/README.txt b/src/AddIns/BackendBindings/Ruby/IronRuby/README.txt deleted file mode 100644 index 0bf5f24720..0000000000 --- a/src/AddIns/BackendBindings/Ruby/IronRuby/README.txt +++ /dev/null @@ -1,49 +0,0 @@ -IronRuby - A .NET Implementation of the Ruby language - -Authors: - Daniele Alessandri, Shri Borde, Peter Bacon Darwin, Jim Deville, - Curt Hagenlocher, John Lam, Haibo Luo, Tomas Matousek, John Messerly, - Jirapong Nanta, Srivatsn Narayanan, Jimmy Schementi, Oleg Tkachenko, - Dino Viehland, and everyone else from the community who reports bugs, - builds libraries, and helps enrich IronRuby. - -Project Contacts: - Jimmy Schementi - Miguel de Icaza - Tomas Matousek - -== About - -IronRuby is a Open Source implementation of the Ruby programming language -(http://www.ruby-lang.org) for .NET, heavily relying on the -Dynamic Language Runtime (http://dlr.codeplex.com). - -The project's #1 goal is to be a true Ruby implementation, meaning it runs -existing Ruby code. See -http://ironruby.net/Documentation/Real_Ruby_Applications for information about -using the Ruby standard library and 3rd party libraries in IronRuby. - -IronRuby has tightly integration with .NET, so any .NET types can be used from -IronRuby, and the IronRuby runtime can be embedded into any .NET application. -See http://ironruby.net/documentation/.net for more information. - -== Running - -bin/ir.exe rubyfile.rb - -Will run rubyfile.rb with the IronRuby compiler. - -== Package - - /bin IronRuby binaries, ir.exe, iirb, irake, igem, iri, irdoc, etc. - /lib Ruby standard library, including RubyGems - CHANGELOG.txt Changes for each release - RELEASE.txt Release notes - LICENSE.Ruby.txt Ruby license - LICENSE.CPL.txt Common Public License - LICENSE.APACHE.html Apache License, Version 2.0 - README.txt This file - -== License - -Read the License.* files diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe deleted file mode 100644 index c879fd9bf2..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe.config b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe.config deleted file mode 100644 index 3bdfc53608..0000000000 --- a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Chiron.exe.config +++ /dev/null @@ -1,180 +0,0 @@ - - - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.Yaml.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.Yaml.dll deleted file mode 100644 index 265a0e553f..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.Yaml.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.dll deleted file mode 100644 index 477a87d187..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.Libraries.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.dll deleted file mode 100644 index 79b634a2ec..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/IronRuby.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Dynamic.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Dynamic.dll deleted file mode 100644 index 14b7ff99e0..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Dynamic.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.Metadata.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.Metadata.dll deleted file mode 100644 index 7d94df195f..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.Metadata.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.dll b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.dll deleted file mode 100644 index 61556abb80..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/Microsoft.Scripting.dll and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/ir.exe b/src/AddIns/BackendBindings/Ruby/IronRuby/bin/ir.exe deleted file mode 100644 index 728b191245..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/IronRuby/bin/ir.exe and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding.sln b/src/AddIns/BackendBindings/Ruby/RubyBinding.sln deleted file mode 100644 index 232771300d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding.sln +++ /dev/null @@ -1,156 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -# SharpDevelop 4.3 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RubyBinding", "RubyBinding\Project\RubyBinding.csproj", "{C896FFFF-5B6C-4B0E-B6DF-049865F501B4}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RubyBinding.Tests", "RubyBinding\Test\RubyBinding.Tests.csproj", "{01DF0475-0CB2-4E81-971B-BADC60CDE3A5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "..\..\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.AvalonEdit", "..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj", "{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "..\..\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting.Tests", "..\..\Analysis\UnitTesting\Test\UnitTesting.Tests.csproj", "{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting", "..\Scripting\Project\ICSharpCode.Scripting.csproj", "{7048AE18-EB93-4A84-82D0-DD60EB58ADBD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Scripting.Tests", "..\Scripting\Test\ICSharpCode.Scripting.Tests.csproj", "{85C09AD8-183B-403A-869A-7226646218A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core.WinForms", "..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj", "{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Release|Any CPU.Build.0 = Release|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Release|Any CPU.Build.0 = Release|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.Build.0 = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.Build.0 = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.Build.0 = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.Build.0 = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|Any CPU.Build.0 = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|Any CPU.ActiveCfg = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Any CPU.Build.0 = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|Any CPU.ActiveCfg = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|x86.Build.0 = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Debug|x86.ActiveCfg = Debug|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.Build.0 = Release|x86 - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD}.Release|x86.ActiveCfg = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|Any CPU.Build.0 = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|Any CPU.ActiveCfg = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|x86.Build.0 = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Debug|x86.ActiveCfg = Debug|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|Any CPU.Build.0 = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|Any CPU.ActiveCfg = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|x86.Build.0 = Release|x86 - {85C09AD8-183B-403A-869A-7226646218A9}.Release|x86.ActiveCfg = Release|x86 - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.Build.0 = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.Build.0 = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Debug|x86.ActiveCfg = Debug|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.Build.0 = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|Any CPU.ActiveCfg = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.Build.0 = Release|Any CPU - {857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}.Release|x86.ActiveCfg = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|x86.Build.0 = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Debug|x86.ActiveCfg = Debug|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|x86.Build.0 = Release|Any CPU - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181}.Release|x86.ActiveCfg = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.Build.0 = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Debug|x86.ActiveCfg = Debug|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.Build.0 = Release|Any CPU - {1F261725-6318-4434-A1B1-6C70CE4CD324}.Release|x86.ActiveCfg = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.Build.0 = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Debug|x86.ActiveCfg = Debug|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.Build.0 = Release|Any CPU - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}.Release|x86.ActiveCfg = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.Build.0 = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Debug|x86.ActiveCfg = Debug|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.Build.0 = Release|Any CPU - {0162E499-42D0-409B-AA25-EED21F75336B}.Release|x86.ActiveCfg = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.Build.0 = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|x86.ActiveCfg = Debug|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.Build.0 = Release|Any CPU - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|x86.ActiveCfg = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.Build.0 = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|x86.ActiveCfg = Debug|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.Build.0 = Release|Any CPU - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|x86.ActiveCfg = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.Build.0 = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|x86.ActiveCfg = Debug|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.Build.0 = Release|Any CPU - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|x86.ActiveCfg = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.Build.0 = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|x86.ActiveCfg = Debug|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.Build.0 = Release|Any CPU - {2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|x86.ActiveCfg = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|x86.Build.0 = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Debug|x86.ActiveCfg = Debug|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|x86.Build.0 = Release|Any CPU - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57}.Release|x86.ActiveCfg = Release|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Debug|x86.Build.0 = Debug|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Debug|x86.ActiveCfg = Debug|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Release|x86.Build.0 = Release|Any CPU - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5}.Release|x86.ActiveCfg = Release|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Debug|x86.Build.0 = Debug|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Debug|x86.ActiveCfg = Debug|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Release|x86.Build.0 = Release|Any CPU - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Configuration/AssemblyInfo.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Configuration/AssemblyInfo.cs deleted file mode 100644 index e288272222..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("RubyBinding")] -[assembly: AssemblyDescription("IronRuby addin for SharpDevelop.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/Ruby.xshd b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/Ruby.xshd deleted file mode 100644 index f9b1cc75dd..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/Ruby.xshd +++ /dev/null @@ -1,202 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' - ' - - - - - - - - """ - """ - - - - =begin - =end - - - - \# - - - - " - " - - - - - - - - abort - Array - at_exit - autoload - binding - callcc - caller - chomp - chop - eval - exec - exit - fail - Float - fork - format - gets - global_variables - gsub - Integer - lambda - proc - load - local_variables - loop - open - p - print - print - printf - putc - puts - rand - readline - scan - select - set_trace_func - sleep - split - sprintf - srand - String - syscall - system - sub - test - throw - trace_var - trap - untrace_var - - - - class - module - public - protected - private - - - - begin - rescue - ensure - raise - catch - - - - def - end - undef - - - - require - alias - - - - for - do - in - while - until - - - - break - yield - redo - return - retry - next - - - - and - not - or - - - - nil - - - - elsif - else - if - then - case - unless - - - - true - false - - - - defined - - - - self - - - - super - - - \b[\d\w_]+(?=(\s*\()) - \b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)? - - - [?,.;()\[\]{}+\-/%*<>^+~!|&]+ - - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/RubyOptionsPanel.xfrm b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/RubyOptionsPanel.xfrm deleted file mode 100644 index e2bec0ef05..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Resources/RubyOptionsPanel.xfrm +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.addin b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.addin deleted file mode 100644 index cedbb294d9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.addin +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.csproj b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.csproj deleted file mode 100644 index 3579c20d7d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/RubyBinding.csproj +++ /dev/null @@ -1,241 +0,0 @@ - - - - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4} - Debug - AnyCPU - Library - ICSharpCode.RubyBinding - RubyBinding - v4.0 - C:\Users\matt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis - False - False - 4 - false - - - - - ..\..\..\..\..\..\AddIns\BackendBindings\RubyBinding\ - true - Full - False - True - DEBUG;TRACE - - - ..\..\..\..\..\..\AddIns\BackendBindings\RubyBinding\ - false - None - True - False - TRACE - - - False - Auto - 4194304 - x86 - 4096 - - - - - ..\..\IronRuby\bin\Chiron.exe - - - ..\..\IronRuby\bin\ir.exe - - - ..\..\IronRuby\bin\IronRuby.dll - - - ..\..\IronRuby\bin\IronRuby.Libraries.dll - - - - - ..\..\IronRuby\bin\Microsoft.Dynamic.dll - True - - - ..\..\IronRuby\bin\Microsoft.Scripting.dll - True - - - ..\..\IronRuby\bin\Microsoft.Scripting.Metadata.dll - True - - - 3.0 - - - 3.0 - - - - - - - - 4.0 - - - - 3.0 - - - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chiron.exe.config - Always - - - LICENSE.APACHE.html - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} - ICSharpCode.AvalonEdit - False - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - False - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - False - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - False - - - {1F261725-6318-4434-A1B1-6C70CE4CD324} - UnitTesting - False - - - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} - FormsDesigner - False - - - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD} - ICSharpCode.Scripting - False - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertProjectToRubyProjectCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertProjectToRubyProjectCommand.cs deleted file mode 100644 index 2fc272375b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertProjectToRubyProjectCommand.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; - -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.SharpDevelop.Project.Converter; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Converts a C# or VB.NET project to Ruby. - /// - public class ConvertProjectToRubyProjectCommand : LanguageConverter - { - public override string TargetLanguageName { - get { return RubyProjectBinding.LanguageName; } - } - - /// - /// Creates an RubyProject. - /// - protected override IProject CreateProject(string targetProjectDirectory, IProject sourceProject) - { - RubyProject targetProject = (RubyProject)base.CreateProject(targetProjectDirectory, sourceProject); - return targetProject; - } - - /// - /// Converts C# and VB.NET files to Ruby and saves the files. - /// - protected override void ConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem) - { - ParseInformation parseInfo = GetParseInfo(sourceItem.FileName); - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create(sourceItem.Include, parseInfo); - if (converter != null) { - targetItem.Include = ChangeFileExtensionToRubyFileExtension(sourceItem.Include); - - string code = GetParseableFileContent(sourceItem.FileName); - string rubyCode = converter.Convert(code); - - RubyProject rubyTargetProject = (RubyProject)targetItem.Project; - if ((converter.EntryPointMethods.Count > 0) && !rubyTargetProject.HasMainFile) { - rubyTargetProject.AddMainFile(targetItem.Include); - // Add code to call main method at the end of the file. - rubyCode += "\r\n\r\n" + converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - } - SaveFile(targetItem.FileName, rubyCode, GetDefaultFileEncoding()); - } else { - LanguageConverterConvertFile(sourceItem, targetItem); - } - } - - /// - /// Adds the MainFile property since adding it in the CreateProject method would mean - /// it gets removed via the base class CopyProperties method. - /// - protected override void CopyProperties(IProject sourceProject, IProject targetProject) - { - base.CopyProperties(sourceProject, targetProject); - } - - /// - /// Calls the LanguageConverter class method ConvertFile which copies the source file to the target - /// file without any modifications. - /// - protected virtual void LanguageConverterConvertFile(FileProjectItem sourceItem, FileProjectItem targetItem) - { - base.ConvertFile(sourceItem, targetItem); - } - - /// - /// Writes the specified file to disk. - /// - protected virtual void SaveFile(string fileName, string content, Encoding encoding) - { - File.WriteAllText(fileName, content, encoding); - } - - /// - /// Gets the content of the file from the parser service. - /// - protected virtual string GetParseableFileContent(string fileName) - { - return ParserService.GetParseableFileContent(fileName).Text; - } - - /// - /// Gets the project content for the specified project. - /// - protected virtual IProjectContent GetProjectContent(IProject project) - { - return ParserService.GetProjectContent(project); - } - - protected virtual ParseInformation GetParseInfo(string fileName) - { - return ParserService.GetParseInformation(fileName); - } - - protected virtual Encoding GetDefaultFileEncoding() - { - return FileService.DefaultFileEncoding.GetEncoding(); - } - - /// - /// Changes the extension to ".rb" - /// - static string ChangeFileExtensionToRubyFileExtension(string fileName) - { - return Path.ChangeExtension(fileName, ".rb"); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertToRubyMenuCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertToRubyMenuCommand.cs deleted file mode 100644 index c2fbea745e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/ConvertToRubyMenuCommand.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Converts VB.NET or C# code to Ruby. - /// - public class ConvertToRubyMenuCommand : AbstractMenuCommand - { - ScriptingTextEditorViewContent view; - - public override void Run() - { - Run(new RubyWorkbench()); - } - - protected void Run(IScriptingWorkbench workbench) - { - view = new ScriptingTextEditorViewContent(workbench); - string code = GenerateRubyCode(); - ShowRubyCodeInNewWindow(code); - } - - string GenerateRubyCode() - { - ParseInformation parseInfo = GetParseInformation(view.PrimaryFileName); - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create(view.PrimaryFileName, parseInfo); - converter.IndentString = view.TextEditorOptions.IndentationString; - return converter.Convert(view.EditableView.Text); - } - - void ShowRubyCodeInNewWindow(string code) - { - NewFile("Generated.rb", "Ruby", code); - } - - protected virtual ParseInformation GetParseInformation(string fileName) - { - return ParserService.GetParseInformation(fileName); - } - - /// - /// Creates a new file using the FileService by default. - /// - protected virtual void NewFile(string defaultName, string language, string content) - { - FileService.NewFile(defaultName, content); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/NRefactoryToRubyConverter.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/NRefactoryToRubyConverter.cs deleted file mode 100644 index 12c1bfc2d6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/NRefactoryToRubyConverter.cs +++ /dev/null @@ -1,1582 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Collections.ObjectModel; -using System.IO; -using System.Text; -using ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Ast; -using ICSharpCode.NRefactory.Parser; -using ICSharpCode.NRefactory.PrettyPrinter; -using ICSharpCode.NRefactory.Visitors; -using Dom = ICSharpCode.SharpDevelop.Dom; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Used to convert VB.NET and C# to Ruby. - /// - public class NRefactoryToRubyConverter : NodeTrackingAstVisitor, IOutputFormatter - { - SupportedLanguage language; - Dom.ParseInformation parseInfo; - - string indentString = "\t"; - RubyCodeBuilder codeBuilder; - - NamespaceDeclaration currentNamespaceDeclaration; - TypeDeclaration currentTypeDeclaration; - MethodDeclaration currentMethod; - bool addedMscorlibRequire; - - // Holds the constructor for the class being converted. This is used to identify class fields. - RubyConstructorInfo constructorInfo; - - // Holds the parameters of the current method. This is used to identify - // references to fields or parameters. - List methodParameters = new List(); - - // Holds the names of any parameters defined for this class. - List propertyNames = new List(); - - List entryPointMethods; - - SpecialNodesInserter specialNodesInserter; - - public NRefactoryToRubyConverter(SupportedLanguage language, Dom.ParseInformation parseInfo) - { - this.language = language; - this.parseInfo = parseInfo; - } - - public NRefactoryToRubyConverter(SupportedLanguage language) - : this(language, - new Dom.ParseInformation(new Dom.DefaultCompilationUnit(new Dom.DefaultProjectContent()))) - { - } - - /// - /// Gets or sets the source language that will be converted to Ruby. - /// - public SupportedLanguage SupportedLanguage { - get { return language; } - } - - /// - /// Creates either C# to Ruby or VB.NET to Ruby converter based on the filename extension that is to be converted. - /// - /// Null if the file cannot be converted. - public static NRefactoryToRubyConverter Create(string fileName, Dom.ParseInformation parseInfo) - { - if (CanConvert(fileName)) { - if (parseInfo == null) { - throw new ArgumentNullException("parseInfo"); - } - return new NRefactoryToRubyConverter(GetSupportedLanguage(fileName), parseInfo); - } - return null; - } - - /// - /// Only C# (.cs) or VB.NET (.vb) files can be converted. - /// - public static bool CanConvert(string fileName) - { - string extension = Path.GetExtension(fileName); - if (!String.IsNullOrEmpty(extension)) { - extension = extension.ToLowerInvariant(); - return (extension == ".cs") || (extension == ".vb"); - } - return false; - } - - /// - /// Gets or sets the string that will be used to indent the generated Ruby code. - /// - public string IndentString { - get { return indentString; } - set { indentString = value; } - } - - /// - /// Generates compilation unit from the code. - /// - /// - /// Uses ISpecials so comments can be converted. - /// - /// - /// The code to convert to a compilation unit. - /// - public CompilationUnit GenerateCompilationUnit(string source, SupportedLanguage language) - { - using (IParser parser = ParserFactory.CreateParser(language, new StringReader(source))) { - parser.Parse(); - parser.CompilationUnit.UserData = parser.Lexer.SpecialTracker.RetrieveSpecials(); - return parser.CompilationUnit; - } - } - - /// - /// Converts the source code to Ruby. - /// - public string Convert(string source) - { - return Convert(source, language); - } - - /// - /// Converts the source code to Ruby. - /// - public string Convert(string source, SupportedLanguage language) - { - // Convert to NRefactory code DOM. - CompilationUnit unit = GenerateCompilationUnit(source, language); - - SpecialOutputVisitor specialOutputVisitor = new SpecialOutputVisitor(this); - specialNodesInserter = new SpecialNodesInserter(unit.UserData as List, specialOutputVisitor); - - // Convert to Ruby code. - entryPointMethods = new List(); - codeBuilder = new RubyCodeBuilder(); - codeBuilder.IndentString = indentString; - unit.AcceptVisitor(this, null); - - return codeBuilder.ToString().Trim(); - } - - /// - /// Gets a list of possible entry point methods found when converting the - /// ruby source code. - /// - public ReadOnlyCollection EntryPointMethods { - get { return entryPointMethods.AsReadOnly(); } - } - - public string GenerateMainMethodCall(MethodDeclaration methodDeclaration) - { - StringBuilder code = new StringBuilder(); - code.Append(GetTypeName(methodDeclaration)); - code.Append('.'); - code.Append(methodDeclaration.Name); - code.Append('('); - if (methodDeclaration.Parameters.Count > 0) { - code.Append("nil"); - } - code.Append(')'); - - return code.ToString(); - } - - /// - /// Converts from the NRefactory's binary operator type to a string. - /// - public static string GetBinaryOperator(BinaryOperatorType binaryOperatorType) - { - switch (binaryOperatorType) { - case BinaryOperatorType.Add: - return "+"; - case BinaryOperatorType.BitwiseAnd: - return "&"; - case BinaryOperatorType.BitwiseOr: - return "|"; - case BinaryOperatorType.Divide: - case BinaryOperatorType.DivideInteger: - return "/"; - case BinaryOperatorType.ShiftLeft: - return "<<"; - case BinaryOperatorType.ShiftRight: - return ">>"; - case BinaryOperatorType.GreaterThan: - return ">"; - case BinaryOperatorType.GreaterThanOrEqual: - return ">="; - case BinaryOperatorType.InEquality: - return "!="; - case BinaryOperatorType.LessThan: - return "<"; - case BinaryOperatorType.LessThanOrEqual: - return "<="; - case BinaryOperatorType.LogicalAnd: - return "and"; - case BinaryOperatorType.LogicalOr: - return "or"; - case BinaryOperatorType.ExclusiveOr: - return "^"; - case BinaryOperatorType.Modulus: - return "%"; - case BinaryOperatorType.Multiply: - return "*"; - case BinaryOperatorType.ReferenceEquality: - return "is"; - case BinaryOperatorType.Subtract: - return "-"; - case BinaryOperatorType.Concat: - return "+"; - default: - return "=="; - } - } - - public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) - { - string arrayType = GetTypeName(arrayCreateExpression.CreateType); - if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) { - Append("Array.CreateInstance(" + arrayType); - if (arrayCreateExpression.Arguments.Count > 0) { - foreach (Expression expression in arrayCreateExpression.Arguments) { - Append(", "); - expression.AcceptVisitor(this, data); - } - Append(")"); - } else { - Append(", 0)"); - } - } else { - Append("Array[" + arrayType + "].new"); - - // Add initializers. - Append("(["); - bool firstItem = true; - foreach (Expression expression in arrayCreateExpression.ArrayInitializer.CreateExpressions) { - if (firstItem) { - firstItem = false; - } else { - Append(", "); - } - expression.AcceptVisitor(this, data); - } - Append("])"); - } - return null; - } - - public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) - { - switch (assignmentExpression.Op) { - case AssignmentOperatorType.Assign: - return CreateSimpleAssignment(assignmentExpression, "=", data); - case AssignmentOperatorType.Add: - if (IsAddEventHandler(assignmentExpression)) { - return CreateAddHandlerStatement(assignmentExpression.Left, assignmentExpression.Right); - } - return CreateSimpleAssignment(assignmentExpression, "+=", data); - case AssignmentOperatorType.Subtract: - if (IsRemoveEventHandler(assignmentExpression)) { - return CreateRemoveHandlerStatement(assignmentExpression.Left, assignmentExpression.Right); - } - return CreateSimpleAssignment(assignmentExpression, "-=", data); - case AssignmentOperatorType.Modulus: - return CreateSimpleAssignment(assignmentExpression, "%=", data); - case AssignmentOperatorType.Multiply: - return CreateSimpleAssignment(assignmentExpression, "*=", data); - case AssignmentOperatorType.Divide: - case AssignmentOperatorType.DivideInteger: - return CreateSimpleAssignment(assignmentExpression, "/=", data); - case AssignmentOperatorType.BitwiseAnd: - return CreateSimpleAssignment(assignmentExpression, "&=", data); - case AssignmentOperatorType.BitwiseOr: - return CreateSimpleAssignment(assignmentExpression, "|=", data); - case AssignmentOperatorType.ExclusiveOr: - return CreateSimpleAssignment(assignmentExpression, "^=", data); - case AssignmentOperatorType.ShiftLeft: - return CreateSimpleAssignment(assignmentExpression, "<<=", data); - case AssignmentOperatorType.ShiftRight: - return CreateSimpleAssignment(assignmentExpression, ">>=", data); - case AssignmentOperatorType.ConcatString: - return CreateSimpleAssignment(assignmentExpression, "+=", data); - case AssignmentOperatorType.Power: - return CreateSimpleAssignment(assignmentExpression, "**=", data); - } - return null; - } - - /// - /// Converts a base class reference to a this reference. - /// Ruby has no concept of a direct base class reference so - /// "base" is converted to "self". - /// - public override object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) - { - Append("self"); - return null; - } - - public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) - { - binaryOperatorExpression.Left.AcceptVisitor(this, data); - Append(" "); - Append(GetBinaryOperator(binaryOperatorExpression.Op)); - Append(" "); - binaryOperatorExpression.Right.AcceptVisitor(this, data); - return null; - } - - public override object TrackedVisitBreakStatement(BreakStatement breakStatement, object data) - { - AppendIndentedLine("break"); - return null; - } - - /// - /// A ternary operator expression. The right hand side of the following: - /// - /// string a = test ? "Ape" : "Monkey"; - /// - /// In Ruby this gets converted to: - /// - /// a = test : "Ape" : "Monkey" - /// - public override object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data) - { - // Add condition. - conditionalExpression.Condition.AcceptVisitor(this, data); - Append(" ? "); - - // Add true part. - conditionalExpression.TrueExpression.AcceptVisitor(this, data); - - Append(" : "); - - // Add false part. - conditionalExpression.FalseExpression.AcceptVisitor(this, data); - return null; - } - - public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) - { - CreateConstructor(constructorInfo); - return null; - } - - public override object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data) - { - AppendIndentedLine("next"); - return null; - } - - public override object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) - { - AppendIndentedLine("def finalize()"); - IncreaseIndent(); - destructorDeclaration.Body.AcceptVisitor(this, data); - DecreaseIndent(); - AppendIndentedLine("end"); - return null; - } - - public override object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) - { - AppendIndented("while "); - doLoopStatement.Condition.AcceptVisitor(this, data); - AppendLine(); - - IncreaseIndent(); - doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - AppendIndentedLine("end"); - return null; - } - - public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) - { - AppendIndented("elsif "); - elseIfSection.Condition.AcceptVisitor(this, data); - Append(" then"); - AppendLine(); - - // Convert else if body statements. - IncreaseIndent(); - elseIfSection.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - return null; - } - - public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data) - { - AppendIndented(String.Empty); - expressionStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data) - { - AppendIndentedLine("break"); - return null; - } - - public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) - { - return null; - } - - public override object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data) - { - // Convert the for loop's initializers. - AppendIndented(String.Empty); - CreateInitStatement(foreachStatement); - AppendLine(); - - // Convert the for loop's test expression. - AppendIndentedLine("while enumerator.MoveNext()"); - - // Move the initializer in the foreach loop to the - // first line of the for loop's body. - IncreaseIndent(); - AppendIndentedLine(foreachStatement.VariableName + " = enumerator.Current"); - - // Visit the for loop's body. - foreachStatement.EmbeddedStatement.AcceptVisitor(this, data); - DecreaseIndent(); - - AppendIndentedLine("end"); - - return null; - } - - public override object TrackedVisitForStatement(ForStatement forStatement, object data) - { - // Convert the for loop's initializers. - foreach (Statement statement in forStatement.Initializers) { - statement.AcceptVisitor(this, data); - } - - // Convert the for loop's test expression. - AppendIndented("while "); - forStatement.Condition.AcceptVisitor(this, data); - AppendLine(); - - // Visit the for loop's body. - IncreaseIndent(); - forStatement.EmbeddedStatement.AcceptVisitor(this, data); - - // Convert the for loop's increment statement. - foreach (Statement statement in forStatement.Iterator) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - AppendIndentedLine("end"); - - return null; - } - - public override object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data) - { - // Convert the for loop's initializers. - string variableName = forNextStatement.VariableName; - AppendIndented(variableName); - Append(" = "); - forNextStatement.Start.AcceptVisitor(this, data); - AppendLine(); - - // Convert the for loop's test expression. - AppendIndented("while "); - Append(variableName); - Append(" <= "); - forNextStatement.End.AcceptVisitor(this, data); - AppendLine(); - - // Visit the for loop's body. - IncreaseIndent(); - forNextStatement.EmbeddedStatement.AcceptVisitor(this, data); - - // Convert the for loop's increment statement. - AppendIndented(variableName); - Append(" = "); - Append(variableName); - Append(" + "); - if (forNextStatement.Step.IsNull) { - Append("1"); - } else { - forNextStatement.Step.AcceptVisitor(this, data); - } - AppendLine(); - DecreaseIndent(); - AppendIndentedLine("end"); - - return null; - } - - public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) - { - string name = identifierExpression.Identifier; - if (IsField(name)) { - Append("@" + name); - } else if (IsProperty(name) && !IsMethodParameter(name)) { - Append("self." + name); - } else { - Append(name); - } - return null; - } - - public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data) - { - indexerExpression.TargetObject.AcceptVisitor(this, data); - - // Add indices. - foreach (Expression expression in indexerExpression.Indexes) { - Append("["); - expression.AcceptVisitor(this, data); - Append("]"); - } - - return null; - } - - public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data) - { - // Convert condition. - AppendIndented("if "); - ifElseStatement.Condition.AcceptVisitor(this, data); - Append(" then"); - AppendLine(); - - // Convert true statements. - IncreaseIndent(); - foreach (Statement statement in ifElseStatement.TrueStatement) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - - // Convert else if sections. - if (ifElseStatement.HasElseIfSections) { - foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) { - elseIfSection.AcceptVisitor(this, data); - } - } - - // Convert false statements. - if (ifElseStatement.HasElseStatements) { - AppendIndentedLine("else"); - IncreaseIndent(); - foreach (Statement statement in ifElseStatement.FalseStatement) { - statement.AcceptVisitor(this, data); - } - DecreaseIndent(); - } - AppendIndentedLine("end"); - - return null; - } - - public override object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data) - { - MemberReferenceExpression memberRefExpression = invocationExpression.TargetObject as MemberReferenceExpression; - IdentifierExpression identifierExpression = invocationExpression.TargetObject as IdentifierExpression; - if (memberRefExpression != null) { - memberRefExpression.TargetObject.AcceptVisitor(this, data); - Append("." + memberRefExpression.MemberName); - } else if (identifierExpression != null) { - if ((currentMethod != null) && IsStatic(currentMethod)) { - Append(GetTypeName(currentMethod) + "."); - } else { - Append("self."); - } - Append(identifierExpression.Identifier); - } - - // Create method parameters - Append("("); - bool firstParam = true; - foreach (Expression param in invocationExpression.Arguments) { - if (firstParam) { - firstParam = false; - } else { - Append(", "); - } - param.AcceptVisitor(this, data); - } - Append(")"); - return null; - } - - /// - /// The variable declaration is not created if the variable has no initializer. - /// - public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) - { - foreach (VariableDeclaration variableDeclaration in localVariableDeclaration.Variables) { - if (!variableDeclaration.Initializer.IsNull) { - - // Create variable declaration. - AppendIndented(variableDeclaration.Name + " = "); - - // Generate the variable initializer. - AddTypeToArrayInitializerIfMissing(variableDeclaration); - variableDeclaration.Initializer.AcceptVisitor(this, data); - AppendLine(); - } - } - return null; - } - - public override object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) - { - memberReferenceExpression.TargetObject.AcceptVisitor(this, data); - if ((memberReferenceExpression.TargetObject is ThisReferenceExpression) && !IsProperty(memberReferenceExpression.MemberName)) { - Append(".@"); - } else { - Append("."); - } - Append(memberReferenceExpression.MemberName); - return null; - } - - public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) - { - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - - // Add method name. - currentMethod = methodDeclaration; - string methodName = methodDeclaration.Name; - AppendIndented("def "); - if (IsStatic(methodDeclaration)) { - Append(currentTypeDeclaration.Name); - Append("."); - } - Append(methodName); - - // Add the parameters. - AddParameters(methodDeclaration); - methodParameters = methodDeclaration.Parameters; - AppendLine(); - - IncreaseIndent(); - if (methodDeclaration.Body.Children.Count > 0) { - methodDeclaration.Body.AcceptVisitor(this, data); - } - DecreaseIndent(); - AppendIndentedLine("end"); - AppendLine(); - - if (IsStatic(methodDeclaration)) { - SaveMethodIfMainEntryPoint(methodDeclaration); - } - currentMethod = null; - - return null; - } - - public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) - { - Append(namedArgumentExpression.Name); - Append(" = "); - namedArgumentExpression.Expression.AcceptVisitor(this, data); - return null; - } - - public override object TrackedVisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) - { - Append(memberInitializerExpression.Name); - Append(" = "); - memberInitializerExpression.Expression.AcceptVisitor(this, data); - return null; - } - - public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) - { - currentNamespaceDeclaration = namespaceDeclaration; - - codeBuilder.AppendLineIfPreviousLineIsCode(); - AppendIndentedLine("module " + namespaceDeclaration.Name); - - IncreaseIndent(); - namespaceDeclaration.AcceptChildren(this, data); - DecreaseIndent(); - - AppendIndentedLine("end"); - - return null; - } - - public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) - { - Append(objectCreateExpression.CreateType.Type); - if (IsGenericType(objectCreateExpression)) { - AppendGenericTypes(objectCreateExpression); - } - Append(".new("); - - // Add parameters. - bool firstParameter = true; - foreach (Expression expression in objectCreateExpression.Parameters) { - if (!firstParameter) { - Append(", "); - } - expression.AcceptVisitor(this, data); - firstParameter = false; - } - - // Add object initializers. - bool firstInitializer = true; - foreach (Expression expression in objectCreateExpression.ObjectInitializer.CreateExpressions) { - if (!firstInitializer) { - Append(", "); - } - expression.AcceptVisitor(this, data); - firstInitializer = false; - } - - Append(")"); - return null; - } - - public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) - { - Append("(" ); - parenthesizedExpression.Expression.AcceptVisitor(this, data); - Append(")"); - return null; - } - - public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) - { - if (primitiveExpression.Value == null) { - Append("nil"); - } else if (primitiveExpression.Value is Boolean) { - Append(primitiveExpression.Value.ToString().ToLowerInvariant()); - } else { - Append(primitiveExpression.StringValue); - } - return null; - } - - public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) - { - string propertyName = propertyDeclaration.Name; - propertyNames.Add(propertyName); - - // Add get statements. - if (propertyDeclaration.HasGetRegion) { - AppendIndentedLine("def " + propertyName); - IncreaseIndent(); - propertyDeclaration.GetRegion.Block.AcceptVisitor(this, data); - DecreaseIndent(); - AppendIndentedLine("end"); - AppendLine(); - } - - // Add set statements. - if (propertyDeclaration.HasSetRegion) { - AppendIndentedLine("def " + propertyName + "=(value)"); - IncreaseIndent(); - propertyDeclaration.SetRegion.Block.AcceptVisitor(this, data); - DecreaseIndent(); - AppendIndentedLine("end"); - AppendLine(); - } - - return null; - } - - public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) - { - return null; - } - - public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) - { - return null; - } - - public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data) - { - AppendIndented("return "); - returnStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data) - { - AppendIndented("case "); - switchStatement.SwitchExpression.AcceptVisitor(this, null); - AppendLine(); - IncreaseIndent(); - - foreach (SwitchSection section in switchStatement.SwitchSections) { - CreateSwitchCondition(section); - - IncreaseIndent(); - CreateSwitchConditionBody(section); - DecreaseIndent(); - } - DecreaseIndent(); - AppendIndentedLine("end"); - return null; - } - - public override object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) - { - Append("self"); - return null; - } - - public override object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data) - { - AppendIndented("raise "); - throwStatement.Expression.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - public override object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) - { - // Convert try-catch body. - AppendIndentedLine("begin"); - IncreaseIndent(); - tryCatchStatement.StatementBlock.AcceptVisitor(this, data); - DecreaseIndent(); - - // Convert catches. - foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) { - AppendIndented("rescue "); - Append(catchClause.TypeReference.Type); - Append(" => " + catchClause.VariableName); - AppendLine(); - - // Convert catch child statements. - IncreaseIndent(); - catchClause.StatementBlock.AcceptVisitor(this, data); - DecreaseIndent(); - } - - // Convert finally block. - AppendIndentedLine("ensure"); - IncreaseIndent(); - tryCatchStatement.FinallyBlock.AcceptVisitor(this, data); - DecreaseIndent(); - AppendIndentedLine("end"); - - return null; - } - - /// - /// Visits a class. - /// - public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) - { - currentTypeDeclaration = typeDeclaration; - - if (currentNamespaceDeclaration == null) { - codeBuilder.AppendLineIfPreviousLineIsCode(); - } - - AppendIndented("class " + typeDeclaration.Name); - AppendBaseTypes(typeDeclaration.BaseTypes); - AppendLine(); - IncreaseIndent(); - if (typeDeclaration.Children.Count > 0) { - // Look for fields or a constructor for the type. - constructorInfo = RubyConstructorInfo.GetConstructorInfo(typeDeclaration); - if (constructorInfo != null) { - if (constructorInfo.Constructor != null) { - // Generate constructor later when VisitConstructorDeclaration method is called. - // This allows the constructor comments to be converted in the right place. - } else { - CreateConstructor(constructorInfo); - } - } - - // Visit the rest of the class. - typeDeclaration.AcceptChildren(this, data); - } - DecreaseIndent(); - codeBuilder.TrimEnd(); - AppendLine(); - AppendIndentedLine("end"); - return null; - } - - public override object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) - { - codeBuilder.InsertIndentedLine("require \"mscorlib\"\r\n"); - Append(GetTypeName(typeOfExpression.TypeReference)); - Append(".to_clr_type"); - return null; - } - - public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) - { - Append(GetTypeName(typeReferenceExpression.TypeReference)); - return null; - } - - public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) - { - switch (unaryOperatorExpression.Op) { - case UnaryOperatorType.PostIncrement: - case UnaryOperatorType.Increment: - // Change i++ or ++i to i += 1 - return CreateIncrementStatement(unaryOperatorExpression); - case UnaryOperatorType.Decrement: - case UnaryOperatorType.PostDecrement: - // Change --i or i-- to i -= 1. - return CreateDecrementStatement(unaryOperatorExpression); - case UnaryOperatorType.Minus: - return CreateUnaryOperatorStatement(GetBinaryOperator(BinaryOperatorType.Subtract), unaryOperatorExpression.Expression); - case UnaryOperatorType.Plus: - return CreateUnaryOperatorStatement(GetBinaryOperator(BinaryOperatorType.Add), unaryOperatorExpression.Expression); - case UnaryOperatorType.Not: - return CreateUnaryOperatorStatement("not ", unaryOperatorExpression.Expression); - case UnaryOperatorType.BitNot: - return CreateUnaryOperatorStatement("~", unaryOperatorExpression.Expression); - } - return null; - } - - /// - /// Converts using declarations into Ruby require statements. - /// - public override object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) - { - if (!addedMscorlibRequire) { - AppendIndentedLine("require \"mscorlib\""); - addedMscorlibRequire = true; - } - - // Add import statements for each using. - foreach (Using @using in usingDeclaration.Usings) { - AppendIndentedLine("require \"" + @using.Name + ", Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\""); - } - return null; - } - - public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) - { - AppendIndented(variableDeclaration.Name + " = "); - variableDeclaration.Initializer.AcceptVisitor(this, data); - AppendLine(); - return null; - } - - /// - /// Gets the supported language either C# or VB.NET - /// - static SupportedLanguage GetSupportedLanguage(string fileName) - { - string extension = Path.GetExtension(fileName.ToLowerInvariant()); - if (extension == ".vb") { - return SupportedLanguage.VBNet; - } - return SupportedLanguage.CSharp; - } - - void IncreaseIndent() - { - codeBuilder.IncreaseIndent(); - } - - void DecreaseIndent() - { - codeBuilder.DecreaseIndent(); - } - - void Append(string code) - { - codeBuilder.Append(code); - } - - void AppendIndented(string code) - { - codeBuilder.AppendIndented(code); - } - - void AppendIndentedLine(string code) - { - codeBuilder.AppendIndentedLine(code); - } - - void AppendLine() - { - codeBuilder.AppendLine(); - } - - /// - /// Adds the method or constructor parameters. - /// - void AddParameters(ParametrizedNode method) - { - Append("("); - List parameters = method.Parameters; - if (parameters.Count > 0) { - for (int i = 0; i < parameters.Count; ++i) { - if (i > 0) { - Append(", "); - } - Append(parameters[i].ParameterName); - } - } - Append(")"); - } - - /// - /// Determines whether the identifier refers to a field in the - /// current class. - /// - bool IsField(string name) - { - // Check the current method's parameters. - if (IsMethodParameter(name)) { - return false; - } - - // Check the current class's fields. - if (constructorInfo != null) { - foreach (FieldDeclaration field in constructorInfo.Fields) { - foreach (VariableDeclaration variable in field.Fields) { - if (variable.Name == name) { - return true; - } - } - } - } - return false; - } - - bool IsMethodParameter(string name) - { - foreach (ParameterDeclarationExpression param in methodParameters) { - if (param.ParameterName == name) { - return true; - } - } - return false; - } - - bool IsProperty(string name) - { - return propertyNames.Contains(name); - } - - /// - /// Creates assignments of the form: - /// i = 1 - /// - object CreateSimpleAssignment(AssignmentExpression assignmentExpression, string op, object data) - { - assignmentExpression.Left.AcceptVisitor(this, data); - Append(" " + op + " "); - assignmentExpression.Right.AcceptVisitor(this, data); - return null; - } - - /// - /// Creates an attach statement (i.e. button.Click += ButtonClick) - /// - object CreateAddHandlerStatement(Expression eventExpression, Expression eventHandlerExpression) - { - CreateEventReferenceExpression(eventExpression); - CreateDelegateCreateExpression(eventHandlerExpression); - return null; - } - - /// - /// Creates a remove statement (i.e. button.Click -= ButtonClick) - /// - object CreateRemoveHandlerStatement(Expression eventExpression, Expression eventHandlerExpression) - { - CreateEventReferenceExpression(eventExpression); - Append(".remove(On"); - eventHandlerExpression.AcceptVisitor(this, null); - Append(")"); - return null; - } - - /// - /// Converts an expression to an event reference in Ruby. - /// (i.e. the "button.Click" part of "button.Click += ButtonClick". - /// - object CreateEventReferenceExpression(Expression eventExpression) - { - MemberReferenceExpression memberRef = eventExpression as MemberReferenceExpression; - memberRef.AcceptVisitor(this, null); - return null; - } - - /// - /// Creates an event handler expression - /// (i.e. the "ButtonClick" part of "button.Click += ButtonClick") - /// - object CreateDelegateCreateExpression(Expression eventHandlerExpression) - { - // Create event handler expression. - IdentifierExpression identifierExpression = eventHandlerExpression as IdentifierExpression; - ObjectCreateExpression objectCreateExpression = eventHandlerExpression as ObjectCreateExpression; - MemberReferenceExpression memberRefExpression = eventHandlerExpression as MemberReferenceExpression; - if (identifierExpression != null) { - CreateDelegateCreateExpression(identifierExpression); - } else if (memberRefExpression != null) { - CreateDelegateCreateExpression(memberRefExpression); - } else if (objectCreateExpression != null) { - CreateDelegateCreateExpression(objectCreateExpression.Parameters[0]); - } - return null; - } - - void CreateDelegateCreateExpression(IdentifierExpression identifierExpression) - { - string parameters = GetParameterNameStringForMethod(identifierExpression.Identifier); - AppendDelegateCreateExpressionStart(parameters); - Append("self." + identifierExpression.Identifier); - AppendDelegateCreateExpressionEnd(parameters); - } - - void AppendDelegateCreateExpressionStart(string parameters) - { - Append(" { "); - if (parameters.Length > 0) { - Append(String.Format("|{0}|", parameters)); - Append(" "); - } - } - - void AppendDelegateCreateExpressionEnd(string parameters) - { - Append(String.Format("({0})", parameters)); - Append(" }"); - } - - void CreateDelegateCreateExpression(MemberReferenceExpression memberRefExpression) - { - string parameters = GetParameterNameStringForMethod(memberRefExpression.MemberName); - AppendDelegateCreateExpressionStart(parameters); - memberRefExpression.AcceptVisitor(this, null); - AppendDelegateCreateExpressionEnd(parameters); - } - - string GetParameterNameStringForMethod(string methodName) - { - if (parseInfo.CompilationUnit != null) { - string className = GetFullyQualifiedCurrentClassName(); - Dom.IClass c = parseInfo.CompilationUnit.ProjectContent.GetClass(className, 0); - return GetParameterNameStringForMethod(c, methodName); - } - return String.Empty; - } - - string GetFullyQualifiedCurrentClassName() - { - string namespacePrefix = String.Empty; - if (currentNamespaceDeclaration != null) { - namespacePrefix = currentNamespaceDeclaration.Name + "."; - } - return namespacePrefix + currentTypeDeclaration.Name; - } - - string GetParameterNameStringForMethod(Dom.IClass c, string methodName) - { - if (c != null) { - foreach (Dom.IMethod method in c.Methods) { - if (methodName == method.Name) { - return GetParameterNameStringForMethod(method); - } - } - } - return String.Empty; - } - - string GetParameterNameStringForMethod(Dom.IMethod method) - { - StringBuilder parameters = new StringBuilder(); - for (int i = 0; i < method.Parameters.Count; ++i) { - Dom.IParameter parameter = method.Parameters[i]; - if (i > 0) { - parameters.Append(", "); - } - parameters.Append(parameter.Name); - } - return parameters.ToString(); - } - - /// - /// Determines whether the assignment expression is actually an - /// event handler attach statement. - /// - static bool IsAddEventHandler(AssignmentExpression assignmentExpression) - { - return (assignmentExpression.Op == AssignmentOperatorType.Add) && - (assignmentExpression.Left is MemberReferenceExpression); - } - - /// - /// Determines whether the assignment expression is actually an - /// event handler remove statement. - /// - static bool IsRemoveEventHandler(AssignmentExpression assignmentExpression) - { - return (assignmentExpression.Op == AssignmentOperatorType.Subtract) && - (assignmentExpression.Left is MemberReferenceExpression); - } - - void CreateConstructor(RubyConstructorInfo constructorInfo) - { - if (constructorInfo.Constructor != null) { - AppendIndented("def initialize"); - AddParameters(constructorInfo.Constructor); - methodParameters = constructorInfo.Constructor.Parameters; - } else { - AppendIndented("def initialize()"); - } - AppendLine(); - - // Add fields at start of constructor. - IncreaseIndent(); - if (constructorInfo.Fields.Count > 0) { - foreach (FieldDeclaration field in constructorInfo.Fields) { - CreateFieldInitialization(field); - } - } - - if (!IsEmptyConstructor(constructorInfo.Constructor)) { - constructorInfo.Constructor.Body.AcceptVisitor(this, null); - } - - DecreaseIndent(); - AppendIndentedLine("end"); - AppendLine(); - } - - /// - /// Returns true if the constructor has no statements in its body. - /// - static bool IsEmptyConstructor(ConstructorDeclaration constructor) - { - if (constructor != null) { - return constructor.Body.Children.Count == 0; - } - return true; - } - - /// - /// Checks that the field declaration has an initializer that - /// sets an initial value. - /// - static bool FieldHasInitialValue(VariableDeclaration variableDeclaration) - { - Expression initializer = variableDeclaration.Initializer; - return !initializer.IsNull; - } - - void CreateFieldInitialization(FieldDeclaration field) - { - foreach (VariableDeclaration variable in field.Fields) { - // Ignore field if it has no initializer. - if (FieldHasInitialValue(variable)) { - AddTypeToArrayInitializerIfMissing(variable); - - string oldVariableName = variable.Name; - variable.Name = "@" + variable.Name; - VisitVariableDeclaration(variable, null); - variable.Name = oldVariableName; - } - } - } - - void AddTypeToArrayInitializerIfMissing(VariableDeclaration variable) - { - ArrayCreateExpression arrayCreate = variable.Initializer as ArrayCreateExpression; - if (IsArrayMissingTypeToCreate(arrayCreate)) { - arrayCreate.CreateType = variable.TypeReference; - } - } - - bool IsArrayMissingTypeToCreate(ArrayCreateExpression arrayCreate) - { - if (arrayCreate != null) { - return String.IsNullOrEmpty(arrayCreate.CreateType.Type); - } - return false; - } - - /// - /// Converts a post or pre increment expression to an assign statement. - /// This converts "i++" and "++i" to "i = i + 1" since python - /// does not support post increment expressions. - /// - object CreateIncrementStatement(UnaryOperatorExpression unaryOperatorExpression) - { - return CreateIncrementStatement(unaryOperatorExpression, 1, GetBinaryOperator(BinaryOperatorType.Add)); - } - - /// - /// Converts a post or pre decrement expression to an assign statement. - /// This converts "i--" and "--i" to "i -= 1" since python - /// does not support post increment expressions. - /// - object CreateDecrementStatement(UnaryOperatorExpression unaryOperatorExpression) - { - return CreateIncrementStatement(unaryOperatorExpression, 1, GetBinaryOperator(BinaryOperatorType.Subtract)); - } - - /// - /// Converts a post or pre increment expression to an assign statement. - /// This converts "i++" and "++i" to "i += 1" since python - /// does not support post increment expressions. - /// - object CreateIncrementStatement(UnaryOperatorExpression unaryOperatorExpression, int increment, string binaryOperator) - { - unaryOperatorExpression.Expression.AcceptVisitor(this, null); - Append(" " + binaryOperator + "= "); - Append(increment.ToString()); - - return null; - } - - /// - /// Creates the rhs of expressions such as: - /// i = -1 - /// i = +1 - /// - object CreateUnaryOperatorStatement(string op, Expression expression) - { - Append(op); - expression.AcceptVisitor(this, null); - return null; - } - - /// - /// Creates the statement used to initialize the for loop. The - /// initialize statement will be "enumerator = variableName.GetEnumerator()" - /// which simulates what happens in a foreach loop. - /// - object CreateInitStatement(ForeachStatement foreachStatement) - { - Append("enumerator = "); - AppendForeachVariableName(foreachStatement); - Append(".GetEnumerator()"); - - return null; - } - - /// - /// Gets the name of the variable that is used in the - /// foreach loop as the item being iterated and appends the code. - /// - void AppendForeachVariableName(ForeachStatement foreachStatement) - { - IdentifierExpression identifierExpression = foreachStatement.Expression as IdentifierExpression; - InvocationExpression invocationExpression = foreachStatement.Expression as InvocationExpression; - MemberReferenceExpression memberRefExpression = foreachStatement.Expression as MemberReferenceExpression; - if (identifierExpression != null) { - Append(identifierExpression.Identifier); - } else if (invocationExpression != null) { - invocationExpression.AcceptVisitor(this, null); - } else if (memberRefExpression != null) { - memberRefExpression.AcceptVisitor(this, null); - } - } - - /// - /// Returns true if the object being created is a generic. - /// - static bool IsGenericType(ObjectCreateExpression expression) - { - return expression.CreateType.GenericTypes.Count > 0; - } - - /// - /// Appends the types used when creating a generic surrounded by square brackets. - /// - void AppendGenericTypes(ObjectCreateExpression expression) - { - Append("["); - List typeRefs = expression.CreateType.GenericTypes; - for (int i = 0; i < typeRefs.Count; ++i) { - if (i != 0) { - Append(", "); - } - TypeReference typeRef = typeRefs[i]; - if (typeRef.IsArrayType) { - Append("Array[" + GetTypeName(typeRef) + "]"); - } else { - Append(GetTypeName(typeRef)); - } - } - Append("]"); - } - - /// - /// If the type is String or Int32 then it returns "str" and "int". - /// - /// If the type is a keyword (e.g. uint) then the TypeRef.Type returns - /// the full type name. It returns the short type name if the type is not a keyword. So - /// this method will strip the namespace from the name. - /// - string GetTypeName(TypeReference typeRef) - { - string name = typeRef.Type; - return name.Replace(".", "::"); - } - - /// - /// Gets the type name that defines the method. - /// - static string GetTypeName(MethodDeclaration methodDeclaration) - { - TypeDeclaration type = methodDeclaration.Parent as TypeDeclaration; - return type.Name; - } - - /// - /// Saves the method declaration if it is a main entry point. - /// - void SaveMethodIfMainEntryPoint(MethodDeclaration method) - { - if (method.Name == "Main") { - entryPointMethods.Add(method); - } - } - - bool IsStatic(ParametrizedNode method) - { - return (method.Modifier & Modifiers.Static) == Modifiers.Static; - } - - void CreateSwitchCondition(SwitchSection section) - { - bool firstLabel = true; - foreach (CaseLabel label in section.SwitchLabels) { - if (firstLabel) { - firstLabel = false; - if (label.IsDefault) { - AppendIndented("else"); - } else { - // Create if condition. - AppendIndented("when "); - } - } else { - Append(", "); - } - label.Label.AcceptVisitor(this, null); - } - AppendLine(); - } - - /// - /// Creates the statements inside a switch case statement. - /// - void CreateSwitchConditionBody(SwitchSection section) - { - int statementsAdded = 0; - foreach (INode node in section.Children) { - if (node is BreakStatement) { - // ignore. - } else { - statementsAdded++; - node.AcceptVisitor(this, null); - } - } - } - - /// - /// Appends any comments that appear before this node. - /// - protected override void BeginVisit(INode node) - { - // xmlDocComments.Clear(); - // currentNode = node; - specialNodesInserter.AcceptNodeStart(node); - } - - #region IOutputFormatter - - int IOutputFormatter.IndentationLevel { - get { return codeBuilder.Indent; } - set { ; } - } - - string IOutputFormatter.Text { - get { return String.Empty; } - } - - bool IOutputFormatter.IsInMemberBody { - get { return false; } - set { ; } - } - - void IOutputFormatter.NewLine() - { - } - - void IOutputFormatter.Indent() - { - - } - - void IOutputFormatter.PrintComment(Comment comment, bool forceWriteInPreviousBlock) - { - if (comment.CommentType == CommentType.SingleLine) { - AppendSingleLineComment(comment); - } else if ((comment.CommentType == CommentType.Block) || (comment.CommentType == CommentType.Documentation)) { - AppendMultilineComment(comment); - } - } - - void IOutputFormatter.PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock) - { - } - - void IOutputFormatter.PrintBlankLine(bool forceWriteInPreviousBlock) - { - } - - #endregion - - void AppendMultilineComment(Comment comment) - { - string[] lines = comment.CommentText.Split(new char[] {'\n'}); - for (int i = 0; i < lines.Length; ++i) { - string line = "# " + lines[i].Trim(); - if ((i == 0) && !comment.CommentStartsLine) { - codeBuilder.AppendToPreviousLine(" " + line); - } else { - AppendIndentedLine(line); - } - } - } - - void AppendSingleLineComment(Comment comment) - { - if (comment.CommentStartsLine) { - codeBuilder.AppendIndentedLine("#" + comment.CommentText); - } else { - codeBuilder.AppendToPreviousLine(" #" + comment.CommentText); - } - } - - void AppendBaseTypes(List baseTypes) - { - if (baseTypes.Count > 0) { - Append(" < "); - for (int i = 0; i < baseTypes.Count; ++i) { - TypeReference typeRef = baseTypes[i]; - if (i > 0) { - Append(", "); - } - Append(GetTypeName(typeRef)); - } - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAddInOptions.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAddInOptions.cs deleted file mode 100644 index ebc620952e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAddInOptions.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using ICSharpCode.Core; - -namespace ICSharpCode.RubyBinding -{ - public class RubyAddInOptions - { - /// - /// The name of the options as read from the PropertyService. - /// - public static readonly string AddInOptionsName = "RubyBinding.Options"; - - /// - /// The default ruby console filename. - /// - public static readonly string DefaultRubyFileName = "ir.exe"; - - #region Property names - public static readonly string RubyFileNameProperty = "RubyFileName"; - public static readonly string RubyLibraryPathProperty = "RubyLibraryPath"; - #endregion - - Properties properties; - - public RubyAddInOptions() - : this(PropertyService.Get(AddInOptionsName, new Properties())) - { - } - - /// - /// Creates the addin options class which will use - /// the options from the properties class specified. - /// - public RubyAddInOptions(Properties properties) - { - this.properties = properties; - } - - public string RubyLibraryPath { - get { return properties.Get(RubyLibraryPathProperty, String.Empty); } - set { properties.Set(RubyLibraryPathProperty, value.Trim()); } - } - - public bool HasRubyLibraryPath { - get { return !String.IsNullOrEmpty(RubyLibraryPath); } - } - - /// - /// Gets or sets the ruby console filename. - /// - public string RubyFileName { - get { - return properties.Get(RubyFileNameProperty, GetDefaultRubyFileName()); - } - set { - if (String.IsNullOrEmpty(value)) { - properties.Set(RubyFileNameProperty, GetDefaultRubyFileName()); - } else { - properties.Set(RubyFileNameProperty, value); - } - } - } - - /// - /// Gets the path to the specified addin. - /// - /// The addin name: "${addin:ICSharpCode.RubyBinding}" - protected virtual string GetAddInPath(string addIn) - { - return StringParser.Parse(addIn); - } - - /// - /// Returns the full path to ir.exe which is installed in the - /// Ruby addin folder. - /// - string GetDefaultRubyFileName() - { - string path = GetAddInPath("${addinpath:ICSharpCode.RubyBinding}"); - return Path.Combine(path, DefaultRubyFileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAstWalker.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAstWalker.cs deleted file mode 100644 index 9f8b67b6e0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyAstWalker.cs +++ /dev/null @@ -1,328 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 Microsoft.Scripting; -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -using ICSharpCode.SharpDevelop.Dom; -using IronRuby.Builtins; -using IronRuby.Compiler; -using IronRuby.Compiler.Ast; -using IronRuby.Runtime; - -namespace ICSharpCode.RubyBinding -{ - public class RubyAstWalker : Walker - { - /// - /// Length of "def". - /// - const int MethodDefinitionLength = 3; - - DefaultCompilationUnit compilationUnit; - DefaultClass currentClass; - DefaultClass globalClass; - SourceUnit sourceUnit; - - /// - /// All classes in a file take the namespace of the filename. - /// - public RubyAstWalker(IProjectContent projectContent, string fileName, SourceUnit sourceUnit) - { - compilationUnit = new DefaultCompilationUnit(projectContent); - compilationUnit.FileName = fileName; - this.sourceUnit = sourceUnit; - } - - /// - /// Returns the compilation unit created after the Walk method - /// has been called. - /// - public ICompilationUnit CompilationUnit { - get { return compilationUnit; } - } - - protected override void Walk(MethodCall node) - { - if (node.MethodName == "require") { - if (HasArguments(node)) { - string requireString = GetRequireString(node.Arguments.Expressions); - if (requireString != null) { - AddUsing(requireString); - } - } - } - base.Walk(node); - } - - bool HasArguments(MethodCall node) - { - return (node.Arguments != null) && (!node.Arguments.IsEmpty); - } - - string GetRequireString(Expression[] expressions) - { - foreach (Expression expression in expressions) { - StringConstructor stringCtor = expression as StringConstructor; - if (stringCtor != null) { - return (string)RubyCodeDeserializer.Deserialize(stringCtor); - } - } - return null; - } - - void AddUsing(string requireString) - { - string assemblyName = GetAssemblyName(requireString); - - DefaultUsing defaultUsing = new DefaultUsing(compilationUnit.ProjectContent); - defaultUsing.Usings.Add(assemblyName); - compilationUnit.UsingScope.Usings.Add(defaultUsing); - } - - string GetAssemblyName(string requireString) - { - int index = requireString.IndexOf(','); - if (index > 0) { - return requireString.Substring(0, index); - } - return requireString; - } - - protected override void Walk(ModuleDefinition node) - { - globalClass = CreateClass(node); - - currentClass = globalClass; - base.Walk(node); - currentClass = null; - } - - protected override void Walk(ClassDefinition node) - { - DefaultClass c = CreateClass(node); - AddBaseType(c, node); - - // Walk through all the class items. - currentClass = c; - base.Walk(node); - currentClass = null; - } - - protected override void Walk(MethodDefinition methodDef) - { - IClass c = currentClass; - if (currentClass == null) { - // Walking a global method. - CreateGlobalClass(); - c = globalClass; - } - - // Create method. - string methodName = methodDef.Name; - DomRegion region = GetMethodRegion(methodDef); - DomRegion bodyRegion = GetMethodBodyRegion(methodDef.Body.Location, region); - - DefaultMethod method; - if (methodName == "initialize") { - method = new Constructor(ModifierEnum.Public, region, bodyRegion, c); - } else { - method = new DefaultMethod(methodName, new DefaultReturnType(c), ModifierEnum.Public, region, bodyRegion, c); - } - foreach (IParameter parameter in ConvertParameters(methodDef.Parameters)) { - method.Parameters.Add(parameter); - } - c.Methods.Add(method); - } - - /// - /// Converts a SourceSpan to a DomRegion. - /// - DomRegion GetRegion(SourceSpan location) - { - return new DomRegion(location.Start.Line, location.Start.Column, location.End.Line, location.End.Column); - } - - /// - /// Gets the region of a method. This does not include the body. - /// - DomRegion GetMethodRegion(MethodDefinition methodDef) - { - SourceLocation parametersEndLocation = GetParametersEndLocation(methodDef); - return CreateRegion(methodDef.Location.Start, parametersEndLocation); - } - - SourceLocation GetParametersEndLocation(MethodDefinition methodDef) - { - SourceLocation parametersEndLocation = methodDef.Parameters.Location.End; - if (parametersEndLocation.IsValid) { - if (ParametersEndLocationNeedsCorrecting(parametersEndLocation)) { - parametersEndLocation = CorrectParametersEndLocation(parametersEndLocation); - } - } else { - return GetParametersEndLocationBasedOnMethodNameEnd(methodDef); - } - return parametersEndLocation; - } - - SourceLocation GetParametersEndLocationBasedOnMethodNameEnd(MethodDefinition methodDef) - { - const int methodParenthesesLength = 2; - const int spaceLength = 1; - int methodDefinitionLength = methodDef.Name.Length + MethodDefinitionLength + methodParenthesesLength + spaceLength; - SourceLocation methodStartLocation = methodDef.Location.Start; - int index = methodStartLocation.Index + methodDefinitionLength; - int column = methodStartLocation.Column + methodDefinitionLength; - int line = methodStartLocation.Line; - return new SourceLocation(index, line, column); - } - - /// - /// Returns true if the IronRuby parser has not found the closing bracket for a method - /// and moved to the next line. - /// - bool ParametersEndLocationNeedsCorrecting(SourceLocation parametersEndLocation) - { - return parametersEndLocation.Column == 1; - } - - SourceLocation CorrectParametersEndLocation(SourceLocation parametersEndLocation) - { - int endLine = parametersEndLocation.Line - 1; - - string lastLineOfCodeForMethodDef = sourceUnit.GetCodeLine(endLine); - int LengthOfNewLineCharacters = 2; - int endColumn = lastLineOfCodeForMethodDef.Length + LengthOfNewLineCharacters + 1; - - return new SourceLocation(0, endLine, endColumn); - } - - DomRegion CreateRegion(SourceLocation start, SourceLocation end) - { - int startLine = start.Line; - int startColumn = start.Column; - int endLine = end.Line; - int endColumn = end.Column; - return new DomRegion(startLine, startColumn, endLine, endColumn); - } - - /// - /// The class body region starts from the end of qualified name of the class. - /// - /// Location of the end of the qualified name of the class. - DomRegion GetClassBodyRegion(SourceSpan bodyLocation, SourceLocation headerEnd) - { - return new DomRegion(headerEnd.Line, headerEnd.Column, bodyLocation.End.Line, bodyLocation.End.Column); - } - - /// - /// The method body region starts from the end of method parameters. - /// - DomRegion GetMethodBodyRegion(SourceSpan bodyLocation, DomRegion methodDefinitionRegion) - { - int startLine = methodDefinitionRegion.EndLine; - int startColumn = methodDefinitionRegion.EndColumn; - int endLine = bodyLocation.End.Line; - int endColumn = bodyLocation.End.Column; - return new DomRegion(startLine, startColumn, endLine, endColumn); - } - - /// - /// Converts from Ruby AST expressions to parameters. - /// - IParameter[] ConvertParameters(Parameters parameters) - { - List convertedParameters = new List(); - foreach (LocalVariable variable in GetParameterVariables(parameters)) { - DefaultParameter parameter = new DefaultParameter(variable.Name, null, new DomRegion()); - convertedParameters.Add(parameter); - } - return convertedParameters.ToArray(); - } - - /// - /// Converts the Parameters object into a list of LocalVariables - /// - List GetParameterVariables(Parameters parameters) - { - List variables = new List(); - if (parameters.Mandatory != null) { - foreach (LocalVariable variable in parameters.Mandatory) { - variables.Add(variable); - } - } - - if (parameters.Optional != null) { - foreach (SimpleAssignmentExpression expression in parameters.Optional) { - LocalVariable optionalVariable = expression.Left as LocalVariable; - if (optionalVariable != null) { - variables.Add(optionalVariable); - } - } - } - return variables; - } - - /// - /// Creates the dummy class that is used to hold global methods. - /// - void CreateGlobalClass() - { - if (globalClass == null) { - globalClass = new DefaultClass(compilationUnit, Path.GetFileNameWithoutExtension(compilationUnit.FileName)); - compilationUnit.Classes.Add(globalClass); - } - } - - DefaultClass CreateClass(ModuleDefinition node) - { - DefaultClass c = new DefaultClass(compilationUnit, node.QualifiedName.Name); - c.Region = GetRegion(node.Location); - c.BodyRegion = GetClassBodyRegion(node.Body.Location, node.QualifiedName.Location.End); - compilationUnit.Classes.Add(c); - return c; - } - - /// - /// Adds the named base type to the class. - /// - void AddBaseType(IClass c, ClassDefinition classDef) - { - string name = RubyComponentWalker.GetBaseClassName(classDef); - c.BaseTypes.Add(new SearchClassReturnType(c.ProjectContent, c, 0, 0, name, 0)); - } - - string GetFullyQualifiedName(ConstantVariable variable) - { - StringBuilder name = new StringBuilder(); - bool firstName = true; - while (variable != null) { - if (!firstName) { - name.Insert(0, '.'); - } - name.Insert(0, variable.Name); - variable = variable.Qualifier as ConstantVariable; - firstName = false; - } - return name.ToString(); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeBuilder.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeBuilder.cs deleted file mode 100644 index a29548cddd..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeBuilder.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.Text; -using ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyCodeBuilder : ScriptingCodeBuilder - { - public RubyCodeBuilder() - { - } - - public RubyCodeBuilder(int initialIndent) - : base(initialIndent) - { - } - - public void AppendLineIfPreviousLineIsEndStatement() - { - string previousLine = GetPreviousLine().Trim(); - if (previousLine.Equals("end", StringComparison.InvariantCultureIgnoreCase)) { - AppendLine(); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDeserializer.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDeserializer.cs deleted file mode 100644 index 164a83f5c5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDeserializer.cs +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Reflection; -using System.Text; - -using ICSharpCode.Scripting; -using IronRuby.Builtins; -using IronRuby.Compiler; -using IronRuby.Compiler.Ast; - -namespace ICSharpCode.RubyBinding -{ - public class RubyCodeDeserializer - { - IComponentCreator componentCreator; - - public RubyCodeDeserializer(IComponentCreator componentCreator) - { - this.componentCreator = componentCreator; - } - - public object Deserialize(Expression expression) - { - return Deserialize(null, expression); - } - - public object Deserialize(string name, Expression expression) - { - if (expression == null) { - throw new ArgumentNullException("expression"); - } - - if (expression is MethodCall) { - return Deserialize(name, (MethodCall)expression); - } else if (expression is Literal) { - return Deserialize((Literal)expression); - } else if (expression is StringConstructor) { - return Deserialize((StringConstructor)expression); - } else if (expression is InstanceVariable) { - return Deserialize((InstanceVariable)expression); - } else if (expression is SelfReference) { - return Deserialize((SelfReference)expression); - } else if (expression is LocalVariable) { - return Deserialize((LocalVariable)expression); - } - return null; - } - - public object Deserialize(string name, MethodCall methodCall) - { - if ("new".Equals(methodCall.MethodName, StringComparison.InvariantCultureIgnoreCase)) { - if (IsArrayCreation(methodCall)) { - return DeserializeCreateArrayExpression(name, methodCall); - } - return CreateInstance(name, methodCall); - } else if ("|".Equals(methodCall.MethodName)) { - return DeserializeBitwiseOr(methodCall); - } - return CreateInstance(name, methodCall); - } - - bool IsArrayCreation(MethodCall methodCall) - { - MethodCall targetMethodCall = methodCall.Target as MethodCall; - if (targetMethodCall != null) { - return targetMethodCall.MethodName == "[]"; - } - return false; - } - - public static object Deserialize(StringConstructor stringConstructor) - { - if (stringConstructor.Parts.Count > 0) { - StringLiteral literal = stringConstructor.Parts[0] as StringLiteral; - MutableString mutableString = literal.GetMutableString(); - return mutableString.ConvertToString(); - } - return String.Empty; - } - - public object Deserialize(InstanceVariable instance) - { - string name = instance.Name.Substring(1); - object obj = componentCreator.GetComponent(name); - if (obj != null) { - return obj; - } - return componentCreator.GetInstance(name); - } - - public List GetArguments(MethodCall methodCall) - { - return GetArguments(methodCall.Arguments); - } - - /// - /// Gets the arguments passed to the call expression. - /// - public List GetArguments(Arguments arguments) - { - List args = new List(); - if (arguments.Expressions != null) { - foreach (Expression expression in arguments.Expressions) { - args.Add(Deserialize(expression)); - } - } - return args; - } - - public object Deserialize(Literal literal) - { - return literal.Value; - } - - object DeserializeBitwiseOr(MethodCall methodCall) - { - List items = new List(); - while (methodCall != null) { - if (methodCall.Arguments != null) { - items.Add(CreateInstance(null, methodCall.Arguments.Expressions[0] as MethodCall)); - } - methodCall = methodCall.Target as MethodCall; - } - - int value = 1; - foreach (object item in items) { - value = Convert.ToInt32(item) | value; - } - return Enum.ToObject(items[0].GetType(), value); - } - - object CreateInstance(string name, MethodCall methodCall) - { - RubyControlFieldExpression field = RubyControlFieldExpression.Create(methodCall); - Type type = GetType(field); - if (type != null) { - if (type.IsEnum) { - return Enum.Parse(type, methodCall.MethodName); - } - - BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance; - PropertyInfo propertyInfo = type.GetProperty(methodCall.MethodName, propertyBindingFlags); - if (propertyInfo != null) { - return propertyInfo.GetValue(type, null); - } - - if (type.IsAssignableFrom(typeof(ComponentResourceManager))) { - return componentCreator.CreateInstance(type, new object[0], name, false); - } - - if (methodCall.Arguments != null) { - return CreateInstance(type, name, methodCall); - } - } else { - return componentCreator.GetInstance(field.MethodName); - } - return null; - } - - object CreateInstance(Type type, string name, MethodCall methodCall) - { - List args = GetArguments(methodCall.Arguments); - - // Try to execute a method on the object. - foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - if (method.Name == methodCall.MethodName) { - int parameterCount = method.GetParameters().Length; - if ((methodCall.Arguments.IsEmpty && (parameterCount == 0)) || - (parameterCount == methodCall.Arguments.Expressions.Length)) { - return method.Invoke(null, args.ToArray()); - } - } - } - return componentCreator.CreateInstance(type, args, name, false); - } - - Type GetType(RubyControlFieldExpression field) - { - string typeName = field.FullMemberName; - if (!String.IsNullOrEmpty(typeName)) { - return componentCreator.GetType(typeName); - } - return null; - } - - /// - /// Deserializes a method call where the target is an array expression. - /// - /// System::Array[System::String].new("a", "b") - /// - object DeserializeCreateArrayExpression(string name, MethodCall methodCall) - { - MethodCall arrayCreationMethodCall = methodCall.Target as MethodCall; - ConstantVariable constantVariable = arrayCreationMethodCall.Arguments.Expressions[0] as ConstantVariable; - string arrayTypeName = RubyControlFieldExpression.GetQualifiedName(constantVariable); - - ArrayConstructor arrayConstructor = methodCall.Arguments.Expressions[0] as ArrayConstructor; - Expression[] arrayItems = arrayConstructor.Arguments.Expressions; - - Type arrayType = componentCreator.GetType(arrayTypeName); - Array array = Array.CreateInstance(arrayType, arrayItems.Length); - for (int i = 0; i < arrayItems.Length; ++i) { - Expression arrayItemExpression = arrayItems[i]; - object instance = Deserialize(arrayItemExpression); - array.SetValue(instance, i); - } - return array; - } - - object Deserialize(SelfReference selfRef) - { - return componentCreator.RootComponent; - } - - object Deserialize(LocalVariable localVariable) - { - return componentCreator.GetInstance(localVariable.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDomSerializer.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDomSerializer.cs deleted file mode 100644 index f3c23ea9b0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCodeDomSerializer.cs +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Text; - -using ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Used to generate Ruby code after the form has been changed in the designer. - /// - public class RubyCodeDomSerializer : IScriptingCodeDomSerializer - { - RubyCodeBuilder codeBuilder; - - string indentString = String.Empty; - IDesignerSerializationManager serializationManager; - - string rootResourceName = String.Empty; - - public RubyCodeDomSerializer() - : this("\t") - { - } - - public RubyCodeDomSerializer(string indentString) - { - this.indentString = indentString; - } - - public string GenerateInitializeComponentMethodBody(IDesignerHost host, IDesignerSerializationManager serializationManager) - { - return GenerateInitializeComponentMethodBody(host, serializationManager, 0); - } - - public string GenerateInitializeComponentMethodBody(IDesignerHost host, IDesignerSerializationManager serializationManager, int initialIndent) - { - return GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, initialIndent); - } - - public string GenerateInitializeComponentMethodBody(IDesignerHost host, IDesignerSerializationManager serializationManager, string rootNamespace, int initialIndent) - { - CodeMemberMethod method = FindInitializeComponentMethod(host, serializationManager); - return GenerateMethodBody(host.RootComponent, method, serializationManager, rootNamespace, initialIndent); - } - - public string GenerateMethodBody(IComponent rootComponent, CodeMemberMethod method, IDesignerSerializationManager serializationManager, string rootNamespace, int initialIndent) - { - this.serializationManager = serializationManager; - - codeBuilder = new RubyCodeBuilder(initialIndent); - codeBuilder.IndentString = indentString; - - GetResourceRootName(rootNamespace, rootComponent); - AppendStatements(method.Statements); - - return codeBuilder.ToString(); - } - - CodeMemberMethod FindInitializeComponentMethod(IDesignerHost host, IDesignerSerializationManager serializationManager) - { - this.serializationManager = serializationManager; - object rootComponent = host.RootComponent; - TypeCodeDomSerializer serializer = serializationManager.GetSerializer(rootComponent.GetType(), typeof(TypeCodeDomSerializer)) as TypeCodeDomSerializer; - CodeTypeDeclaration typeDec = serializer.Serialize(serializationManager, rootComponent, host.Container.Components) as CodeTypeDeclaration; - foreach (CodeTypeMember member in typeDec.Members) { - CodeMemberMethod method = member as CodeMemberMethod; - if (method != null) { - if (method.Name == "InitializeComponent") { - return method; - } - } - } - return null; - } - - void AppendStatements(CodeStatementCollection statements) - { - foreach (CodeStatement statement in statements) { - AppendStatement(statement); - } - } - - void AppendStatement(CodeStatement statement) - { - if (statement is CodeExpressionStatement) { - AppendExpressionStatement((CodeExpressionStatement)statement); - } else if (statement is CodeCommentStatement) { - AppendCommentStatement((CodeCommentStatement)statement); - } else if (statement is CodeAssignStatement) { - AppendAssignStatement((CodeAssignStatement)statement); - } else if (statement is CodeVariableDeclarationStatement) { - AppendVariableDeclarationStatement((CodeVariableDeclarationStatement)statement); - } else if (statement is CodeAttachEventStatement) { - AppendAttachEventStatement((CodeAttachEventStatement)statement); - } else { - Console.WriteLine("AppendStatement: " + statement.GetType().Name); - } - } - - void AppendExpressionStatement(CodeExpressionStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Expression); - codeBuilder.AppendLine(); - } - - void AppendCommentStatement(CodeCommentStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - codeBuilder.Append("# "); - codeBuilder.Append(statement.Comment.Text); - codeBuilder.AppendLine(); - } - - void AppendExpression(CodeExpression expression) - { - if (expression is CodeMethodInvokeExpression) { - AppendMethodInvokeExpression((CodeMethodInvokeExpression)expression); - } else if (expression is CodePropertyReferenceExpression) { - AppendPropertyReferenceExpression((CodePropertyReferenceExpression)expression); - } else if (expression is CodeObjectCreateExpression) { - AppendObjectCreateExpression((CodeObjectCreateExpression)expression); - } else if (expression is CodePrimitiveExpression) { - AppendPrimitiveExpression((CodePrimitiveExpression)expression); - } else if (expression is CodeFieldReferenceExpression) { - AppendFieldReferenceExpression((CodeFieldReferenceExpression)expression); - } else if (expression is CodeThisReferenceExpression) { - AppendThisReferenceExpression(); - } else if (expression is CodeTypeReferenceExpression) { - AppendTypeReferenceExpression((CodeTypeReferenceExpression)expression); - } else if (expression is CodeArrayCreateExpression) { - AppendArrayCreateExpression((CodeArrayCreateExpression)expression); - } else if (expression is CodeVariableReferenceExpression) { - AppendVariableReferenceExpression((CodeVariableReferenceExpression)expression); - } else if (expression is CodeDelegateCreateExpression) { - AppendDelegateCreateExpression((CodeDelegateCreateExpression)expression); - } else if (expression is CodeCastExpression) { - AppendCastExpression((CodeCastExpression)expression); - } else if (expression is CodeBinaryOperatorExpression) { - AppendBinaryOperatorExpression((CodeBinaryOperatorExpression)expression); - } else { - Console.WriteLine("AppendExpression: " + expression.GetType().Name); - } - } - - /// - /// Appends a method call (e.g. "self.SuspendLayout()"); - /// - void AppendMethodInvokeExpression(CodeMethodInvokeExpression expression) - { - AppendMethodReferenceExpression(expression.Method); - AppendParameters(expression.Parameters); - } - - void AppendMethodReferenceExpression(CodeMethodReferenceExpression expression) - { - if (expression.TargetObject is CodeCastExpression) { - AppendCastMethodReferenceExpression(expression); - } else { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.MethodName); - } - } - - void AppendParameters(CodeExpressionCollection parameters) - { - codeBuilder.Append("("); - bool firstParameter = true; - foreach (CodeExpression expression in parameters) { - if (firstParameter) { - firstParameter = false; - } else { - codeBuilder.Append(", "); - } - AppendExpression(expression); - } - codeBuilder.Append(")"); - } - - void AppendAssignStatement(CodeAssignStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Left); - codeBuilder.Append(" = "); - AppendExpression(statement.Right); - codeBuilder.AppendLine(); - } - - void AppendPropertyReferenceExpression(CodePropertyReferenceExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.PropertyName); - } - - void AppendObjectCreateExpression(CodeObjectCreateExpression expression) - { - AppendTypeReference(expression.CreateType); - codeBuilder.Append(".new"); - AppendParameters(expression.Parameters); - } - - /// - /// Appends a constant (e.g. string or int). - /// - void AppendPrimitiveExpression(CodePrimitiveExpression expression) - { - codeBuilder.Append(RubyPropertyValueAssignment.ToString(expression.Value)); - } - - void AppendFieldReferenceExpression(CodeFieldReferenceExpression expression) - { - if (expression.TargetObject is CodeThisReferenceExpression) { - // Do not append full target object expression. - } else { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - } - if (expression.FieldName != null) { - if (expression.TargetObject is CodeThisReferenceExpression) { - if (IsInherited(expression.FieldName)) { - AppendThisReferenceExpression(); - codeBuilder.Append("."); - } else { - codeBuilder.Append("@"); - } - } - codeBuilder.Append(expression.FieldName); - } - } - - void AppendThisReferenceExpression() - { - codeBuilder.Append("self"); - } - - void AppendTypeReferenceExpression(CodeTypeReferenceExpression expression) - { - AppendTypeReference(expression.Type); - } - - void AppendTypeReference(CodeTypeReference typeRef) - { - string baseTypeName = typeRef.BaseType; - string typeName = baseTypeName.Replace(".", "::"); - typeName = typeName.Replace("+", "::"); - codeBuilder.Append(typeName); - } - - /// - /// Creates an array expression: - /// - /// System::Array[System::Object].new(\r\n" + - /// ["aaa", - /// "bbb", - /// "ccc\"]) - /// - void AppendArrayCreateExpression(CodeArrayCreateExpression expression) - { - codeBuilder.Append("System::Array["); - AppendTypeReference(expression.CreateType); - codeBuilder.Append("].new"); - - AppendInitializers(expression.Initializers); - } - - /// - /// Appends initializers for an array. - /// - void AppendInitializers(CodeExpressionCollection initalizers) - { - codeBuilder.Append("("); - codeBuilder.AppendLine(); - codeBuilder.IncreaseIndent(); - codeBuilder.AppendIndented("["); - - bool firstInitializer = true; - foreach (CodeExpression expression in initalizers) { - if (firstInitializer) { - firstInitializer = false; - } else { - codeBuilder.Append(","); - codeBuilder.AppendLine(); - codeBuilder.AppendIndented(String.Empty); - } - AppendExpression(expression); - } - - codeBuilder.Append("])"); - codeBuilder.DecreaseIndent(); - } - - /// - /// Appends a local variable declaration. - /// - void AppendVariableDeclarationStatement(CodeVariableDeclarationStatement statement) - { - if (statement.Name == "resources") { - codeBuilder.AppendIndented("resources = System::Resources::ResourceManager.new(\""); - codeBuilder.Append(rootResourceName); - codeBuilder.Append("\", System::Reflection::Assembly.GetEntryAssembly())"); - codeBuilder.AppendLine(); - } else { - codeBuilder.AppendIndented(statement.Name); - codeBuilder.Append(" = "); - AppendExpression(statement.InitExpression); - codeBuilder.AppendLine(); - } - } - - void AppendVariableReferenceExpression(CodeVariableReferenceExpression expression) - { - codeBuilder.Append(expression.VariableName); - } - - /// - /// Using an anonymous code block to call the event handler method: - /// - /// @button1.Click { |sender, e| self.Button1Click(sender, e) } - /// - void AppendAttachEventStatement(CodeAttachEventStatement statement) - { - codeBuilder.AppendIndented(String.Empty); - AppendExpression(statement.Event.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(statement.Event.EventName); - - codeBuilder.Append(" { |sender, e| "); - AppendExpression(statement.Listener); - codeBuilder.Append("(sender, e) }"); - - codeBuilder.AppendLine(); - } - - void AppendDelegateCreateExpression(CodeDelegateCreateExpression expression) - { - AppendExpression(expression.TargetObject); - codeBuilder.Append("."); - codeBuilder.Append(expression.MethodName); - } - - void GetResourceRootName(string rootNamespace, IComponent component) - { - rootResourceName = component.Site.Name; - if (!String.IsNullOrEmpty(rootNamespace)) { - rootResourceName = rootNamespace + "." + rootResourceName; - } - } - - void AppendCastExpression(CodeCastExpression expression) - { - AppendExpression(expression.Expression); - } - - /// - /// Explicit interfaces have to be called in a special way in IronRuby: - /// - /// @pictureBox1.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call() - /// - void AppendCastMethodReferenceExpression(CodeMethodReferenceExpression methodRef) - { - CodeCastExpression cast = methodRef.TargetObject as CodeCastExpression; - AppendExpression(cast.Expression); - codeBuilder.Append(".clr_member("); - AppendTypeReference(cast.TargetType); - codeBuilder.Append(", :"); - codeBuilder.Append(methodRef.MethodName); - codeBuilder.Append(").call"); - } - - bool IsInherited(string componentName) - { - return IsInherited(serializationManager.GetInstance(componentName)); - } - - static bool IsInherited(object component) - { - InheritanceAttribute attribute = GetInheritanceAttribute(component); - if (attribute != null) { - return attribute.InheritanceLevel != InheritanceLevel.NotInherited; - } - return false; - } - - static InheritanceAttribute GetInheritanceAttribute(object component) - { - if (component != null) { - AttributeCollection attributes = TypeDescriptor.GetAttributes(component); - return attributes[typeof(InheritanceAttribute)] as InheritanceAttribute; - } - return null; - } - - /// - /// Appends expressions like "AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top" - /// - void AppendBinaryOperatorExpression(CodeBinaryOperatorExpression expression) - { - AppendExpression(expression.Left); - AppendBinaryOperator(expression.Operator); - AppendExpression(expression.Right); - } - - void AppendBinaryOperator(CodeBinaryOperatorType operatorType) - { - codeBuilder.Append(" "); - switch (operatorType) { - case CodeBinaryOperatorType.BitwiseOr: - codeBuilder.Append("|"); - break; - } - codeBuilder.Append(" "); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCompilerSink.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCompilerSink.cs deleted file mode 100644 index f6d79f6ec6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyCompilerSink.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 Microsoft.Scripting; -using System; -using System.Collections.Generic; - -namespace ICSharpCode.RubyBinding -{ - public class RubyCompilerSink : ErrorSink - { - public RubyCompilerSink() - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalker.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalker.cs deleted file mode 100644 index 953ebb5dba..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalker.cs +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.Reflection; -using System.Resources; -using System.Text; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using IronRuby.Compiler; -using IronRuby.Compiler.Ast; -using IronRuby.Hosting; -using IronRuby.Runtime; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Visits the code's Ruby AST and creates a Windows Form. - /// - public class RubyComponentWalker : Walker, IComponentWalker - { - IComponent component; - IComponentCreator componentCreator; - string componentName = String.Empty; - RubyCodeDeserializer deserializer; - ClassDefinition classDefinition; - - public RubyComponentWalker(IComponentCreator componentCreator) - { - this.componentCreator = componentCreator; - deserializer = new RubyCodeDeserializer(componentCreator); - } - - /// - /// Creates a control either a UserControl or Form from the Ruby code. - /// - public IComponent CreateComponent(string rubyCode) - { - RubyParser parser = new RubyParser(); - SourceUnitTree ast = parser.CreateAst(@"Control.rb", new StringTextBuffer(rubyCode)); - Walk(ast); - - // Did we find the InitializeComponent method? - if (!FoundInitializeComponentMethod) { - throw new RubyComponentWalkerException("Unable to find InitializeComponents method."); - } - return component; - } - - /// - /// Gets the fully qualified name of the base class. - /// - public static string GetBaseClassName(ClassDefinition classDefinition) - { - ConstantVariable variable = classDefinition.SuperClass as ConstantVariable; - if (variable != null) { - return RubyControlFieldExpression.GetQualifiedName(variable); - } - return String.Empty; - } - - protected override void Walk(ClassDefinition node) - { - classDefinition = node; - componentName = node.QualifiedName.Name; - base.Walk(node); - } - - protected override void Walk(MethodDefinition node) - { - if (IsInitializeComponentMethod(node)) { - Type type = GetComponentType(); - component = componentCreator.CreateComponent(type, componentName); - - IResourceReader reader = componentCreator.GetResourceReader(CultureInfo.InvariantCulture); - if (reader != null) { - reader.Dispose(); - } - - WalkMethodStatements(node.Body.Statements); - } - } - - void WalkMethodStatements(Statements statements) - { - foreach (Expression expression in statements) { - WalkExpression(expression); - } - } - - void WalkExpression(Expression node) - { - if (node is SimpleAssignmentExpression) { - WalkSimpleAssignment((SimpleAssignmentExpression)node); - } else if (node is MethodCall) { - WalkMethodCall((MethodCall)node); - } - } - - void WalkSimpleAssignment(SimpleAssignmentExpression node) - { - AttributeAccess attributeAccess = node.Left as AttributeAccess; - InstanceVariable instance = node.Left as InstanceVariable; - LocalVariable localVariable = node.Left as LocalVariable; - if (attributeAccess != null) { - RubyControlFieldExpression field = RubyControlFieldExpression.Create(attributeAccess); - object propertyValue = deserializer.Deserialize(node.Right); - if (propertyValue != null) { - field.SetPropertyValue(componentCreator, propertyValue); - } else if (IsResource(node.Right)) { - field.SetPropertyValue(componentCreator, GetResource(node.Right as MethodCall)); - } else { - ThrowCouldNotFindTypeException(node.Right); - } - } else if (instance != null) { - string instanceName = RubyControlFieldExpression.GetVariableName(instance.Name); - object propertyValue = deserializer.Deserialize(instanceName, node.Right); - AddComponent(instanceName, propertyValue); - } else if (localVariable != null) { - object propertyValue = deserializer.Deserialize(localVariable.Name, node.Right); - if (propertyValue == null) { - ThrowCouldNotFindTypeException(node.Right); - } - } - } - - /// - /// Walks a method call. Typical method calls are: - /// - /// @menuItem1.Items.AddRange(...) - /// - /// This method will execute the method call. - /// - void WalkMethodCall(MethodCall node) - { - // Try to get the object being called. Try the form first then - // look for other controls. - object member = RubyControlFieldExpression.GetMember(component, node); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(node); - if (member == null) { - member = field.GetMember(componentCreator); - } - - // Execute the method on the object. - if (member != null) { - if (node.Arguments == null) { - RegisterEventHandler(node, member); - } else { - object[] args = deserializer.GetArguments(node).ToArray(); - InvokeMethod(member, field.MethodName, args); - } - } - } - - void RegisterEventHandler(MethodCall node, object component) - { - string eventHandlerName = GetEventHandlerName(node); - RegisterEventHandler(component, node.MethodName, eventHandlerName); - } - - void RegisterEventHandler(object component, string eventName, string eventHandlerName) - { - EventDescriptor eventDescriptor = TypeDescriptor.GetEvents(component).Find(eventName, false); - PropertyDescriptor propertyDescriptor = componentCreator.GetEventProperty(eventDescriptor); - propertyDescriptor.SetValue(component, eventHandlerName); - } - - string GetEventHandlerName(MethodCall eventHandlerMethodBlock) - { - BlockDefinition blockDef = eventHandlerMethodBlock.Block as BlockDefinition; - MethodCall eventHandlerMethodCall = blockDef.Body.First as MethodCall; - return eventHandlerMethodCall.MethodName; - } - - void InvokeMethod(object obj, string name, object[] args) - { - Type type = obj.GetType(); - try { - type.InvokeMember(name, BindingFlags.InvokeMethod, Type.DefaultBinder, obj, args); - } catch (MissingMethodException ex) { - // Look for an explicitly implemented interface. - MethodInfo method = FindInterfaceMethod(type, name); - if (method != null) { - method.Invoke(obj, args); - } else { - throw ex; - } - } - } - - /// - /// Looks for an explicitly implemented interface. - /// - MethodInfo FindInterfaceMethod(Type type, string name) - { - string nameMatch = "." + name; - foreach (MethodInfo method in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { - if (method.Name.EndsWith(nameMatch)) { - return method; - } - } - return null; - } - - static bool IsInitializeComponentMethod(MethodDefinition node) - { - string name = node.Name.ToLowerInvariant(); - return name == "initializecomponent" || name == "initializecomponents"; - } - - /// - /// Gets the type for the control being walked. - /// - Type GetComponentType() - { - string baseClass = GetBaseClassName(classDefinition); - Type type = componentCreator.GetType(baseClass); - if (type != null) { - return type; - } - - if (baseClass.Contains("UserControl")) { - return typeof(UserControl); - } - return typeof(Form); - } - - bool FoundInitializeComponentMethod { - get { return component != null; } - } - - /// - /// Adds a component to the list of created objects. - /// - void AddComponent(string name, object obj) - { - IComponent component = obj as IComponent; - if (component != null) { - componentCreator.Add(component, name); - } - } - - bool IsResource(Expression expression) - { - MethodCall methodCall = expression as MethodCall; - if (methodCall != null) { - string memberName = RubyControlFieldExpression.GetMemberName(methodCall); - return memberName.StartsWith("resources.", StringComparison.InvariantCultureIgnoreCase); - } - return false; - } - - object GetResource(MethodCall methodCall) - { - IResourceReader reader = componentCreator.GetResourceReader(CultureInfo.InvariantCulture); - if (reader != null) { - using (ResourceSet resources = new ResourceSet(reader)) { - List args = deserializer.GetArguments(methodCall); - return resources.GetObject(args[0] as String); - } - } - return null; - } - - void ThrowCouldNotFindTypeException(Expression expression) - { - string typeName = String.Empty; - MethodCall methodCall = expression as MethodCall; - if (methodCall != null) { - typeName = RubyControlFieldExpression.GetMemberName(methodCall); - } - string message = String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), typeName); - throw new RubyComponentWalkerException(message); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalkerException.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalkerException.cs deleted file mode 100644 index 374642c3b3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyComponentWalkerException.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Exception thrown by the RubyComponentWalker class - /// - public class RubyComponentWalkerException : Exception - { - public RubyComponentWalkerException(string message) : base(message) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsole.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsole.cs deleted file mode 100644 index 20ef968fc9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsole.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; - -using ICSharpCode.Scripting; -using Microsoft.Scripting.Hosting.Shell; - -namespace ICSharpCode.RubyBinding -{ - public class RubyConsole : ThreadSafeScriptingConsole, IConsole, IMemberProvider - { - IScriptingConsoleTextEditor textEditor; - IControlDispatcher dispatcher; - - public RubyConsole(IScriptingConsoleTextEditor textEditor, IControlDispatcher dispatcher) - : this(new ScriptingConsole(textEditor), dispatcher) - { - this.textEditor = textEditor; - } - - RubyConsole(ScriptingConsole console, IControlDispatcher dispatcher) - : base(console, dispatcher) - { - this.dispatcher = dispatcher; - console.MemberProvider = this; - } - - public ScriptingConsoleOutputStream CreateOutputStream() - { - return new ScriptingConsoleOutputStream(textEditor, dispatcher); - } - - public CommandLine CommandLine { get; set; } - - public TextWriter Output { - get { return null; } - set { } - } - - public TextWriter ErrorOutput { - get { return null; } - set { } - } - - public void Write(string text, Style style) - { - base.Write(text, (ScriptingStyle)style); - } - - public void WriteLine(string text, Style style) - { - base.WriteLine(text, (ScriptingStyle)style); - } - - public IList GetMemberNames(string name) - { - return CommandLine.GetMemberNames(name); - } - - public IList GetGlobals(string name) - { - return CommandLine.GetGlobals(name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleApplication.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleApplication.cs deleted file mode 100644 index cedff7e446..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleApplication.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Diagnostics; -using System.Text; - -using ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyConsoleApplication : ScriptingConsoleApplication - { - RubyAddInOptions options; - List loadPaths = new List(); - - public RubyConsoleApplication(RubyAddInOptions options) - { - this.options = options; - } - - public override string FileName { - get { return options.RubyFileName; } - } - - public void AddLoadPath(string path) - { - loadPaths.Add(path); - } - - protected override void AddArguments(ScriptingCommandLineBuilder commandLine) - { - commandLine.AppendOption("--disable-gems"); - commandLine.AppendBooleanOptionIfTrue("-D", Debug); - AppendLoadPaths(commandLine); - commandLine.AppendQuotedStringIfNotEmpty(ScriptFileName); - commandLine.AppendStringIfNotEmpty(ScriptCommandLineArguments); - } - - void AppendLoadPaths(ScriptingCommandLineBuilder commandLine) - { - foreach (string path in loadPaths) { - commandLine.AppendQuotedString("-I" + path); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleHost.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleHost.cs deleted file mode 100644 index 3066e39c70..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsoleHost.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; -using System.Threading; - -using ICSharpCode.Scripting; -using IronRuby; -using IronRuby.Hosting; -using IronRuby.Runtime; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; - -namespace ICSharpCode.RubyBinding -{ - public class RubyConsoleHost : ConsoleHost, IScriptingConsoleHost - { - Thread thread; - IScriptingConsoleTextEditor textEditor; - RubyConsole rubyConsole; - - public RubyConsoleHost(IScriptingConsoleTextEditor textEditor, IControlDispatcher dispatcher) - { - this.textEditor = textEditor; - rubyConsole = new RubyConsole(textEditor, dispatcher); - } - - public IScriptingConsole ScriptingConsole { - get { return rubyConsole; } - } - - /// - /// Runs the console host in its own thread. - /// - public void Run() - { - thread = new Thread(RunConsole); - thread.Start(); - } - - public void Dispose() - { - if (rubyConsole != null) { - rubyConsole.Dispose(); - } - - if (thread != null) { - thread.Join(); - } - } - - void RunConsole() - { - Run(new string[0]); - } - - protected virtual void SetOutput(ScriptingConsoleOutputStream stream) - { - Runtime.IO.SetOutput(stream, Encoding.UTF8); - } - - protected override OptionsParser CreateOptionsParser() - { - return new RubyOptionsParser(); - } - - protected override CommandLine CreateCommandLine() - { - return new RubyCommandLine(); - } - - protected override LanguageSetup CreateLanguageSetup() - { - return Ruby.CreateRubySetup(); - } - - protected override Type Provider { - get { return typeof(RubyContext); } - } - - /// - /// After the engine is created the standard output is replaced with our custom Stream class so we - /// can redirect the stdout to the text editor window. - /// This can be done in this method since the Runtime object will have been created before this method - /// is called. - /// - protected override IConsole CreateConsole(ScriptEngine engine, CommandLine commandLine, ConsoleOptions options) - { - ScriptingConsoleOutputStream stream = rubyConsole.CreateOutputStream(); - SetOutput(stream); - rubyConsole.CommandLine = commandLine; - return rubyConsole; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsolePad.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsolePad.cs deleted file mode 100644 index 3f4fef7715..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsolePad.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyConsolePad : ScriptingConsolePad - { - protected override IScriptingConsoleHost CreateConsoleHost(IScriptingConsoleTextEditor consoleTextEditor, - IControlDispatcher dispatcher) - { - return new RubyConsoleHost(consoleTextEditor, dispatcher); - } - - protected override string SyntaxHighlightingName { - get { return "Ruby"; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConstructorInfo.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConstructorInfo.cs deleted file mode 100644 index 4e17e6de1d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConstructorInfo.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.NRefactory.Ast; - -namespace ICSharpCode.RubyBinding -{ - public class RubyConstructorInfo - { - ConstructorDeclaration constructor; - List fields = new List(); - - RubyConstructorInfo(ConstructorDeclaration constructor, List fields) - { - this.constructor = constructor; - this.fields = fields; - } - - /// - /// Gets the constructor information from a type declaration. Returns null if there is no - /// constructor defined or if there are no fields defined. - /// - public static RubyConstructorInfo GetConstructorInfo(TypeDeclaration type) - { - List fields = new List(); - ConstructorDeclaration constructor = null; - foreach (INode node in type.Children) { - ConstructorDeclaration currentConstructor = node as ConstructorDeclaration; - FieldDeclaration field = node as FieldDeclaration; - if (currentConstructor != null) { - constructor = currentConstructor; - } else if (field != null) { - fields.Add(field); - } - } - - if ((fields.Count > 0) || (constructor != null)) { - return new RubyConstructorInfo(constructor, fields); - } - return null; - } - - public ConstructorDeclaration Constructor { - get { return constructor; } - } - - public List Fields { - get { return fields; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyControlFieldExpression.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyControlFieldExpression.cs deleted file mode 100644 index 4e75b7d898..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyControlFieldExpression.cs +++ /dev/null @@ -1,626 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Reflection; -using System.Text; -using System.Windows.Forms; - -using ICSharpCode.Scripting; -using IronRuby.Builtins; -using IronRuby.Compiler.Ast; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Represents a member field expression in a Control or Form: - /// - /// @textBox1 - /// @textBox1.Name - /// self.TextBox.Name - /// - public class RubyControlFieldExpression - { - string memberName = String.Empty; - string fullMemberName = String.Empty; - string variableName = String.Empty; - string methodName = String.Empty; - bool selfReference; - - public RubyControlFieldExpression(string memberName, string variableName, string methodName, string fullMemberName) - { - this.memberName = memberName; - this.variableName = variableName; - this.methodName = methodName; - this.fullMemberName = fullMemberName; - selfReference = ContainsSelfReferenceOrIsClassField(fullMemberName); - } - - /// - /// From a member expression of the form: self.textBox1.Name this property will return "Name". - /// - public string MemberName { - get { return memberName; } - } - - /// - /// From a member expression of the form: self.textBox1.Name this property will return "self.textBox1.Name". - /// - public string FullMemberName { - get { return fullMemberName; } - } - - /// - /// From a member expression of the form: @textBox1.Name this property will return "textBox1". - /// - public string VariableName { - get { return variableName; } - } - - /// - /// Returns the method being called by the field reference. - /// - public string MethodName { - get { return methodName; } - } - - /// - /// Returns whether the variable is for a field or not. - /// - public bool IsSelfReference { - get { return selfReference; } - } - - public override string ToString() - { - return "[VariableName: " + variableName + " FullMemberName: " + fullMemberName + "]"; - } - - public override bool Equals(object obj) - { - RubyControlFieldExpression rhs = obj as RubyControlFieldExpression; - if (rhs != null) { - return rhs.fullMemberName == fullMemberName && rhs.variableName == variableName; - } - return false; - } - - public override int GetHashCode() - { - return fullMemberName.GetHashCode(); - } - - /// - /// Creates a RubyControlField from an attribute access expression: - /// - /// @textBox1.Name = - /// self.textBox1 = - /// self.textBox1.Name = - /// - public static RubyControlFieldExpression Create(AttributeAccess expression) - { - return Create(GetMemberNames(expression)); - } - - /// - /// Creates a RubyControlField from an attribute access expression: - /// - /// listViewItem1 = - /// - public static RubyControlFieldExpression Create(LocalVariable localVariable) - { - return new RubyControlFieldExpression(String.Empty, localVariable.Name, String.Empty, localVariable.Name); - } - - /// - /// Creates a RubyControlField from a call expression: - /// - /// @menuItem1.Items.AddRange(...) - /// - /// Note that in Ruby a method call is also of the form: - /// - /// System::Drawing::Color.Red - /// - public static RubyControlFieldExpression Create(MethodCall methodCall) - { - string[] allNames = GetMemberNames(methodCall); - - // Remove last member since it is the method name. - int lastItemIndex = allNames.Length - 1; - string[] memberNames = new string[lastItemIndex]; - Array.Copy(allNames, memberNames, lastItemIndex); - - RubyControlFieldExpression field = Create(memberNames); - field.methodName = allNames[lastItemIndex]; - return field; - } - - /// - /// From a name such as "System.Windows.Forms.Cursors.AppStarting" this method returns: - /// "System.Windows.Forms.Cursors" - /// - public static string GetPrefix(string name) - { - int index = name.LastIndexOf('.'); - if (index > 0) { - return name.Substring(0, index); - } - return name; - } - - /// - /// Removes the @ from the variable name. - /// - public static string GetVariableName(string name) - { - if (!String.IsNullOrEmpty(name)) { - if (name[0] == '@') { - return name.Substring(1); - } - } - return name; - } - - /// - /// Gets the fully qualified name (e.g. System.Windows.Forms.Form) - /// - public static string GetQualifiedName(ConstantVariable variable) - { - StringBuilder name = new StringBuilder(); - while (variable != null) { - name.Insert(0, variable.Name); - variable = variable.Qualifier as ConstantVariable; - if (variable != null) { - name.Insert(0, '.'); - } - } - return name.ToString(); - } - - /// - /// Gets the fully qualified name being referenced in the MemberExpression. - /// - public static string GetMemberName(MethodCall methodCall) - { - return GetMemberName(GetMemberNames(methodCall)); - } - - public static string[] GetMemberNames(AttributeAccess attributeAccess) - { - string[] methodNames = GetMemberNames(attributeAccess.Qualifier); - - List names = new List(); - names.AddRange(methodNames); - - string lastMemberName = attributeAccess.Name.Substring(0, attributeAccess.Name.Length - 1); - names.Add(lastMemberName); - - return names.ToArray(); - } - - public static string[] GetMemberNames(Expression expression) - { - if (expression is MethodCall) { - return GetMemberNames((MethodCall)expression); - } else if (expression is InstanceVariable) { - return GetMemberNames((InstanceVariable)expression); - } else if (expression is SelfReference) { - return GetMemberNames((SelfReference)expression); - } else if (expression is LocalVariable) { - return GetMemberNames((LocalVariable)expression); - } - return new string[0]; - } - - /// - /// Gets the member names that make up the MemberExpression in order. - /// - public static string[] GetMemberNames(MethodCall methodCall) - { - if (methodCall != null) { - if (methodCall.Target is ConstantVariable) { - return GetMemberNamesFromConstant(methodCall); - } else if (IsClrMemberMethodCall(methodCall)) { - return GetMemberNamesFromClrMemberMethodCall(methodCall); - } - } - return GetMemberNamesFromMethodCall(methodCall); - } - - static string[] GetMemberNamesFromConstant(MethodCall methodCall) - { - List names = new List(); - ConstantVariable constantVariable = methodCall.Target as ConstantVariable; - while (constantVariable != null) { - names.Insert(0, constantVariable.Name); - constantVariable = constantVariable.Qualifier as ConstantVariable; - } - names.Add(methodCall.MethodName); - return names.ToArray(); - } - - static string[] GetMemberNamesFromMethodCall(MethodCall methodCall) - { - List names = new List(); - while (methodCall != null) { - names.Insert(0, methodCall.MethodName); - - SelfReference selfRef = methodCall.Target as SelfReference; - InstanceVariable instance = methodCall.Target as InstanceVariable; - LocalVariable localVariable = methodCall.Target as LocalVariable; - methodCall = methodCall.Target as MethodCall; - if (methodCall == null) { - if (selfRef != null) { - names.Insert(0, "self"); - } else if (instance != null) { - names.Insert(0, instance.Name); - } else if (localVariable != null) { - names.Insert(0, localVariable.Name); - } - } - } - return names.ToArray(); - } - - static bool IsClrMemberMethodCall(MethodCall methodCall) - { - MethodCall clrMemberMethod = methodCall.Target as MethodCall; - if (clrMemberMethod != null) { - return IsClrMemberMethod(clrMemberMethod); - } - return false; - } - - static bool IsClrMemberMethod(MethodCall methodCall) - { - return String.Equals(methodCall.MethodName, "clr_member", StringComparison.InvariantCultureIgnoreCase); - } - - static string[] GetMemberNamesFromClrMemberMethodCall(MethodCall methodCall) - { - string[] allNames = GetMemberNamesFromMethodCall(methodCall); - - List names = new List(); - - MethodCall clrMemberMethodCall = methodCall.Target as MethodCall; - SymbolLiteral literal = clrMemberMethodCall.Arguments.Expressions[1] as SymbolLiteral; - MutableString mutableString = literal.GetMutableString(); - string methodBeingCalledByClrMemberMethod = mutableString.ConvertToString(); - - // Remove two members since these are 'clr_member' and 'call'. - int lastItemIndex = allNames.Length - 2; - string[] memberNames = new string[lastItemIndex]; - Array.Copy(allNames, memberNames, lastItemIndex); - - names.AddRange(memberNames); - names.Add(methodBeingCalledByClrMemberMethod); - - return names.ToArray(); - } - - public static string[] GetMemberNames(InstanceVariable instance) - { - return new string[] { instance.Name }; - } - - public static string[] GetMemberNames(SelfReference selfRef) - { - return new string[] { "self" }; - } - - public static string[] GetMemberNames(LocalVariable localVariable) - { - return new string[] { localVariable.Name }; - } - - /// - /// Looks for a field in the component with the given name. - /// - public static object GetInheritedObject(string name, object component) - { - if (component != null) { - FieldInfo[] fields = component.GetType().GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); - foreach (FieldInfo field in fields) { - if (String.Equals(name, field.Name, StringComparison.InvariantCultureIgnoreCase)) { - return field.GetValue(component); - } - } - } - return null; - } - - /// - /// Gets the object that the field expression variable refers to. - /// - /// - /// This method will also check form's base class for any inherited objects that match - /// the object being referenced. - /// - public object GetObject(IComponentCreator componentCreator) - { - if (variableName.Length > 0) { - object component = componentCreator.GetComponent(variableName); - if (component != null) { - return component; - } - return GetInheritedObject(variableName, componentCreator.RootComponent); - } - return componentCreator.RootComponent; - } - - /// - /// Returns the object that the property is defined on. This method may just return the object - /// passed to it if the property is defined on that object. - /// - /// The object parameter must be equivalent to the object referred to - /// by the variable name in this RubyControlFieldExpression - /// (e.g. button1 in @button1.FlatAppearance.BorderSize). - public object GetObjectForMemberName(object component) - { - string[] members = fullMemberName.Split('.'); - int startIndex = GetMembersStartIndex(members); - - object currentComponent = component; - for (int i = startIndex; i < members.Length - 1; ++i) { - PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(currentComponent).Find(members[i], true); - if (propertyDescriptor == null) { - return null; - } - currentComponent = propertyDescriptor.GetValue(currentComponent); - } - return currentComponent; - } - - /// - /// Sets the property value that is referenced by this field expression. - /// - /// - /// Checks the field expression to see if it references an class instance variable (e.g. self._treeView1) - /// or a variable that is local to the InitializeComponent method (e.g. treeNode1.BackColor) - /// - public bool SetPropertyValue(IComponentCreator componentCreator, object propertyValue) - { - object component = GetComponent(componentCreator); - return SetPropertyValue(component, memberName, propertyValue); - } - - /// - /// Converts the value to the property's type if required. - /// - public static object ConvertPropertyValue(PropertyDescriptor propertyDescriptor, object propertyValue) - { - if (propertyValue != null) { - Type propertyValueType = propertyValue.GetType(); - if (!propertyDescriptor.PropertyType.IsAssignableFrom(propertyValueType)) { - if (propertyDescriptor.Converter.CanConvertFrom(propertyValueType)) { - return propertyDescriptor.Converter.ConvertFrom(propertyValue); - } - TypeConverter converter = TypeDescriptor.GetConverter(propertyValue); - return converter.ConvertTo(propertyValue, propertyDescriptor.PropertyType); - } - } - return propertyValue; - } - - /// - /// Gets the member object that matches the field member. - /// - /// For a field: - /// - /// self._menuStrip.Items.AddRange() - /// - /// This method returns: - /// - /// Items - /// - public object GetMember(IComponentCreator componentCreator) - { - object obj = componentCreator.GetComponent(variableName); - if (obj == null) { - obj = componentCreator.GetInstance(variableName); - if (obj == null) { - obj = GetInheritedObject(memberName, componentCreator.RootComponent); - if ((obj == null) && !IsSelfReference) { - obj = componentCreator.GetInstance(fullMemberName); - } - } - } - - if (obj != null) { - string[] memberNames = fullMemberName.Split('.'); - int startIndex = GetMembersStartIndex(memberNames); - return GetMember(obj, memberNames, startIndex, memberNames.Length - 1); - } - return null; - } - - /// - /// Gets the member object that matches the field member. - /// - /// - /// The member names array should contain all items including self, for example: - /// - /// self - /// Controls - /// - public static object GetMember(object obj, MethodCall methodCall) - { - string[] memberNames = GetMemberNames(methodCall); - if (ContainsSelfReference(memberNames)) { - return GetMember(obj, memberNames, 1, memberNames.Length - 2); - } - return null; - } - - /// - /// Gets the member that matches the last item in the memberNames array. - /// - /// The point at which to start looking in the memberNames. - /// The last memberNames item to look at. - static object GetMember(object obj, string[] memberNames, int startIndex, int endIndex) - { - for (int i = startIndex; i <= endIndex; ++i) { - Type type = obj.GetType(); - string name = memberNames[i]; - - // Try class members excluding inherited members first. - BindingFlags propertyBindingFlags = BindingFlags.Public | BindingFlags.GetField | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly; - PropertyInfo property = type.GetProperty(name, propertyBindingFlags); - if (property == null) { - // Try inherited members. - propertyBindingFlags = propertyBindingFlags & ~BindingFlags.DeclaredOnly; - property = type.GetProperty(name, propertyBindingFlags); - } - - if (property != null) { - obj = property.GetValue(obj, null); - } else { - return null; - } - } - return obj; - } - - static string GetMemberName(string[] names) - { - return String.Join(".", names); - } - - /// - /// Gets the variable name from an expression of the form: - /// - /// self.@textBox1.Name - /// - /// Returns "textBox1" - /// - /// - /// If there is no self part then the variable name is the first part of the name. - /// - static string GetVariableNameFromSelfReference(string name) - { - if (ContainsSelfReference(name)) { - name = name.Substring(5); - } - - int endIndex = name.IndexOf('.'); - if (endIndex > 0) { - return GetVariableName(name.Substring(0, endIndex)); - } else if (name.StartsWith("@")) { - return GetVariableName(name); - } - return String.Empty; - } - - static RubyControlFieldExpression Create(string[] memberNames) - { - string memberName = String.Empty; - if (memberNames.Length > 1) { - memberName = memberNames[memberNames.Length - 1]; - } - string fullMemberName = RubyControlFieldExpression.GetMemberName(memberNames); - return new RubyControlFieldExpression(memberName, GetVariableNameFromSelfReference(fullMemberName), String.Empty, fullMemberName); - } - - static bool ContainsSelfReference(string name) - { - return name.StartsWith("self.", StringComparison.InvariantCultureIgnoreCase); - } - - static bool ContainsSelfReferenceOrIsClassField(string name) - { - if (ContainsSelfReference(name)) { - return true; - } - return name.StartsWith("@"); - } - - static bool ContainsSelfReference(string[] members) - { - if (members.Length > 0) { - return "self".Equals(members[0], StringComparison.InvariantCultureIgnoreCase); - } - return false; - } - - /// - /// Returns the index into the members array where the members actually start. - /// The "self" and variable name are skipped. - /// - int GetMembersStartIndex(string[] members) - { - if (ContainsSelfReference(members)) { - // Skip self over when searching for member. - return 2; - } - return 1; - } - - /// - /// Sets the value of a property on the component. - /// - bool SetPropertyValue(object component, string name, object propertyValue) - { - PropertyDescriptor property = GetProperty(component, name); - if (property != null) { - if (OverrideNameProperty(component, name)) { - propertyValue = variableName; - } else { - propertyValue = ConvertPropertyValue(property, propertyValue); - } - property.SetValue(component, propertyValue); - return true; - } - return false; - } - - /// - /// Override the name property with the instance variable name when the component is a - /// ToolStripSeparator to support BindingNavigator separators using the same value for the - /// name property. - /// - bool OverrideNameProperty(object component, string property) - { - if (property == "Name") { - return component is ToolStripSeparator; - } - return false; - } - - /// - /// Gets the component that this field refers to. - /// - object GetComponent(IComponentCreator componentCreator) - { - object component = null; - if (IsSelfReference) { - component = GetObject(componentCreator); - component = GetObjectForMemberName(component); - } else { - component = componentCreator.GetInstance(variableName); - } - return component; - } - - static PropertyDescriptor GetProperty(object component, string name) - { - return TypeDescriptor.GetProperties(component).Find(name, true); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerGenerator.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerGenerator.cs deleted file mode 100644 index 364303289d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerGenerator.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Text; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Form's designer generator for the Ruby language. - /// - public class RubyDesignerGenerator : ScriptingDesignerGenerator - { - public RubyDesignerGenerator(ITextEditorOptions textEditorOptions) - : base(textEditorOptions) - { - } - - public override IScriptingCodeDomSerializer CreateCodeDomSerializer(ITextEditorOptions options) - { - return new RubyCodeDomSerializer(options.IndentationString); - } - - /// - /// Returns the generated event handler. - /// - public override string CreateEventHandler(string eventMethodName, string body, string indentation) - { - if (String.IsNullOrEmpty(body)) { - body = String.Empty; - } - - StringBuilder eventHandler = new StringBuilder(); - - eventHandler.Append(indentation); - eventHandler.Append("def "); - eventHandler.Append(eventMethodName); - eventHandler.Append("(sender, e)"); - eventHandler.AppendLine(); - eventHandler.Append(indentation); - eventHandler.Append(TextEditorOptions.IndentationString); - eventHandler.Append(body); - eventHandler.AppendLine(); - eventHandler.Append(indentation); - eventHandler.Append("end"); - - return eventHandler.ToString(); - } - - /// - /// Insert the event handler at the end of the class with an extra - /// new line before it. - /// - public override int InsertEventHandler(IDocument document, string eventHandler) - { - IDocumentLine classEndLine = GetClassEndLine(document); - InsertEventHandlerBeforeLine(document, eventHandler, classEndLine); - - // Set position so it points to the line - // where the event handler was inserted. - return classEndLine.LineNumber; - } - - IDocumentLine GetClassEndLine(IDocument doc) - { - int line = doc.TotalNumberOfLines; - while (line > 0) { - IDocumentLine documentLine = doc.GetLine(line); - if (documentLine.Text.Trim() == "end") { - return documentLine; - } - line--; - } - return doc.GetLine(doc.TotalNumberOfLines); - } - - void InsertEventHandlerBeforeLine(IDocument doc, string eventHandler, IDocumentLine classEndLine) - { - string newContent = "\r\n" + eventHandler + "\r\n"; - int offset = classEndLine.Offset; - doc.Insert(offset, newContent); - } - - /// - /// Converts from the DOM region to a document region. - /// - public override DomRegion GetBodyRegionInDocument(IMethod method) - { - DomRegion bodyRegion = method.BodyRegion; - return new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine, 1); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoader.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoader.cs deleted file mode 100644 index 6941ea9652..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoader.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Security.Permissions; -using ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Loads the form or control's code so the forms designer can - /// display it. - /// - [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] - [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] - public class RubyDesignerLoader : ScriptingDesignerLoader - { - public RubyDesignerLoader(IScriptingDesignerGenerator generator) - : base(generator) - { - } - - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return new RubyComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoaderProvider.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoaderProvider.cs deleted file mode 100644 index 0062ec3437..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyDesignerLoaderProvider.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel.Design.Serialization; -using ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyDesignerLoaderProvider : IDesignerLoaderProvider - { - public RubyDesignerLoaderProvider() - { - } - - public DesignerLoader CreateLoader(IDesignerGenerator generator) - { - return new RubyDesignerLoader(generator as IScriptingDesignerGenerator); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormattingStrategy.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormattingStrategy.cs deleted file mode 100644 index 3012482dd6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormattingStrategy.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.RubyBinding -{ - public class RubyFormattingStrategy : ScriptingFormattingStrategy - { - public override string LineComment { - get { return "#"; } - } - - protected override LineIndenter CreateLineIndenter(ITextEditor editor, IDocumentLine line) - { - return new RubyLineIndenter(editor, line); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormsDesignerDisplayBinding.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormsDesignerDisplayBinding.cs deleted file mode 100644 index ae0221d2b8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyFormsDesignerDisplayBinding.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Forms designer display binding for Ruby files. - /// - public class RubyFormsDesignerDisplayBinding : ISecondaryDisplayBinding - { - public RubyFormsDesignerDisplayBinding() - { - } - - /// - /// Returns true so that the CreateSecondaryViewContent method - /// is called after the LoadSolutionProjects thread has finished. - /// - public bool ReattachWhenParserServiceIsReady { - get { return true; } - } - - public bool CanAttachTo(IViewContent content) - { - ITextEditorProvider textEditorProvider = content as ITextEditorProvider; - if (textEditorProvider != null) { - if (IsRubyFile(content.PrimaryFileName)) { - ParseInformation parseInfo = GetParseInfo(content.PrimaryFileName, textEditorProvider.TextEditor.Document); - return IsDesignable(parseInfo); - } - } - return false; - } - - public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent) - { - ScriptingTextEditorViewContent textEditorView = new ScriptingTextEditorViewContent(viewContent); - return CreateSecondaryViewContent(viewContent, textEditorView.TextEditorOptions); - } - - public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent, ITextEditorOptions textEditorOptions) - { - foreach (IViewContent existingView in viewContent.SecondaryViewContents) { - if (existingView.GetType() == typeof(FormsDesignerViewContent)) { - return new IViewContent[0]; - } - } - - IDesignerLoaderProvider loader = new RubyDesignerLoaderProvider(); - IDesignerGenerator generator = new RubyDesignerGenerator(textEditorOptions); - return new IViewContent[] { new FormsDesignerViewContent(viewContent, loader, generator) }; - } - - /// - /// Gets the parse information from the parser service - /// for the specified file. - /// - protected virtual ParseInformation GetParseInfo(string fileName, ITextBuffer textContent) - { - return ParserService.ParseFile(fileName, textContent); - } - - /// - /// Determines whether the specified parse information contains - /// a class which is designable. - /// - protected virtual bool IsDesignable(ParseInformation parseInfo) - { - return FormsDesignerSecondaryDisplayBinding.IsDesignable(parseInfo); - } - - /// - /// Checks the file's extension represents a Ruby file. - /// - static bool IsRubyFile(string fileName) - { - RubyParser parser = new RubyParser(); - return parser.CanParse(fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageBinding.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageBinding.cs deleted file mode 100644 index 79814ab16d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageBinding.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.RubyBinding -{ - public class RubyLanguageBinding : DefaultLanguageBinding - { - public override IFormattingStrategy FormattingStrategy { - get { return new RubyFormattingStrategy(); } - } - - public override LanguageProperties Properties { - get { return RubyLanguageProperties.Default; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageProperties.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageProperties.cs deleted file mode 100644 index 31b9460d73..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLanguageProperties.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom.Compiler; -using ICSharpCode.SharpDevelop.Dom; -using Microsoft.CSharp; - -namespace ICSharpCode.RubyBinding -{ - public class RubyLanguageProperties : LanguageProperties - { - static readonly RubyLanguageProperties defaultProperties = new RubyLanguageProperties(); - - public RubyLanguageProperties() : base(StringComparer.Ordinal) - { - } - - public static RubyLanguageProperties Default { - get { return defaultProperties; } - } - - public override CodeDomProvider CodeDomProvider { - get { return new CSharpCodeProvider(); } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLineIndenter.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLineIndenter.cs deleted file mode 100644 index 3d078d0cc5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyLineIndenter.cs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Editor; - -namespace ICSharpCode.RubyBinding -{ - public class RubyLineIndenter : LineIndenter - { - List decreaseLineIndentStatements = new List(); - List decreaseLineIndentStartsWithStatements = new List(); - - List increaseLineIndentStatements = new List(); - List increaseLineIndentStartsWithStatements = new List(); - List increaseLineIndentEndsWithStatements = new List(); - List increaseLineIndentContainsStatements = new List(); - - public RubyLineIndenter(ITextEditor editor, IDocumentLine line) - : base(editor, line) - { - CreateDecreaseLineIndentStatements(); - CreateDecreaseLineIndentStartsWithStatements(); - CreateIncreaseLineIndentStatements(); - CreateIncreaseLineIndentStartsWithStatements(); - CreateIncreaseLineIndentEndsWithStatements(); - CreateIncreaseLineIndentContainsStatements(); - } - - void CreateDecreaseLineIndentStatements() - { - decreaseLineIndentStatements.Add("break"); - decreaseLineIndentStatements.Add("return"); - decreaseLineIndentStatements.Add("raise"); - } - - void CreateDecreaseLineIndentStartsWithStatements() - { - decreaseLineIndentStartsWithStatements.Add("return "); - decreaseLineIndentStartsWithStatements.Add("raise "); - } - - void CreateIncreaseLineIndentStatements() - { - increaseLineIndentStatements.Add("else"); - increaseLineIndentStatements.Add("begin"); - increaseLineIndentStatements.Add("rescue"); - increaseLineIndentStatements.Add("ensure"); - } - - void CreateIncreaseLineIndentStartsWithStatements() - { - increaseLineIndentStartsWithStatements.Add("if "); - increaseLineIndentStartsWithStatements.Add("def "); - increaseLineIndentStartsWithStatements.Add("class "); - increaseLineIndentStartsWithStatements.Add("while "); - increaseLineIndentStartsWithStatements.Add("elsif "); - increaseLineIndentStartsWithStatements.Add("loop "); - increaseLineIndentStartsWithStatements.Add("unless "); - increaseLineIndentStartsWithStatements.Add("until "); - increaseLineIndentStartsWithStatements.Add("for "); - increaseLineIndentStartsWithStatements.Add("rescue "); - increaseLineIndentStartsWithStatements.Add("module "); - increaseLineIndentStartsWithStatements.Add("when "); - increaseLineIndentStartsWithStatements.Add("case "); - } - - void CreateIncreaseLineIndentEndsWithStatements() - { - increaseLineIndentEndsWithStatements.Add(" then"); - increaseLineIndentEndsWithStatements.Add(" do"); - increaseLineIndentEndsWithStatements.Add(" {"); - } - - void CreateIncreaseLineIndentContainsStatements() - { - increaseLineIndentContainsStatements.Add(" case "); - } - - protected override bool ShouldIncreaseLineIndent() - { - if (increaseLineIndentStatements.Contains(PreviousLine)) { - return true; - } - if (PreviousLineStartsWith(increaseLineIndentStartsWithStatements)) { - return true; - } - if (PreviousLineContains(increaseLineIndentContainsStatements)) { - return true; - } - return PreviousLineEndsWith(increaseLineIndentEndsWithStatements); - } - - protected override bool ShouldDecreaseLineIndent() - { - if (decreaseLineIndentStatements.Contains(PreviousLine)) { - return true; - } - return PreviousLineStartsWith(decreaseLineIndentStartsWithStatements); - } - - bool PreviousLineStartsWith(List items) - { - foreach (string item in items) { - if (PreviousLine.StartsWith(item)) { - return true; - } - } - return false; - } - - bool PreviousLineEndsWith(List items) - { - foreach (string item in items) { - if (PreviousLine.EndsWith(item)) { - return true; - } - } - return false; - } - - bool PreviousLineContains(List items) - { - foreach (string item in items) { - if (PreviousLine.Contains(item)) { - return true; - } - } - return false; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyOptionsPanel.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyOptionsPanel.cs deleted file mode 100644 index d99ca970ed..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyOptionsPanel.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Windows.Forms; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Gui.OptionPanels; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Panel that displays the Ruby options. - /// - public class RubyOptionsPanel : XmlFormsOptionPanel - { - RubyAddInOptions options; - TextBox rubyFileNameTextBox; - TextBox rubyLibraryPathTextBox; - - public RubyOptionsPanel() : this(new RubyAddInOptions()) - { - } - - public RubyOptionsPanel(RubyAddInOptions options) - { - this.options = options; - } - - public override void LoadPanelContents() - { - SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream("ICSharpCode.RubyBinding.Resources.RubyOptionsPanel.xfrm")); - - rubyFileNameTextBox = (TextBox)ControlDictionary["rubyFileNameTextBox"]; - rubyFileNameTextBox.Text = options.RubyFileName; - rubyLibraryPathTextBox = (TextBox)ControlDictionary["rubyLibraryPathTextBox"]; - rubyLibraryPathTextBox.Text = options.RubyLibraryPath; - - ConnectBrowseButton("browseButton", "rubyFileNameTextBox", "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe", TextBoxEditMode.EditRawProperty); - } - - public override bool StorePanelContents() - { - options.RubyFileName = rubyFileNameTextBox.Text; - options.RubyLibraryPath = rubyLibraryPathTextBox.Text; - return true; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyParser.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyParser.cs deleted file mode 100644 index fa18025666..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyParser.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Providers; -using Microsoft.Scripting.Runtime; -using System; -using System.IO; - -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using IronRuby; -using IronRuby.Compiler; -using IronRuby.Compiler.Ast; -using IronRuby.Runtime; -using IronRuby.Hosting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyParser : IParser - { - string[] lexerTags = new string[0]; - ScriptEngine scriptEngine; - SourceUnit sourceUnit; - - public RubyParser() - { - } - - public string[] LexerTags { - get { return lexerTags; } - set { lexerTags = value; } - } - - public LanguageProperties Language { - get { return LanguageProperties.None; } - } - - public IExpressionFinder CreateExpressionFinder(string fileName) - { - return null; - } - - /// - /// Returns true if the file extension is .rb - /// - public bool CanParse(string fileName) - { - string extension = Path.GetExtension(fileName); - if (extension != null) { - return extension.ToLower() == ".rb"; - } - return false; - } - - /// - /// Returns true if the project's language is Ruby. - /// - public bool CanParse(IProject project) - { - if (project != null) { - return project.Language == RubyProjectBinding.LanguageName; - } - return false; - } - - public SourceUnitTree CreateAst(string fileName, ITextBuffer fileContent) - { - if (scriptEngine == null) { - scriptEngine = Ruby.CreateEngine(); - } - - RubyContext rubyContext = HostingHelpers.GetLanguageContext(scriptEngine) as RubyContext; - sourceUnit = rubyContext.CreateFileUnit(fileName, fileContent.Text); - RubyCompilerSink sink = new RubyCompilerSink(); - RubyCompilerOptions compilerOptions = new RubyCompilerOptions((RubyOptions)rubyContext.Options); - Parser parser = new Parser(); - return parser.Parse(sourceUnit, compilerOptions, sink); - } - - public ICompilationUnit Parse(IProjectContent projectContent, string fileName, string fileContent) - { - return Parse(projectContent, fileName, new StringTextBuffer(fileContent)); - } - - public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent) - { - if (fileContent != null) { - try { - SourceUnitTree ast = CreateAst(fileName, fileContent); - RubyAstWalker walker = new RubyAstWalker(projectContent, fileName, sourceUnit); - walker.Walk(ast); - return walker.CompilationUnit; - } catch (SyntaxErrorException) { - // Ignore. - } - } - - DefaultCompilationUnit compilationUnit = new DefaultCompilationUnit(projectContent); - compilationUnit.FileName = fileName; - return compilationUnit; - } - - public IResolver CreateResolver() - { - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProject.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProject.cs deleted file mode 100644 index 5dafa60bcb..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProject.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using Microsoft.Build.Construction; - -namespace ICSharpCode.RubyBinding -{ - public class RubyProject : CompilableProject - { - public RubyProject(ProjectLoadInformation info) - : base(info) - { - } - - public RubyProject(ProjectCreateInformation info) - : base(info) - { - base.MSBuildProjectFile.AddTarget("Build"); - } - - /// - /// Gets the language associated with the project. - /// - public override string Language { - get { return RubyProjectBinding.LanguageName; } - } - - /// - /// Gets the language properties associated with this project. - /// - public override LanguageProperties LanguageProperties { - get { return RubyLanguageProperties.Default; } - } - - public void AddMainFile(string fileName) - { - SetProperty(null, null, "MainFile", fileName, PropertyStorageLocations.Base, true); - } - - /// - /// Returns true if a main file is already defined for this project. - /// - public bool HasMainFile { - get { return GetProperty(null, null, "MainFile") != null; } - } - - protected override ProjectBehavior CreateDefaultBehavior() - { - return new RubyProjectBehavior(this, base.CreateDefaultBehavior()); - } - } - - public class RubyProjectBehavior : ProjectBehavior - { - public RubyProjectBehavior(RubyProject project, ProjectBehavior next = null) - : base(project, next) - { - - } - - /// - /// Returns ItemType.Compile if the filename has a Ruby extension (.rb). - /// - public override ItemType GetDefaultItemType(string fileName) - { - if (fileName != null) { - string extension = Path.GetExtension(fileName); - if (extension.ToLowerInvariant() == ".rb") { - return ItemType.Compile; - } - } - return base.GetDefaultItemType(fileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProjectBinding.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProjectBinding.cs deleted file mode 100644 index 0cf232aa39..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyProjectBinding.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; - -namespace ICSharpCode.RubyBinding -{ - public class RubyProjectBinding : IProjectBinding - { - public const string LanguageName = "Ruby"; - - public RubyProjectBinding() - { - } - - public string Language { - get { return LanguageName; } - } - - public IProject LoadProject(ProjectLoadInformation loadInformation) - { - return new RubyProject(loadInformation); - } - - public IProject CreateProject(ProjectCreateInformation info) - { - return new RubyProject(info); - } - - public bool HandlingMissingProject { - get { - return false; - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyPropertyValueAssignment.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyPropertyValueAssignment.cs deleted file mode 100644 index 9a4e365cf9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyPropertyValueAssignment.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; -using System.Reflection; -using System.Text; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Represents a property value assignment in a form or control. - /// - public class RubyPropertyValueAssignment - { - RubyPropertyValueAssignment() - { - } - - /// - /// Converts the property assignment to the equivalent Ruby string. - /// - /// - /// 1) Strings are returned surrounded by double quotes. - /// 2) Characters are returned surrounded by double quotes. - /// 3) Objects are returned with their full name (e.g. System::Windows::Forms::Size.new(100, 200)). - /// 4) Enums are returned with their full name (e.g. System::Windows::Forms::AccessibleRole.None). - /// 5) By default the ToString method is used on the property value. - /// - public static string ToString(object propertyValue) - { - if (propertyValue == null) { - return "nil"; - } - - Type propertyType = propertyValue.GetType(); - if (propertyType == typeof(bool)) { - return ConvertTypeToString(propertyValue).ToLowerInvariant(); - } else if (propertyType == typeof(String)) { - return GetQuotedString((string)propertyValue); - } else if (propertyType == typeof(Char)) { - return GetQuotedString(propertyValue.ToString()); - } else if (propertyType == typeof(AnchorStyles)) { - AnchorStyles anchor = (AnchorStyles)propertyValue; - return GetAnchorStyleAsString(anchor); - } - return ConvertTypeToString(propertyValue); - } - - static string GetAnchorStyleAsString(AnchorStyles anchorStyles) - { - if (anchorStyles == AnchorStyles.None) { - return typeof(AnchorStyles).FullName.Replace(".", "::") + "." + AnchorStyles.None; - } - - StringBuilder text = new StringBuilder(); - bool firstStyle = true; - foreach (AnchorStyles style in AnchorStyles.GetValues(typeof(AnchorStyles))) { - if (style != AnchorStyles.None) { - if ((anchorStyles & style) == style) { - if (firstStyle) { - firstStyle = false; - } else { - text.Append(" | "); - } - text.Append(typeof(AnchorStyles).FullName.Replace(".", "::")); - text.Append('.'); - text.Append(style); - } - } - } - return text.ToString(); - } - - /// - /// Returns the string enclosed by double quotes. - /// Escapes any double quotes or backslashes in the string itself. - /// If the string is multline triple quotes used. - /// - static string GetQuotedString(string text) - { - string quotes = "\""; - if (text.Contains("\n")) { - quotes = "\"\"\""; - } - return quotes + text.Replace(@"\", @"\\").Replace("\"", "\\\"") + quotes; - } - - /// - /// Looks for an instance descriptor for the property value's type and then tries to convert - /// the object creation using this instance descriptor. - /// - static string ConvertTypeToString(object propertyValue) - { - TypeConverter converter = TypeDescriptor.GetConverter(propertyValue); - if (converter.CanConvertTo(typeof(InstanceDescriptor))) { - InstanceDescriptor instanceDescriptor = converter.ConvertTo(propertyValue, typeof(InstanceDescriptor)) as InstanceDescriptor; - if (instanceDescriptor != null) { - StringBuilder text = new StringBuilder(); - MemberInfo memberInfo = instanceDescriptor.MemberInfo; - string fullName = memberInfo.DeclaringType.FullName.Replace('+', '.'); // Remove any + chars from enums. - fullName = fullName.Replace(".", "::"); - text.Append(fullName); - if (memberInfo.MemberType == MemberTypes.Constructor) { - text.Append(".new"); - } else { - text.Append('.'); - text.Append(memberInfo.Name); - } - - // Append arguments. - AppendArguments(text, instanceDescriptor.Arguments); - return text.ToString(); - } - } - return converter.ConvertToString(null, CultureInfo.InvariantCulture, propertyValue); - } - - static void AppendArguments(StringBuilder text, ICollection args) - { - if (args.Count > 0) { - int i = 0; - text.Append('('); - foreach (object arg in args) { - if (i > 0) { - text.Append(", "); - } - text.Append(ToString(arg)); - ++i; - } - text.Append(')'); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestDebugger.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestDebugger.cs deleted file mode 100644 index fd0dd6a214..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestDebugger.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core.Services; -using ICSharpCode.Scripting; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestDebugger : TestDebuggerBase - { - RubyAddInOptions options; - IScriptingFileService fileService; - RubyTestRunnerApplication testRunnerApplication; - - public RubyTestDebugger() - : this(new UnitTestDebuggerService(), - new UnitTestMessageService(), - new TestResultsMonitor(), - new RubyAddInOptions(), - new ScriptingFileService()) - { - } - - public RubyTestDebugger(IUnitTestDebuggerService debuggerService, - IUnitTestMessageService messageService, - ITestResultsMonitor testResultsMonitor, - RubyAddInOptions options, - IScriptingFileService fileService) - : base(debuggerService, messageService, testResultsMonitor) - { - this.options = options; - this.fileService = fileService; - testResultsMonitor.InitialFilePosition = 0; - } - - public override void Start(SelectedTests selectedTests) - { - CreateTestRunnerApplication(); - testRunnerApplication.CreateResponseFile(selectedTests); - base.Start(selectedTests); - } - - void CreateTestRunnerApplication() - { - testRunnerApplication = new RubyTestRunnerApplication(base.TestResultsMonitor.FileName, options, fileService); - } - - protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) - { - testRunnerApplication.Debug = true; - return testRunnerApplication.CreateProcessStartInfo(selectedTests); - } - - public override void Dispose() - { - testRunnerApplication.Dispose(); - base.Dispose(); - } - - protected override TestResult CreateTestResultForTestFramework(TestResult testResult) - { - return new RubyTestResult(testResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestFramework.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestFramework.cs deleted file mode 100644 index 48fa507209..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestFramework.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Linq; - -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestFramework : ITestFramework - { - public bool IsTestMember(IMember member) - { - var method = member as IMethod; - if (method != null) - return IsTestMethod(method); - return false; - } - - public IEnumerable GetTestMembersFor(IClass @class) { - return @class.Methods.Where(IsTestMethod).Select(method => new TestMember(method)); - } - - bool IsTestMethod(IMethod method) - { - return method.Name.StartsWith("test"); - } - - public bool IsTestClass(IClass c) - { - while (c != null) { - if (HasTestCaseBaseType(c)) { - return true; - } - c = c.BaseClass; - } - return false; - } - - bool HasTestCaseBaseType(IClass c) - { - if (c.BaseTypes.Count > 0) { - string baseTypeName = c.BaseTypes[0].FullyQualifiedName; - return (baseTypeName == "Test.Unit.TestCase"); - } - return false; - } - - public bool IsTestProject(IProject project) - { - return project is RubyProject; - } - - public ITestRunner CreateTestRunner() - { - return new RubyTestRunner(); - } - - public ITestRunner CreateTestDebugger() - { - return new RubyTestDebugger(); - } - - public bool IsBuildNeededBeforeTestRun { - get { return false; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestResult.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestResult.cs deleted file mode 100644 index d3835a2b24..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using System.Text.RegularExpressions; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestResult : TestResult - { - public RubyTestResult(TestResult testResult) - : base(testResult.Name) - { - ResultType = testResult.ResultType; - Message = testResult.Message; - StackTrace = testResult.StackTrace; - } - - protected override void OnStackTraceChanged() - { - if (String.IsNullOrEmpty(StackTrace)) { - ResetStackTraceFilePosition(); - } else { - GetFilePositionFromStackTrace(); - } - } - - void ResetStackTraceFilePosition() - { - StackTraceFilePosition = FilePosition.Empty; - } - - /// - /// Stack trace: Failure: - /// test_fail(SecondTests) - /// [d:\temp\test\rubytests\SecondTests.rb:6:in `test_fail' - /// d:\temp\test\rubytests/sdtestrunner.rb:73:in `start_mediator' - /// d:\temp\test\rubytests/sdtestrunner.rb:47:in `start']: - /// Assertion was false. - /// is not true. - /// - void GetFilePositionFromStackTrace() - { - Match match = Regex.Match(StackTrace, "\\s\\[(.*?):(\\d+):", RegexOptions.Multiline); - if (match.Success) { - try { - SetStackTraceFilePosition(match.Groups); - } catch (OverflowException) { - // Ignore. - } - } - } - - void SetStackTraceFilePosition(GroupCollection groups) - { - string fileName = groups[1].Value; - int line = Convert.ToInt32(groups[2].Value); - int column = 1; - - StackTraceFilePosition = new FilePosition(fileName, line, column); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunner.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunner.cs deleted file mode 100644 index ce9d12f98f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunner.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; - -using ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestRunner : TestProcessRunnerBase - { - RubyAddInOptions options; - IScriptingFileService fileService; - RubyTestRunnerApplication testRunnerApplication; - - public RubyTestRunner() - : this(new RubyTestRunnerContext()) - { - } - - public RubyTestRunner(RubyTestRunnerContext context) - : base(context) - { - this.options = context.Options; - this.fileService = context.ScriptingFileService; - context.TestResultsMonitor.InitialFilePosition = 0; - } - - public override void Start(SelectedTests selectedTests) - { - CreateTestRunnerApplication(); - testRunnerApplication.CreateResponseFile(selectedTests); - base.Start(selectedTests); - } - - void CreateTestRunnerApplication() - { - testRunnerApplication = new RubyTestRunnerApplication(base.TestResultsMonitor.FileName, options, fileService); - } - - protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) - { - return testRunnerApplication.CreateProcessStartInfo(selectedTests); - } - - public override void Dispose() - { - testRunnerApplication.Dispose(); - base.Dispose(); - } - - protected override TestResult CreateTestResultForTestFramework(TestResult testResult) - { - return new RubyTestResult(testResult); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerApplication.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerApplication.cs deleted file mode 100644 index c7e49c71b1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerApplication.cs +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; -using ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestRunnerApplication - { - string testResultsFileName = String.Empty; - RubyAddInOptions options; - RubyTestRunnerResponseFile responseFile; - IScriptingFileService fileService; - CreateTextWriterInfo textWriterInfo; - RubyConsoleApplication consoleApplication; - StringBuilder arguments; - - public RubyTestRunnerApplication(string testResultsFileName, - RubyAddInOptions options, - IScriptingFileService fileService) - { - this.testResultsFileName = testResultsFileName; - this.options = options; - this.fileService = fileService; - consoleApplication = new RubyConsoleApplication(options); - } - - public bool Debug { - get { return consoleApplication.Debug; } - set { consoleApplication.Debug = value; } - } - - public void CreateResponseFile(SelectedTests selectedTests) - { - CreateResponseFile(); - using (responseFile) { - WriteTests(selectedTests); - } - } - - void CreateResponseFile() - { - TextWriter writer = CreateTextWriter(); - responseFile = new RubyTestRunnerResponseFile(writer); - } - - TextWriter CreateTextWriter() - { - string fileName = fileService.GetTempFileName(); - textWriterInfo = new CreateTextWriterInfo(fileName, Encoding.ASCII, false); - return fileService.CreateTextWriter(textWriterInfo); - } - - void WriteTests(SelectedTests selectedTests) - { - responseFile.WriteTests(selectedTests); - } - - public ProcessStartInfo CreateProcessStartInfo(SelectedTests selectedTests) - { - consoleApplication.ScriptFileName = GetSharpDevelopTestRubyScriptFileName(); - AddLoadPaths(selectedTests.Project); - consoleApplication.ScriptCommandLineArguments = GetCommandLineArguments(selectedTests); - consoleApplication.WorkingDirectory = selectedTests.Project.Directory; - return consoleApplication.GetProcessStartInfo(); - } - - void AddLoadPaths(IProject project) - { - AddLoadPathForRubyStandardLibrary(); - AddLoadPathForReferencedProjects(project); - } - - void AddLoadPathForRubyStandardLibrary() - { - if (options.HasRubyLibraryPath) { - consoleApplication.AddLoadPath(options.RubyLibraryPath); - } - string testRunnerLoadPath = Path.GetDirectoryName(consoleApplication.ScriptFileName); - consoleApplication.AddLoadPath(testRunnerLoadPath); - } - - void AddLoadPathForReferencedProjects(IProject project) - { - foreach (ProjectItem item in project.Items) { - ProjectReferenceProjectItem projectRef = item as ProjectReferenceProjectItem; - if (projectRef != null) { - string directory = Path.GetDirectoryName(projectRef.FileName); - consoleApplication.AddLoadPath(directory); - } - } - } - - string GetSharpDevelopTestRubyScriptFileName() - { - string fileName = StringParser.Parse(@"${addinpath:ICSharpCode.RubyBinding}\TestRunner\sdtest.rb"); - return Path.GetFullPath(fileName); - } - - string GetCommandLineArguments(SelectedTests selectedTests) - { - arguments = new StringBuilder(); - AppendSelectedTest(selectedTests); - AppendTestResultsFileNameAndResponseFileNameArgs(); - - return arguments.ToString(); - } - - void AppendSelectedTest(SelectedTests selectedTests) - { - if (selectedTests.Member != null) { - AppendSelectedTestMethod(selectedTests.Member); - } else if (selectedTests.Class != null) { - AppendSelectedTestClass(selectedTests.Class); - } - } - - void AppendSelectedTestMethod(IMember method) - { - arguments.AppendFormat("--name={0} ", method.Name); - } - - void AppendSelectedTestClass(IClass c) - { - arguments.AppendFormat("--testcase={0} ", c.FullyQualifiedName); - } - - void AppendTestResultsFileNameAndResponseFileNameArgs() - { - arguments.AppendFormat("-- \"{0}\" \"{1}\"", testResultsFileName, textWriterInfo.FileName); - } - - public void Dispose() - { - fileService.DeleteFile(textWriterInfo.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerContext.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerContext.cs deleted file mode 100644 index 9e9645813f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerContext.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestRunnerContext : TestProcessRunnerBaseContext - { - RubyAddInOptions options; - IScriptingFileService fileService; - - public RubyTestRunnerContext() - : this(new UnitTestProcessRunner(), - new TestResultsMonitor(), - new RubyAddInOptions(), - new ScriptingFileService(), - new UnitTestMessageService()) - { - } - - public RubyTestRunnerContext(IUnitTestProcessRunner processRunner, - ITestResultsMonitor testResultsMonitor, - RubyAddInOptions options, - IScriptingFileService fileService, - IUnitTestMessageService messageService) - : base(processRunner, testResultsMonitor, fileService, messageService) - { - this.options = options; - this.fileService = fileService; - } - - public RubyAddInOptions Options { - get { return options; } - } - - public IScriptingFileService ScriptingFileService { - get { return fileService; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerResponseFile.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerResponseFile.cs deleted file mode 100644 index 02d9b251bc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyTestRunnerResponseFile.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.ObjectModel; -using System.IO; -using System.Text; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; - -namespace ICSharpCode.RubyBinding -{ - public class RubyTestRunnerResponseFile : IDisposable - { - TextWriter writer; - - public RubyTestRunnerResponseFile(string fileName) - : this(new StreamWriter(fileName, false, Encoding.ASCII)) - { - } - - public RubyTestRunnerResponseFile(TextWriter writer) - { - this.writer = writer; - } - - public void Dispose() - { - writer.Dispose(); - } - - public void WriteTests(SelectedTests selectedTests) - { - if (selectedTests.Member != null) { - WriteTestFileNameForMethod(selectedTests.Member); - } else if (selectedTests.Class != null) { - WriteTestFileNameForClass(selectedTests.Class); - } else if (selectedTests.Project != null) { - WriteTestsForProject(selectedTests.Project); - } - } - - void WriteTestFileNameForMethod(IMember method) - { - WriteTestFileNameForCompilationUnit(method.CompilationUnit); - } - - void WriteTestFileNameForClass(IClass c) - { - WriteTestFileNameForCompilationUnit(c.CompilationUnit); - } - - void WriteTestFileNameForCompilationUnit(ICompilationUnit unit) - { - WriteTestFileName(unit.FileName); - } - - void WriteTestsForProject(IProject project) - { - WriteTestsForProjectFileItems(project.Items); - } - - void WriteTestsForProjectFileItems(ReadOnlyCollection items) - { - foreach (ProjectItem item in items) { - FileProjectItem fileItem = item as FileProjectItem; - if (fileItem != null) { - WriteTestFileName(fileItem.FileName); - } - } - } - - void WriteTestFileName(string testFileName) - { - writer.WriteLine(testFileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyWorkbench.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyWorkbench.cs deleted file mode 100644 index 2b68e0ee44..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyWorkbench.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; - -namespace ICSharpCode.RubyBinding -{ - public class RubyWorkbench : ScriptingWorkbench - { - public RubyWorkbench() - : base(typeof(RubyConsolePad)) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunDebugRubyCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunDebugRubyCommand.cs deleted file mode 100644 index 43e16c9e3d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunDebugRubyCommand.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Debugging; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Util; - -namespace ICSharpCode.RubyBinding -{ - public class RunDebugRubyCommand : RunRubyCommand - { - public RunDebugRubyCommand(IScriptingWorkbench workbench, RubyAddInOptions options, IDebugger debugger) - : base(workbench, options, debugger) - { - Debug = true; - } - - public RunDebugRubyCommand() - : this(new RubyWorkbench(), new RubyAddInOptions(), DebuggerService.CurrentDebugger) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunRubyCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunRubyCommand.cs deleted file mode 100644 index add7cc2be0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RunRubyCommand.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.Scripting; -using ICSharpCode.SharpDevelop.Debugging; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Util; - -namespace ICSharpCode.RubyBinding -{ - /// - /// Runs the Ruby console passing the filename of the - /// active Ruby script open in SharpDevelop. - /// - public class RunRubyCommand : RunScriptingConsoleApplicationCommand - { - public RunRubyCommand() - : this(new RubyWorkbench(), new RubyAddInOptions(), DebuggerService.CurrentDebugger) - { - } - - public RunRubyCommand(IScriptingWorkbench workbench, RubyAddInOptions options, IDebugger debugger) - : base(workbench, debugger, new RubyConsoleApplication(options)) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendLineToRubyConsoleCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendLineToRubyConsoleCommand.cs deleted file mode 100644 index 0924cc98b0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendLineToRubyConsoleCommand.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class SendLineToRubyConsoleCommand : SendLineToScriptingConsoleCommand - { - public SendLineToRubyConsoleCommand() - : base(new RubyWorkbench()) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendSelectedTextToRubyConsoleCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendSelectedTextToRubyConsoleCommand.cs deleted file mode 100644 index 7a84781cb6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/SendSelectedTextToRubyConsoleCommand.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; - -namespace ICSharpCode.RubyBinding -{ - public class SendSelectedTextToRubyConsoleCommand : SendSelectedTextToScriptingConsoleCommand - { - public SendSelectedTextToRubyConsoleCommand() - : base(new RubyWorkbench()) - { - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/ConsoleProject.xpt b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/ConsoleProject.xpt deleted file mode 100644 index b614c15bf7..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/ConsoleProject.xpt +++ /dev/null @@ -1,53 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/Empty.xft b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/Empty.xft deleted file mode 100644 index ee3b1e94cf..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/Empty.xft +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyClass.xft b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyClass.xft deleted file mode 100644 index 7bf061098c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyClass.xft +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyForm.xft b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyForm.xft deleted file mode 100644 index 0d09847672..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyForm.xft +++ /dev/null @@ -1,29 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyUserControl.xft b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyUserControl.xft deleted file mode 100644 index 7926dee422..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/EmptyUserControl.xft +++ /dev/null @@ -1,28 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/FormsProject.xpt b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/FormsProject.xpt deleted file mode 100644 index c5128f5bf6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/FormsProject.xpt +++ /dev/null @@ -1,82 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/LibraryProject.xpt b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/LibraryProject.xpt deleted file mode 100644 index e0569fe9ec..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/LibraryProject.xpt +++ /dev/null @@ -1,41 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/SilverlightApplication.xpt b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/SilverlightApplication.xpt deleted file mode 100644 index 0ab2da9c5d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/SilverlightApplication.xpt +++ /dev/null @@ -1,73 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFApplication.xpt b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFApplication.xpt deleted file mode 100644 index dde2f040bb..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFApplication.xpt +++ /dev/null @@ -1,90 +0,0 @@ - - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFWindow.xft b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFWindow.xft deleted file mode 100644 index 7d05628785..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Templates/WPFWindow.xft +++ /dev/null @@ -1,26 +0,0 @@ - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdselectedtestsfile.rb b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdselectedtestsfile.rb deleted file mode 100644 index fb24e8fa91..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdselectedtestsfile.rb +++ /dev/null @@ -1,32 +0,0 @@ - -module Test - module Unit - module UI - module SharpDevelopConsole - - class SharpDevelopSelectedTestsFile - - def initialize(filename) - @tests = [] - read_tests(filename) - end - - def read_tests(filename) - File.open(filename).each {|line| - line = line.strip - if line.length > 0 then - @tests.push(line) - end - } - end - - def tests - return @tests - end - - end - - end - end - end -end diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtest.rb b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtest.rb deleted file mode 100644 index 2ed6ff6e33..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtest.rb +++ /dev/null @@ -1,27 +0,0 @@ - -require 'test/unit' -require 'test/unit/autorunner' -require 'sdselectedtestsfile' - -Test::Unit.run = false - -Test::Unit::AutoRunner::RUNNERS[:console] = - proc do |r| - require 'sdtestrunner' - Test::Unit::UI::SharpDevelopConsole::TestRunner - end - -standalone = true -runner = Test::Unit::AutoRunner.new(standalone) -runner.process_args(ARGV) - -# Add files to run tests on. -selected_tests_filename = ARGV.last -print "selected_tests_filename: " + selected_tests_filename -selected_tests_file = Test::Unit::UI::SharpDevelopConsole::SharpDevelopSelectedTestsFile.new(selected_tests_filename) -selected_tests_file.tests.each {|filename| - runner.to_run.push(filename) -} - -runner.run - diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresult.rb b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresult.rb deleted file mode 100644 index feccb6948d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresult.rb +++ /dev/null @@ -1,64 +0,0 @@ - -module Test - module Unit - module UI - module SharpDevelopConsole - - class SharpDevelopTestResult - - def initialize(name) - @name = parse_name(name) - @result = 'Success' - @message = '' - @stacktrace = '' - end - - def parse_name(name) - @name = name - open_bracket_index = name.index('(') - if open_bracket_index > 0 then - close_bracket_index = name.index(')', open_bracket_index) - if close_bracket_index > 0 then - length = close_bracket_index - open_bracket_index - 1 - method_name = name[0, open_bracket_index] - class_name = name[open_bracket_index + 1, length] - @name = class_name + '.' + method_name - end - end - end - - def name - return @name - end - - def result - return @result - end - - def message - return @message - end - - def stacktrace - return @stacktrace - end - - def update_fault(fault) - @result = 'Failure' - @message = format_text(fault.message) - @stacktrace = format_text(fault.long_display) - end - - def format_text(text) - formatted_text = '' - text.each_line do |line| - formatted_text += " " + line - end - return formatted_text[1..-1] - end - end - - end - end - end -end diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresultwriter.rb b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresultwriter.rb deleted file mode 100644 index 7fe72e75be..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestresultwriter.rb +++ /dev/null @@ -1,31 +0,0 @@ - -require 'sdtestresult' - -module Test - module Unit - module UI - module SharpDevelopConsole - - class SharpDevelopTestResultWriter - - def initialize(filename) - @file = File.open(filename, 'w') - end - - def write_test_result(test_result) - writeline("Name: " + test_result.name) - writeline("Result: " + test_result.result) - writeline("Message: " + test_result.message) - writeline("StackTrace: " + test_result.stacktrace) - end - - def writeline(message) - @file.write(message + "\r\n") - @file.flush - end - end - - end - end - end -end diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestrunner.rb b/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestrunner.rb deleted file mode 100644 index 47d76d18b1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Project/TestRunner/sdtestrunner.rb +++ /dev/null @@ -1,145 +0,0 @@ -#-- -# -# Author:: Nathaniel Talbott. -# Copyright:: Copyright (c) 2000-2003 Nathaniel Talbott. All rights reserved. -# License:: Ruby license. -# -# Extended to support SharpDevelop - -require 'test/unit/ui/testrunnermediator' -require 'test/unit/ui/testrunnerutilities' -require 'sdtestresultwriter' -require 'sdtestresult' - -module Test - module Unit - module UI - module SharpDevelopConsole - - # Runs a Test::Unit::TestSuite on the console. - class TestRunner - extend TestRunnerUtilities - - # Creates a new TestRunner for running the passed - # suite. If quiet_mode is true, the output while - # running is limited to progress dots, errors and - # failures, and the final result. io specifies - # where runner output should go to; defaults to - # STDOUT. - def initialize(suite, output_level=NORMAL, io=STDOUT) - if (suite.respond_to?(:suite)) - @suite = suite.suite - else - @suite = suite - end - @output_level = output_level - @io = io - @already_outputted = false - @faults = [] - - resultsfile = ARGV[0] - @test_result_writer = SharpDevelopTestResultWriter.new(resultsfile) - end - - # Begins the test run. - def start - setup_mediator - attach_to_mediator - return start_mediator - end - - private - def setup_mediator - @mediator = create_mediator(@suite) - suite_name = @suite.to_s - if ( @suite.kind_of?(Module) ) - suite_name = @suite.name - end - output("Loaded suite #{suite_name}") - end - - def create_mediator(suite) - return TestRunnerMediator.new(suite) - end - - def attach_to_mediator - @mediator.add_listener(TestResult::FAULT, &method(:add_fault)) - @mediator.add_listener(TestRunnerMediator::STARTED, &method(:started)) - @mediator.add_listener(TestRunnerMediator::FINISHED, &method(:finished)) - @mediator.add_listener(TestCase::STARTED, &method(:test_started)) - @mediator.add_listener(TestCase::FINISHED, &method(:test_finished)) - end - - def start_mediator - return @mediator.run_suite - end - - def add_fault(fault) - @test_result.update_fault(fault) - @faults << fault - output_single(fault.single_character_display, PROGRESS_ONLY) - @already_outputted = true - end - - def started(result) - @result = result - output("Started") - end - - def finished(elapsed_time) - nl - output("Finished in #{elapsed_time} seconds.") - @faults.each_with_index do |fault, index| - nl - output("%3d) %s" % [index + 1, fault.long_display]) - end - nl - output(@result) - end - - def test_started(name) - create_test_result(name) - output_single(name + ": ", VERBOSE) - end - - def create_test_result(name) - @test_result = SharpDevelopTestResult.new(name) - end - - def test_finished(name) - write_test_result() - output_single(".", PROGRESS_ONLY) unless (@already_outputted) - nl(VERBOSE) - @already_outputted = false - end - - def nl(level=NORMAL) - output("", level) - end - - def output(something, level=NORMAL) - @io.puts(something) if (output?(level)) - @io.flush - end - - def output_single(something, level=NORMAL) - @io.write(something) if (output?(level)) - @io.flush - end - - def output?(level) - level <= @output_level - end - - def write_test_result() - @test_result_writer.write_test_result(@test_result) - end - end - end - end - end -end - -if __FILE__ == $0 - Test::Unit::UI::SharpDevelopConsole::TestRunner.start_command_line_test -end diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/AssemblyInfo.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/AssemblyInfo.cs deleted file mode 100644 index ab8244a9ed..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/AssemblyInfo.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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. - -#region Using directives - -using System; -using System.Reflection; -using System.Runtime.InteropServices; - -using NUnit.Framework; - -#endregion - -// 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("RubyBinding.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("RubyBinding.Tests")] -[assembly: AssemblyCopyright("Copyright 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. -[assembly: ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all the values or you can use the default the Revision and -// Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] - -// Run unit tests on STA thread. -[assembly: RequiresSTA] diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Configuration/RubyAddInOptionsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Configuration/RubyAddInOptionsTestFixture.cs deleted file mode 100644 index dca7932614..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Configuration/RubyAddInOptionsTestFixture.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Configuration -{ - /// - /// Tests the AddInOptions class. - /// - [TestFixture] - public class RubyAddInOptionsTestFixture - { - [Test] - public void DefaultRubyConsoleFileName() - { - Properties p = new Properties(); - DerivedRubyAddInOptions options = new DerivedRubyAddInOptions(p); - options.AddInPath = @"C:\Projects\SD\AddIns\Ruby"; - - string expectedFileName = Path.Combine(options.AddInPath, "ir.exe"); - Assert.AreEqual(expectedFileName, options.RubyFileName); - Assert.AreEqual("${addinpath:ICSharpCode.RubyBinding}", options.AddInPathRequested); - } - - [Test] - public void SetRubyConsoleFileNameToNull() - { - Properties p = new Properties(); - DerivedRubyAddInOptions options = new DerivedRubyAddInOptions(p); - options.AddInPath = @"C:\Projects\SD\AddIns\Ruby"; - options.RubyFileName = null; - - string expectedFileName = Path.Combine(options.AddInPath, "ir.exe"); - Assert.AreEqual(expectedFileName, options.RubyFileName); - } - - [Test] - public void SetRubyConsoleFileNameToEmptyString() - { - Properties p = new Properties(); - DerivedRubyAddInOptions options = new DerivedRubyAddInOptions(p); - options.AddInPath = @"C:\Projects\SD\AddIns\Ruby"; - options.RubyFileName = String.Empty; - - string expectedFileName = Path.Combine(options.AddInPath, "ir.exe"); - Assert.AreEqual(expectedFileName, options.RubyFileName); - } - - [Test] - public void SetRubyConsoleFileName() - { - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - string fileName = @"C:\IronRuby\ir.exe"; - options.RubyFileName = fileName; - - Assert.AreEqual(fileName, options.RubyFileName); - Assert.AreEqual(fileName, p["RubyFileName"]); - } - - [Test] - public void RubyLibraryPathTakenFromProperties() - { - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - string expectedRubyLibraryPath = @"c:\ruby\lib;c:\ruby\lib\lib-tk"; - p["RubyLibraryPath"] = expectedRubyLibraryPath; - Assert.AreEqual(expectedRubyLibraryPath, options.RubyLibraryPath); - } - - [Test] - public void HasRubyLibraryPathReturnsTrueForNonEmptyPath() - { - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - options.RubyLibraryPath = @"c:\ruby\lib"; - Assert.IsTrue(options.HasRubyLibraryPath); - } - - [Test] - public void HasRubyLibraryPathReturnsFalseForEmptyPath() - { - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - options.RubyLibraryPath = String.Empty; - Assert.IsFalse(options.HasRubyLibraryPath); - } - - [Test] - public void RubyLibraryPathTrimsPath() - { - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - options.RubyLibraryPath = " "; - Assert.AreEqual(String.Empty, options.RubyLibraryPath); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Console/RubyConsoleHostTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Console/RubyConsoleHostTests.cs deleted file mode 100644 index d091a75b12..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Console/RubyConsoleHostTests.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.AvalonEdit; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Runtime; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Console -{ - /// - /// Basic tests for the RubyConsoleHost class. - /// - [TestFixture] - public class RubyConsoleHostTests - { - DerivedRubyConsoleHost host; - TextEditor textEditorControl; - ScriptingConsoleTextEditor textEditor; - - [TestFixtureSetUp] - public void Init() - { - textEditorControl = new TextEditor(); - textEditor = new ScriptingConsoleTextEditor(textEditorControl); - host = new DerivedRubyConsoleHost(textEditor); - } - - [TestFixtureTearDown] - public void TearDown() - { - host.Dispose(); - } - - [Test] - public void RubyConsoleHostIsMicrosoftScriptingConsoleHostType() - { - Assert.IsInstanceOf(typeof(ConsoleHost), host); - } - - [Test] - public void OptionsParserCreatedIsRubyOptionsParser() - { - OptionsParser parser = host.CallCreateOptionsParser(); - Assert.IsInstanceOf(typeof(IronRuby.Hosting.RubyOptionsParser), parser); - } - - [Test] - public void CommandLineCreatedIsRubyCommandLine() - { - CommandLine commandLine = host.CallCreateCommandLine(); - Assert.IsInstanceOf(typeof(IronRuby.Hosting.RubyCommandLine), commandLine); - } - - [Test] - public void ConsoleCreatedIsRubyConsole() - { - IConsole console = host.CallCreateConsole(null, null, null); - Assert.IsInstanceOf(typeof(RubyConsole), console); - } - - [Test] - public void RubyLanguageIsSetup() - { - LanguageSetup setup = host.CallCreateLanguageSetup(); - Assert.AreEqual("IronRuby", setup.DisplayName); - } - - [Test] - public void ConsoleHostImplementsIDisposable() - { - Assert.IsNotNull(host as IDisposable); - } - - /// - /// When the console is disposed calling ReadLine returns null. - /// - [Test] - public void HostDisposesRubyConsole() - { - DerivedRubyConsoleHost host = new DerivedRubyConsoleHost(new FakeConsoleTextEditor()); - RubyConsole console = host.CallCreateConsole(null, null, null) as RubyConsole; - host.Dispose(); - - Assert.IsNull(console.ReadLine(0)); - } - - /// - /// Makes sure the Dispose method checks if the Ruby console is null before trying to dispose it. - /// - [Test] - public void DisposingRubyConsoleHostWithoutCreatingRubyConsole() - { - RubyConsoleHost host = new RubyConsoleHost(new FakeConsoleTextEditor(), new FakeControlDispatcher()); - host.Dispose(); - } - - [Test] - public void DefaultOutputStreamReplacedByCustomStreamClass() - { - host.CallCreateConsole(null, null, null); - Assert.IsNotNull(host.OutputStream); - } - - [Test] - public void ProviderIsRubyContext() - { - Assert.AreEqual(typeof(RubyContext), host.GetProvider()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AddHandlerConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AddHandlerConversionTestFixture.cs deleted file mode 100644 index e4edb288a4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AddHandlerConversionTestFixture.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that assigning a method to an event handler is converted - /// from C# to Ruby correctly. - /// - [TestFixture] - public class AddHandlerConversionTestFixture - { - DefaultCompilationUnit unit; - ParseInformation parseInfo; - - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click += ButtonClick;\r\n" + - " button.MouseDown += self.OnMouseDown;\r\n" + - " }\r\n" + - "\r\n" + - " void ButtonClick(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " void OnMouseDown(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [SetUp] - public void Init() - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - unit = new DefaultCompilationUnit(projectContent); - DefaultClass c = new DefaultClass(unit, "Foo"); - - DefaultMethod buttonClickMethod = new DefaultMethod(c, "ButtonClick"); - AddSenderAndEventArgsParameters(buttonClickMethod); - c.Methods.Add(buttonClickMethod); - - DefaultMethod onMouseDownMethod = new DefaultMethod(c, "OnMouseDown"); - AddSenderAndEventArgsParameters(onMouseDownMethod); - c.Methods.Add(onMouseDownMethod); - - projectContent.AddClassToNamespaceList(c); - - parseInfo = new ParseInformation(unit); - } - - void AddSenderAndEventArgsParameters(IMethod method) - { - DefaultReturnType returnType = new DefaultReturnType(method.DeclaringType); - DomRegion region = new DomRegion(); - method.Parameters.Add(new DefaultParameter("sender", returnType, region)); - method.Parameters.Add(new DefaultParameter("e", returnType, region)); - } - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click { |sender, e| self.ButtonClick(sender, e) }\r\n" + - " button.MouseDown { |sender, e| self.OnMouseDown(sender, e) }\r\n" + - " end\r\n" + - "\r\n" + - " def ButtonClick(sender, e)\r\n" + - " end\r\n" + - "\r\n" + - " def OnMouseDown(sender, e)\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create("test.cs", parseInfo); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code, code); - } - - [Test] - public void CanGetFooClassFromCompilationUnitProjectContentGetClassMethod() - { - IClass c = unit.ProjectContent.GetClass("Foo", 0); - Assert.AreEqual("Foo", c.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayCastConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayCastConversionTestFixture.cs deleted file mode 100644 index 714413e512..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayCastConversionTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that an array cast is correctly converted to Ruby. - /// - [TestFixture] - public class ArrayCastConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Assign()\r\n" + - " {\r\n" + - " int[] elements = new int[10];\r\n" + - " List list = new List();\r\n" + - " list.Add((int[])elements.Clone());\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Assign()\r\n" + - " elements = Array.CreateInstance(System::Int32, 10)\r\n" + - " list = List[Array[System::Int32]].new()\r\n" + - " list.Add(elements.Clone())\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayConversionTestFixture.cs deleted file mode 100644 index a8dac5a9cf..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ArrayConversionTestFixture.cs +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that an array is converted from C# to Ruby. - /// - [TestFixture] - public class ArrayConversionTestFixture - { - string integerArray = "class Foo\r\n" + - "{\r\n" + - " public int[] Run()\r\n" + - " {" + - " int[] i = new int[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string int32Array = "class Foo\r\n" + - "{\r\n" + - " public Int32[] Run()\r\n" + - " {" + - " Int32[] i = new Int32[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string uintArray = "class Foo\r\n" + - "{\r\n" + - " public uint[] Run()\r\n" + - " {" + - " uint[] i = new uint[] {1, 2, 3, 4};\r\n" + - " i[0] = 5;\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string stringArray = "class Foo\r\n" + - "{\r\n" + - " public string[] Run()\r\n" + - " {" + - " string[] i = new string[] {\"a\", \"b\"};\r\n" + - " i[0] = \"c\";\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string barArray = "class Foo\r\n" + - "{\r\n" + - " public string[] Run()\r\n" + - " {" + - " Bar[] i = new Bar[] { new Bar(), new Bar()};\r\n" + - " i[0] = new Bar();\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string uriArray = "class Foo\r\n" + - "{\r\n" + - " public Uri[] Run()\r\n" + - " {" + - " Uri[] i = new Uri[] {new Uri(\"a\"), new Uri(\"b\")};\r\n" + - " i[0] = new Uri(\"c\");\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedIntegerArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[System::Int32].new([1, 2, 3, 4])\r\n" + - " i[0] = 5\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(integerArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedStringArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[System::String].new([\"a\", \"b\"])\r\n" + - " i[0] = \"c\"\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(stringArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedBarArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[Bar].new([Bar.new(), Bar.new()])\r\n" + - " i[0] = Bar.new()\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(barArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedUriArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[Uri].new([Uri.new(\"a\"), Uri.new(\"b\")])\r\n" + - " i[0] = Uri.new(\"c\")\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(uriArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedUIntArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[System::UInt32].new([1, 2, 3, 4])\r\n" + - " i[0] = 5\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(uintArray); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedInt32ArrayCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " i = Array[Int32].new([1, 2, 3, 4])\r\n" + - " i[0] = 5\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(int32Array); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs deleted file mode 100644 index 57bf6a2fd0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/AssignmentOperatorConversionTestFixture.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests ArithmeticOperatorType conversions: - /// - /// None, - /// Assign, - /// - /// Add, Done - /// Subtract, - /// Multiply, - /// Divide, - /// Modulus, - /// - /// Power, // (VB only) - /// DivideInteger, // (VB only) - /// ConcatString, // (VB only) - /// - /// ShiftLeft, - /// ShiftRight, - /// - /// BitwiseAnd, - /// BitwiseOr, - /// ExclusiveOr - /// - [TestFixture] - public class AssignmentOperatorConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public void Convert(int a)\r\n" + - " {\r\n" + - " a ASSIGNMENT_OPERATOR 5;\r\n" + - " }\r\n" + - "}"; - - string vb = - "Public Class Foo\r\n" + - " Public Sub Convert(ByVal a as Integer)\r\n" + - " a ASSIGNMENT_OPERATOR 5;\r\n" + - " End Sub\r\n" + - "End Class"; - - string RubyCodeTemplate = - "class Foo\r\n" + - " def Convert(a)\r\n" + - " a ASSIGNMENT_OPERATOR 5\r\n" + - " end\r\n" + - "end"; - - [Test] - public void MultiplyOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "*=")); - string expectedRuby = GetCode(RubyCodeTemplate, "*="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void DivideOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "/=")); - string expectedRuby = GetCode(RubyCodeTemplate, "/="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void ModulusOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "%=")); - string expectedRuby = GetCode(RubyCodeTemplate, "%="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void AndOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "&=")); - string expectedRuby = GetCode(RubyCodeTemplate, "&="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void OrOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "|=")); - string expectedRuby = GetCode(RubyCodeTemplate, "|="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void ExclusiveOrOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "^=")); - string expectedRuby = GetCode(RubyCodeTemplate, "^="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void ShiftLeftOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, "<<=")); - string expectedRuby = GetCode(RubyCodeTemplate, "<<="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void ShiftRightOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(csharp, ">>=")); - string expectedRuby = GetCode(RubyCodeTemplate, ">>="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void VBConcatOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(vb, "&=")); - string expectedRuby = GetCode(RubyCodeTemplate, "+="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void VBDivideIntegerOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(vb, "\\=")); - string expectedRuby = GetCode(RubyCodeTemplate, "/="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void VBPowerOperator() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string Ruby = converter.Convert(GetCode(vb, "^=")); - string expectedRuby = GetCode(RubyCodeTemplate, "**="); - - Assert.AreEqual(expectedRuby, Ruby); - } - - string GetCode(string code, string assignmentOperator) - { - return code.Replace("ASSIGNMENT_OPERATOR", assignmentOperator); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassConversionTestFixture.cs deleted file mode 100644 index f9cd579bfd..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassConversionTestFixture.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class BaseClassConversionTestFixture - { - string csharp = - "class Foo : Bar, IMyInterface\r\n" + - "{\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo < Bar, IMyInterface\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassReferenceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassReferenceTestFixture.cs deleted file mode 100644 index 8736f1ee2b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BaseClassReferenceTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that a base class reference through the base keyword - /// is converted to the self keyword in Ruby when converting - /// from C# to Ruby correctly. - /// - [TestFixture] - public class BaseClassReferenceTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public string Run()\r\n" + - " {" + - " return base.ToString();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def Run()\r\n" + - " return self.ToString()\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BinaryOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BinaryOperatorConversionTestFixture.cs deleted file mode 100644 index e7d37adf82..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BinaryOperatorConversionTestFixture.cs +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.NRefactory.Ast; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that all the binary operators are converted to - /// Ruby correctly. - /// - [TestFixture] - public class BinaryOperatorConversionTests - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run(i)\r\n" + - " {\r\n" + - " if (i BINARY_OPERATOR 0) {\r\n" + - " return 10;\r\n" + - " }\r\n" + - " return 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GreaterThan() - { - Assert.AreEqual(">", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.GreaterThan)); - } - - [Test] - public void NotEqual() - { - Assert.AreEqual("!=", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.InEquality)); - } - - [Test] - public void Divide() - { - Assert.AreEqual("/", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.Divide)); - } - - [Test] - public void LessThan() - { - Assert.AreEqual("<", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.LessThan)); - } - - [Test] - public void Equals() - { - string code = GetCode(@"=="); - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string RubyCode = converter.Convert(code); - string expectedRubyCode = "class Foo\r\n" + - " def Run(i)\r\n" + - " if i == 0 then\r\n" + - " return 10\r\n" + - " end\r\n" + - " return 0\r\n" + - " end\r\n" + - "end"; - Assert.AreEqual(expectedRubyCode, RubyCode); - } - - [Test] - public void LessThanOrEqual() - { - Assert.AreEqual("<=", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.LessThanOrEqual)); - } - - [Test] - public void GreaterThanOrEqual() - { - Assert.AreEqual(">=", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.GreaterThanOrEqual)); - } - - [Test] - public void Add() - { - Assert.AreEqual("+", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.Add)); - } - - [Test] - public void Multiply() - { - Assert.AreEqual("*", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.Multiply)); - } - - [Test] - public void BitwiseAnd() - { - Assert.AreEqual("&", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.BitwiseAnd)); - } - - [Test] - public void BitwiseOr() - { - Assert.AreEqual("|", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.BitwiseOr)); - } - - [Test] - public void BooleanAnd() - { - Assert.AreEqual("and", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.LogicalAnd)); - } - - [Test] - public void BooleanOr() - { - Assert.AreEqual("or", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.LogicalOr)); - } - - [Test] - public void BooleanXor() - { - Assert.AreEqual("^", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.ExclusiveOr)); - } - - [Test] - public void Modulus() - { - Assert.AreEqual("%", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.Modulus)); - } - - [Test] - public void Subtract() - { - Assert.AreEqual("-", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.Subtract)); - } - - [Test] - public void DivideInteger() - { - Assert.AreEqual("/", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.DivideInteger)); - } - - [Test] - public void ReferenceEquality() - { - Assert.AreEqual("is", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.ReferenceEquality)); - } - - [Test] - public void BitShiftRight() - { - Assert.AreEqual(">>", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.ShiftRight)); - } - - [Test] - public void BitShiftLeft() - { - Assert.AreEqual("<<", NRefactoryToRubyConverter.GetBinaryOperator(BinaryOperatorType.ShiftLeft)); - } - - /// - /// Gets the C# code with the binary operator replaced with the - /// specified string. - /// - string GetCode(string op) - { - return csharp.Replace("BINARY_OPERATOR", op); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BitShiftConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BitShiftConversionTestFixture.cs deleted file mode 100644 index 6be17417da..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BitShiftConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class BitShiftConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public int Convert()\r\n" + - " {\r\n" + - " int a = (b >> 16) & 0xffff;\r\n" + - " return a;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Convert()\r\n" + - " a = (b >> 16) & 0xffff\r\n" + - " return a\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BooleanConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BooleanConversionTestFixture.cs deleted file mode 100644 index 3198abe543..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BooleanConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class BooleanVariableConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " bool a;\r\n" + - "\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " a = true;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def initialize()\r\n" + - " @a = true\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs deleted file mode 100644 index 94c26e6a3f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/BreakAndContinueConversionTestFixture.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that a break statement is converted correctly. - /// - [TestFixture] - public class BreakAndContinueConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " int i = 0;\r\n" + - " while (i < 10) {\r\n" + - " if (i == 5) {\r\n" + - " break;\r\n" + - " } else {\r\n" + - " continue;\r\n" + - " }\r\n" + - " i++;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Run()\r\n" + - " i = 0\r\n" + - " while i < 10\r\n" + - " if i == 5 then\r\n" + - " break\r\n" + - " else\r\n" + - " next\r\n" + - " end\r\n" + - " i += 1\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs deleted file mode 100644 index c53fc76c44..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CSharpClassWithNamespaceConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class CSharpClassWithNamespaceConversionTestFixture - { - string csharp = "namespace MyNamespace\r\n" + - "{\r\n" + - " class Foo\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "module MyNamespace\r\n" + - " class Foo\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs deleted file mode 100644 index 97f9acc5e7..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CallConstructorWithParametersConversionTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that parameters passed to a constructor are converted to Ruby correctly. - /// - [TestFixture] - public class CallConstructorWithParametersConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " Bar b = new Bar(0, 0, 1, 10);\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " b = Bar.new(0, 0, 1, 10)\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CannotFindMethodForEventHandlerConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CannotFindMethodForEventHandlerConversionTestFixture.cs deleted file mode 100644 index afae1cc2d3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CannotFindMethodForEventHandlerConversionTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class CannotFindMethodForEventHandlerConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click += ButtonClick;\r\n" + - " button.MouseDown += self.OnMouseDown;\r\n" + - " }\r\n" + - "}"; - - /// - /// When event handler method cannot be found the generated ruby code assumes the - /// method has no parameters. - /// - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click { self.ButtonClick() }\r\n" + - " button.MouseDown { self.OnMouseDown() }\r\n" + - " end\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - DefaultCompilationUnit unit = new DefaultCompilationUnit(projectContent); - ParseInformation parseInfo = new ParseInformation(unit); - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp, parseInfo); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassConstructorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassConstructorConversionTestFixture.cs deleted file mode 100644 index 40af6dbc5b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassConstructorConversionTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a class constructor. - /// - [TestFixture] - public class ClassConstructorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def initialize()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassDestructorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassDestructorConversionTestFixture.cs deleted file mode 100644 index d272fa2da8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassDestructorConversionTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ClassDestructorConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " int i = 10;\r\n" + - " public ~Foo()\r\n" + - " {\r\n" + - " i = 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 10\r\n" + - " end\r\n" + - "\r\n" + - " def finalize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassFieldReferenceConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassFieldReferenceConversionTestFixture.cs deleted file mode 100644 index d8b7e5573d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassFieldReferenceConversionTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that the keyword this is used when an explicit reference to a field is used. - /// Also tests that any constructor parameters are generated. - /// - [TestFixture] - public class ClassFieldReferenceConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int i;\r\n" + - " int j;\r\n" + - " public Foo(int i)\r\n" + - " {\r\n" + - " this.i = i;\r\n" + - " }\r\n" + - "\r\n" + - " public void SetInt(int j)\r\n" + - " {\r\n" + - " this.j = j;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize(i)\r\n" + - " self.@i = i\r\n" + - " end\r\n" + - "\r\n" + - " def SetInt(j)\r\n" + - " self.@j = j\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassWithNamespaceAndUsingStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassWithNamespaceAndUsingStatementConversionTestFixture.cs deleted file mode 100644 index 79ab285e9f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ClassWithNamespaceAndUsingStatementConversionTestFixture.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that there is a new line between the require statements and the module name. - /// - [TestFixture] - public class ClassWithNamespaceAndUsingStatementsConversionTestFixture - { - string csharp = - "using System.Windows.Forms;\r\n" + - "\r\n" + - "namespace MyNamespace\r\n" + - "{\r\n" + - " class Foo\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "require \"mscorlib\"\r\n" + - "require \"System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" + - "\r\n" + - "module MyNamespace\r\n" + - " class Foo\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertCSharpToRubyMenuCommandTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertCSharpToRubyMenuCommandTestFixture.cs deleted file mode 100644 index 14e76f9f39..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertCSharpToRubyMenuCommandTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ConvertCSharpToRubyMenuCommandTestFixture : ConvertToRubyMenuCommand - { - string newFileText; - string defaultFileName; - string language; - string fileNamePassedToGetParseInformation; - - [TestFixtureSetUp] - public void SetUpFixture() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent("test.cs"); - workbench.ActiveMockEditableViewContent.Text = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - MockTextEditorOptions options = workbench.ActiveMockEditableViewContent.MockTextEditorOptions; - options.IndentationSize = 4; - options.ConvertTabsToSpaces = true; - - Run(workbench); - } - - [Test] - public void GeneratedRubyCode() - { - string code = - "class Foo\r\n" + - " def initialize()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(code, newFileText); - } - - [Test] - public void NewFileName() - { - Assert.AreEqual("Generated.rb", defaultFileName); - } - - [Test] - public void NewFileLanguage() - { - Assert.AreEqual("Ruby", language); - } - - [Test] - public void NameOfFileBeingConvertedIsPassedToParserServiceGetInformation() - { - Assert.AreEqual("test.cs", fileNamePassedToGetParseInformation); - } - - protected override void NewFile(string defaultName, string language, string content) - { - defaultFileName = defaultName; - this.language = language; - newFileText = content; - } - - protected override ParseInformation GetParseInformation(string fileName) - { - fileNamePassedToGetParseInformation = fileName; - return new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertEventHandlerForClassWithNamespaceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertEventHandlerForClassWithNamespaceTestFixture.cs deleted file mode 100644 index 3845c3ba74..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertEventHandlerForClassWithNamespaceTestFixture.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ConvertEventHandlerForClassWithNamespaceTestFixture - { - DefaultCompilationUnit unit; - ParseInformation parseInfo; - - string csharp = - "namespace NewNamespace\r\n" + - "{\r\n" + - " class Foo\r\n" + - " {\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click += ButtonClick;\r\n" + - " button.MouseDown += self.OnMouseDown;\r\n" + - " }\r\n" + - " \r\n" + - " void ButtonClick(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - " \r\n" + - " void OnMouseDown(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [SetUp] - public void Init() - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - unit = new DefaultCompilationUnit(projectContent); - DefaultClass c = new DefaultClass(unit, "NewNamespace.Foo"); - - DefaultMethod buttonClickMethod = new DefaultMethod(c, "ButtonClick"); - AddSenderAndEventArgsParameters(buttonClickMethod); - c.Methods.Add(buttonClickMethod); - - DefaultMethod onMouseDownMethod = new DefaultMethod(c, "OnMouseDown"); - AddSenderAndEventArgsParameters(onMouseDownMethod); - c.Methods.Add(onMouseDownMethod); - - projectContent.AddClassToNamespaceList(c); - - parseInfo = new ParseInformation(unit); - } - - void AddSenderAndEventArgsParameters(IMethod method) - { - DefaultReturnType returnType = new DefaultReturnType(method.DeclaringType); - DomRegion region = new DomRegion(); - method.Parameters.Add(new DefaultParameter("sender", returnType, region)); - method.Parameters.Add(new DefaultParameter("e", returnType, region)); - } - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "module NewNamespace\r\n" + - " class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click { |sender, e| self.ButtonClick(sender, e) }\r\n" + - " button.MouseDown { |sender, e| self.OnMouseDown(sender, e) }\r\n" + - " end\r\n" + - "\r\n" + - " def ButtonClick(sender, e)\r\n" + - " end\r\n" + - "\r\n" + - " def OnMouseDown(sender, e)\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create("test.cs", parseInfo); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code, code); - } - - [Test] - public void CanGetFooClassFromCompilationUnitProjectContentGetClassMethod() - { - IClass c = unit.ProjectContent.GetClass("NewNamespace.Foo", 0); - Assert.AreEqual("Foo", c.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs deleted file mode 100644 index 5677e4c532..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertToRubyProjectCommandTestFixture.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.IO; -using System.Text; - -using ICSharpCode.Core; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ConvertToRubyProjectCommandTestFixture - { - DerivedConvertProjectToRubyProjectCommand convertProjectCommand; - FileProjectItem source; - FileProjectItem target; - MockProject sourceProject; - RubyProject targetProject; - FileProjectItem textFileSource; - FileProjectItem textFileTarget; - ParseInformation parseInfo; - - string sourceCode = - "class Foo\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyMSBuildEngineHelper.InitMSBuildEngine(); - - List bindings = new List(); - using (TextReader reader = RubyBindingAddInFile.ReadAddInFile()) { - AddIn addin = AddIn.Load(reader, String.Empty); - bindings.Add(new ProjectBindingDescriptor(AddInHelper.GetCodon(addin, "/SharpDevelop/Workbench/ProjectBindings", "Ruby"))); - } - ProjectBindingService.SetBindings(bindings); - - convertProjectCommand = new DerivedConvertProjectToRubyProjectCommand(); - parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - convertProjectCommand.ParseInfo = parseInfo; - convertProjectCommand.FileServiceDefaultEncoding = Encoding.Unicode; - - sourceProject = new MockProject(); - sourceProject.Directory = @"d:\projects\test"; - source = new FileProjectItem(sourceProject, ItemType.Compile, @"src\Program.cs"); - targetProject = (RubyProject)convertProjectCommand.CallCreateProject(@"d:\projects\test\converted", sourceProject); - target = new FileProjectItem(targetProject, source.ItemType, source.Include); - source.CopyMetadataTo(target); - - textFileSource = new FileProjectItem(sourceProject, ItemType.None, @"src\readme.txt"); - textFileTarget = new FileProjectItem(targetProject, textFileSource.ItemType, textFileSource.Include); - textFileSource.CopyMetadataTo(textFileTarget); - - convertProjectCommand.AddParseableFileContent(source.FileName, sourceCode); - - convertProjectCommand.CallConvertFile(source, target); - convertProjectCommand.CallConvertFile(textFileSource, textFileTarget); - } - - [Test] - public void CommandHasRubyTargetLanguage() - { - Assert.AreEqual(RubyProjectBinding.LanguageName, convertProjectCommand.TargetLanguageName); - } - - [Test] - public void TargetFileExtensionChanged() - { - Assert.AreEqual(@"src\Program.rb", target.Include); - } - - [Test] - public void TextFileTargetFileExtensionUnchanged() - { - Assert.AreEqual(@"src\readme.txt", textFileTarget.Include); - } - - [Test] - public void FilesPassedToBaseClassForConversion() - { - List expectedFiles = new List(); - expectedFiles.Add(new SourceAndTargetFile(textFileSource, textFileTarget)); - Assert.AreEqual(expectedFiles, convertProjectCommand.SourceAndTargetFilesPassedToBaseClass); - } - - [Test] - public void ExpectedCodeWrittenToFile() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp, parseInfo); - string expectedCode = converter.Convert(sourceCode, SupportedLanguage.CSharp) + - "\r\n" + - "\r\n" + - converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - - List expectedSavedFiles = new List(); - expectedSavedFiles.Add(new ConvertedFile(target.FileName, expectedCode, Encoding.Unicode)); - Assert.AreEqual(expectedSavedFiles, convertProjectCommand.SavedFiles); - } - - [Test] - public void FileNamesPassedToGetParseInfoMethod() - { - List expectedFileNames = new List(); - expectedFileNames.Add(@"d:\projects\test\src\Program.cs"); - expectedFileNames.Add(@"d:\projects\test\src\readme.txt"); - Assert.AreEqual(expectedFileNames.ToArray(), convertProjectCommand.FilesPassedToGetParseInfo.ToArray()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertVBNetToRubyMenuCommandTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertVBNetToRubyMenuCommandTestFixture.cs deleted file mode 100644 index 14f127126d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertVBNetToRubyMenuCommandTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ConvertVBNetToRubyMenuCommandTestFixture : ConvertToRubyMenuCommand - { - string newFileText; - string defaultFileName; - string language; - string fileNamePassedToGetParseInformation; - - [SetUp] - public void Init() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent("test.vb"); - workbench.ActiveMockEditableViewContent.Text = - "class Foo\r\n" + - " Public Sub New\r\n" + - " End Sub\r\n" + - "end class"; - - MockTextEditorOptions options = workbench.ActiveMockEditableViewContent.MockTextEditorOptions; - options.ConvertTabsToSpaces = false; - options.IndentationSize = 2; - - Run(workbench); - } - - [Test] - public void GeneratedRubyCode() - { - string expectedRubyCode = - "class Foo\r\n" + - "\tdef initialize()\r\n" + - "\tend\r\n" + - "end"; - - Assert.AreEqual(expectedRubyCode, newFileText); - } - - [Test] - public void NewFileName() - { - Assert.AreEqual("Generated.rb", defaultFileName); - } - - [Test] - public void NewFileLanguage() - { - Assert.AreEqual("Ruby", language); - } - - [Test] - public void NameOfFileBeingConvertedIsPassedToParserServiceGetInformation() - { - Assert.AreEqual("test.vb", fileNamePassedToGetParseInformation); - } - - protected override void NewFile(string defaultName, string language, string content) - { - defaultFileName = defaultName; - this.language = language; - newFileText = content; - } - - protected override ParseInformation GetParseInformation(string fileName) - { - fileNamePassedToGetParseInformation = fileName; - return new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertedSupportedLanguageTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertedSupportedLanguageTests.cs deleted file mode 100644 index 8524005e46..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ConvertedSupportedLanguageTests.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.RubyBinding; -using ICSharpCode.NRefactory; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ConverterSupportedLanguageTests - { - [Test] - public void CSharpSupportedLanguage() - { - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create(".cs", CreateParseInfo()); - Assert.AreEqual(SupportedLanguage.CSharp, converter.SupportedLanguage); - } - - [Test] - public void VBNetSupportedLanguage() - { - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create(".vb", CreateParseInfo()); - Assert.AreEqual(SupportedLanguage.VBNet, converter.SupportedLanguage); - } - - [Test] - public void CSharpCaseInsensitive() - { - NRefactoryToRubyConverter converter = NRefactoryToRubyConverter.Create(".CS", CreateParseInfo()); - Assert.AreEqual(SupportedLanguage.CSharp, converter.SupportedLanguage); - } - - [Test] - public void NullFileName() - { - Assert.IsNull(NRefactoryToRubyConverter.Create(null, CreateParseInfo())); - } - - [Test] - public void TextFileCannotBeConverted() - { - Assert.IsNull(NRefactoryToRubyConverter.Create(".txt", CreateParseInfo())); - } - - [Test] - public void CanConvertCSharpFiles() - { - Assert.IsTrue(NRefactoryToRubyConverter.CanConvert(".cs")); - } - - [Test] - public void CanConvertVBNetFiles() - { - Assert.IsTrue(NRefactoryToRubyConverter.CanConvert(".vb")); - } - - [Test] - public void CanConvertIsCaseInsensitive() - { - Assert.IsTrue(NRefactoryToRubyConverter.CanConvert(".CS")); - } - - [Test] - public void CannotConvertTextFile() - { - Assert.IsFalse(NRefactoryToRubyConverter.CanConvert(".txt")); - } - - [Test] - public void CannotConvertNullFileName() - { - Assert.IsFalse(NRefactoryToRubyConverter.CanConvert(null)); - } - - ParseInformation CreateParseInfo() - { - return new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CreateConverterWithNullParseInfoTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CreateConverterWithNullParseInfoTestFixture.cs deleted file mode 100644 index 4f27b3613f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/CreateConverterWithNullParseInfoTestFixture.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class CreateConverterWithNullParseInfoTestFixture - { - [Test] - public void NRefactoryToRubyConverterCreateThrowsArgumentNullExceptionWhenParseInfoParameterIsNull() - { - ArgumentNullException ex = - Assert.Throws(delegate { NRefactoryToRubyConverter.Create("test.cs", null); }); - Assert.AreEqual("parseInfo", ex.ParamName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs deleted file mode 100644 index 9bd023ecf2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ElseIfStatementConversionTestFixture.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ElseIfStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int GetCount(i)\r\n" + - " {" + - " if (i == 0) {\r\n" + - " return 10;\r\n" + - " } else if (i < 1) {\r\n" + - " return 4;\r\n" + - " }\r\n" + - " return 2;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def GetCount(i)\r\n" + - " if i == 0 then\r\n" + - " return 10\r\n" + - " elsif i < 1 then\r\n" + - " return 4\r\n" + - " end\r\n" + - " return 2\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs deleted file mode 100644 index 49687740f1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EmptyCSharpClassConversionTestFixture.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class. - /// - [TestFixture] - public class EmptyCSharpClassConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs deleted file mode 100644 index e5cbf9e4cd..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/EventHandlerWithObjectCreationTestFixture.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that an event handler such as button1.Click += new EventHandler(Button1Click) is converted - /// to Ruby correctly. - /// - [TestFixture] - public class EventHandlerWithObjectCreationTestFixture - { - DefaultCompilationUnit unit; - ParseInformation parseInfo; - - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click += new EventHandler(ButtonClick);\r\n" + - " }\r\n" + - "\r\n" + - " void ButtonClick(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [SetUp] - public void Init() - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - unit = new DefaultCompilationUnit(projectContent); - DefaultClass c = new DefaultClass(unit, "Foo"); - - DefaultMethod buttonClickMethod = new DefaultMethod(c, "ButtonClick"); - AddSenderAndEventArgsParameters(buttonClickMethod); - c.Methods.Add(buttonClickMethod); - - projectContent.AddClassToNamespaceList(c); - - parseInfo = new ParseInformation(unit); - } - - void AddSenderAndEventArgsParameters(IMethod method) - { - DefaultReturnType returnType = new DefaultReturnType(method.DeclaringType); - DomRegion region = new DomRegion(); - method.Parameters.Add(new DefaultParameter("sender", returnType, region)); - method.Parameters.Add(new DefaultParameter("e", returnType, region)); - } - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click { |sender, e| self.ButtonClick(sender, e) }\r\n" + - " end\r\n" + - "\r\n" + - " def ButtonClick(sender, e)\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp, parseInfo); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void CanGetFooClassFromCompilationUnitProjectContentGetClassMethod() - { - IClass c = unit.ProjectContent.GetClass("Foo", 0); - Assert.AreEqual("Foo", c.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs deleted file mode 100644 index 3659f7684e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/FieldDeclarationWithNoInitializerTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the C# to Ruby converter does not add an - /// assignment for a variable declaration that has no - /// initial value assigned. - /// - [TestFixture] - public class FieldDeclarationWithNoInitializerTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " private int i;\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " int j = 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " j = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForLoopConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForLoopConversionTestFixture.cs deleted file mode 100644 index 7b1175974a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForLoopConversionTestFixture.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of a for loop to Ruby. - /// - /// C#: - /// - /// for (int i = 0; i < 5; ++i) { - /// } - /// - /// Ruby: - /// - /// i = 0 - /// while i < 5 - /// i = i + 1 - /// end - /// - /// Ideally we would convert it to: - /// - /// for i in 0..5 - /// ... - /// end - /// - [TestFixture] - public class ForLoopConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int GetCount()\r\n" + - " {\r\n" + - " int count = 0;\r\n" + - " for (int i = 0; i < 5; i = i + 1) {\r\n" + - " count++;\r\n" + - " }\r\n" + - " return count;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - System.Console.WriteLine(code); - string expectedCode = - "class Foo\r\n" + - " def GetCount()\r\n" + - " count = 0\r\n" + - " i = 0\r\n" + - " while i < 5\r\n" + - " count += 1\r\n" + - " i = i + 1\r\n" + - " end\r\n" + - " return count\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForNextConversionTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForNextConversionTests.cs deleted file mode 100644 index 98d6fe2ea3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForNextConversionTests.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ForNextConversionTests - { - string vbnetForNextCode = - "Public Class Foo\r\n" + - " Public Function GetCount() As Integer\r\n" + - " Dim count As Integer = 0\r\n" + - " For i As Integer = 0 To 4\r\n" + - " count += 1\r\n" + - " Next\r\n" + - " Return count\r\n" + - " End Function\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertVBNetForNextToRuby() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string code = converter.Convert(vbnetForNextCode); - string expectedCode = - "class Foo\r\n" + - " def GetCount()\r\n" + - " count = 0\r\n" + - " i = 0\r\n" + - " while i <= 4\r\n" + - " count += 1\r\n" + - " i = i + 1\r\n" + - " end\r\n" + - " return count\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - - string vbnetForNextWithStepCode = - "Public Class Foo\r\n" + - " Public Function GetCount() As Integer\r\n" + - " Dim count As Integer = 0\r\n" + - " For i As Integer = 0 To 4 Step 2\r\n" + - " count += 1\r\n" + - " Next\r\n" + - " Return count\r\n" + - " End Function\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertVBNetForNextWithStepToRuby() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string code = converter.Convert(vbnetForNextWithStepCode); - string expectedCode = - "class Foo\r\n" + - " def GetCount()\r\n" + - " count = 0\r\n" + - " i = 0\r\n" + - " while i <= 4\r\n" + - " count += 1\r\n" + - " i = i + 2\r\n" + - " end\r\n" + - " return count\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionTestFixture.cs deleted file mode 100644 index cb8fe66a99..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of a foreach loop to Ruby. - /// - [TestFixture] - public class ForeachConversionTestFixture - { - string intArrayCode = "class Foo\r\n" + - "{\r\n" + - " public int GetCount(int[] items)\r\n" + - " {\r\n" + - " int count = 0;\r\n" + - " foreach (int item in items) {\r\n" + - " count++;\r\n" + - " }\r\n" + - " return count;\r\n" + - " }\r\n" + - "}"; - - string dictionaryCode = "class Foo\r\n" + - "{\r\n" + - " public void DisplayItems()\r\n" + - " {\r\n" + - " Dictionary record = new Dictionary();\r\n" + - " record.Add(\"a\", \"b\");\r\n" + - " record.Add(\"c\", \"d\");\r\n" + - " foreach (string key in record.Keys) {\r\n" + - " Console.WriteLine(\"Key: \" + key);\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedIntArrayCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(intArrayCode); - string expectedCode = - "class Foo\r\n" + - " def GetCount(items)\r\n" + - " count = 0\r\n" + - " enumerator = items.GetEnumerator()\r\n" + - " while enumerator.MoveNext()\r\n" + - " item = enumerator.Current\r\n" + - " count += 1\r\n" + - " end\r\n" + - " return count\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - - [Test] - public void ConvertedDictionaryCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(dictionaryCode); - string expectedCode = - "class Foo\r\n" + - " def DisplayItems()\r\n" + - " record = Dictionary[System::String, System::String].new()\r\n" + - " record.Add(\"a\", \"b\")\r\n" + - " record.Add(\"c\", \"d\")\r\n" + - " enumerator = record.Keys.GetEnumerator()\r\n" + - " while enumerator.MoveNext()\r\n" + - " key = enumerator.Current\r\n" + - " Console.WriteLine(\"Key: \" + key)\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs deleted file mode 100644 index 3644014445..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ForeachConversionWithMethodCallTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ForeachConversionWithMethodCallTestFixture - { - string environmentSpecialFolderCode = "class Foo\r\n" + - "{\r\n" + - " public void PrintEnvironmentVariables()\r\n" + - " {\r\n" + - " foreach (Environment.SpecialFolder folder in Environment.SpecialFolder.GetValues(typeof(Environment.SpecialFolder)))\r\n" + - " {\r\n" + - " Console.WriteLine(\"{0}={1}\\n\", folder, Environment.GetFolderPath(folder));\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedEnvironmentSpecialFolderCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(environmentSpecialFolderCode); - string expectedCode = - "require \"mscorlib\"\r\n" + - "\r\n" + - "class Foo\r\n" + - " def PrintEnvironmentVariables()\r\n" + - " enumerator = Environment.SpecialFolder.GetValues(Environment::SpecialFolder.to_clr_type).GetEnumerator()\r\n" + - " while enumerator.MoveNext()\r\n" + - " folder = enumerator.Current\r\n" + - " Console.WriteLine(\"{0}={1}\\n\", folder, Environment.GetFolderPath(folder))\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - Assert.AreEqual(expectedCode, code, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs deleted file mode 100644 index f58639e680..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenerateMainMethodCallTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the generation of code to call the class's Main method. - /// - [TestFixture] - public class GenerateMainMethodCallTestFixture - { - string mainMethodWithNoParametersCode = "class Foo\r\n" + - "{\r\n" + - " static void Main()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " static void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedMainMethodCallWithNoParametersCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - converter.Convert(mainMethodWithNoParametersCode); - string code = converter.GenerateMainMethodCall(converter.EntryPointMethods[0]); - Assert.AreEqual("Foo.Main()", code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenericListConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenericListConversionTestFixture.cs deleted file mode 100644 index 7a827ec14e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/GenericListConversionTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that the code to create an instance of a generic list is converted to Ruby - /// correctly. - /// - /// C#: List list = new List(); - /// - /// Ruby: list = List[str]() - /// - [TestFixture] - public class GenericListConversionTestFixture - { - string csharp = "using System.Collections.Generic;\r\n" + - "\r\n" + - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " List list = new List();\r\n" + - " Dictionary dictionary = new Dictionary();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "require \"mscorlib\"\r\n" + - "require \"System.Collections.Generic, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" + - "\r\n" + - "class Foo\r\n" + - " def initialize()\r\n" + - " list = List[System::String].new()\r\n" + - " dictionary = Dictionary[System::String, System::Int32].new()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs deleted file mode 100644 index 69b7e886f6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfBlockStatementConversionTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else blocks both have more than one statement. - /// - [TestFixture] - public class IfBlockStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " public int GetCount()\r\n" + - " {" + - " if (i == 0) {\r\n" + - " i = 10;\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " i = 4;\r\n" + - " return 4;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def GetCount()\r\n" + - " if @i == 0 then\r\n" + - " @i = 10\r\n" + - " return 10\r\n" + - " else\r\n" + - " @i = 4\r\n" + - " return 4\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfStatementConversionTestFixture.cs deleted file mode 100644 index 523c1bdf10..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IfStatementConversionTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of a C# if-else statement to Ruby. - /// - [TestFixture] - public class IfStatementConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " public int GetCount()\r\n" + - " {" + - " if (i == 0) {\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " return 4;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def GetCount()\r\n" + - " if @i == 0 then\r\n" + - " return 10\r\n" + - " else\r\n" + - " return 4\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IncrementAndDecrementConversionTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IncrementAndDecrementConversionTests.cs deleted file mode 100644 index 9cd732e119..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IncrementAndDecrementConversionTests.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that an integer increments and decrements are converted - /// from C# to Ruby correctly. - /// - [TestFixture] - public class IncrementAndDecrementConversionTests - { - [Test] - public void PreIncrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " ++i;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i += 1\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void PostIncrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i++;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i += 1\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void PreDecrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " --i\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i -= 1\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void PostDecrement() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i--\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i -= 1\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void Add10() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = i + 10\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i = i + 10\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void Add5() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i += 5\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i += 5\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void Subtract10() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = i - 10\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i = i - 10\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void Subtract5() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i -= 5\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - " def Run(i)\r\n" + - " i -= 5\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs deleted file mode 100644 index 64bd6480d9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldConversionTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a class with - /// a private field that's an integer. What should happen is that - /// all fields initialized in the class are moved to the start of the - /// initialize method. Note that this assumes there are no - /// overloaded constructors otherwise we will get duplicated code. - /// - [TestFixture] - public class IntegerClassFieldConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " private int i = 0;\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs deleted file mode 100644 index 9d1eb7c938..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldInitializedInConstructorTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter correctly converts the class - /// constructor when a value is assigned to one of its fields. - /// - [TestFixture] - public class IntegerClassFieldInitializedInConstructorTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " private int i;\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " i = 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs deleted file mode 100644 index ae5e7811b2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerClassFieldWithConstructorTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class does not add - /// an extra constructor method to hold the statements to - /// initialize the converted class's fields. - /// - [TestFixture] - public class IntegerClassFieldWithConstructorTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " private int i = 0;\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " int j = 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " j = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerMethodParameterTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerMethodParameterTestFixture.cs deleted file mode 100644 index 513bf39aec..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/IntegerMethodParameterTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that a method call is converted correctly. - /// - [TestFixture] - public class IntegerMethodParameterTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public void Print()\r\n" + - " {\r\n" + - " int i = 0;\r\n" + - " PrintInt(i);\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Print()\r\n" + - " i = 0\r\n" + - " self.PrintInt(i)\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs deleted file mode 100644 index 81825997b3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableAssignedInConstructorTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter correctly converts a local - /// variable in the constructor. - /// - [TestFixture] - public class LocalVariableAssignedInConstructorTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " int i = 0;\r\n" + - " int i = 2;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " i = 0\r\n" + - " i = 2\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs deleted file mode 100644 index aa6ad39e7c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDeclarationInIfStatementTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else block have a local variable defined. - /// - [TestFixture] - public class LocalVariableDeclarationInIfStatementTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " public int GetCount()\r\n" + - " {" + - " if (i == 0) {\r\n" + - " int j = 10;\r\n" + - " return j;\r\n" + - " } else {\r\n" + - " iint j = 4;\r\n" + - " return j;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def GetCount()\r\n" + - " if @i == 0 then\r\n" + - " j = 10\r\n" + - " return j\r\n" + - " else\r\n" + - " j = 4\r\n" + - " return j\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs deleted file mode 100644 index 6824583c04..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableDefinitionsOnSameLineTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class LocalVariableDefinitionsOnSameLineTests - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " int i = 0, i = 2;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " i = 0\r\n" + - " i = 2\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - - string vnetClassWithTwoArrayLocalVariablesOnSameLine = - "class Foo\r\n" + - " Public Sub New()\r\n" + - " Dim i(10), j(20) as integer\r\n" + - " End Sub\r\n" + - "end class"; - - [Test] - public void ConvertVBNetClassWithTwoArrayVariablesOnSameLine() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string ruby = converter.Convert(vnetClassWithTwoArrayLocalVariablesOnSameLine); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " i = Array.CreateInstance(System::Int32, 10)\r\n" + - " j = Array.CreateInstance(System::Int32, 20)\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs deleted file mode 100644 index 7ca960fed4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/LocalVariableNotInitializedTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class LocalVariableNotInitializedTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public int GetCount()\r\n" + - " {\r\n" + - " int i;\r\n" + - " return 10;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def GetCount()\r\n" + - " return 10\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodCallInConstructorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodCallInConstructorTestFixture.cs deleted file mode 100644 index 3da91f66e5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodCallInConstructorTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Was causing a null reference exception in the convertor's IsStatic method since the method - /// being passed as a parameter is null. - /// - [TestFixture] - public class MethodCallInConstructorTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " Init();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " self.Init()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodParameterConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodParameterConversionTestFixture.cs deleted file mode 100644 index 8b5a2c94d4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodParameterConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that method parameters are converted into Ruby - /// correctly. - /// - [TestFixture] - public class MethodParameterConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run(int i)\r\n" + - " {\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - string expectedCode = "class Foo\r\n" + - " def Run(i)\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs deleted file mode 100644 index 16576067c1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodReturnValueConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a method that - /// returns an integer. - /// - [TestFixture] - public class MethodReturnValueConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run()\r\n" + - " {\r\n" + - " return 10;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def Run()\r\n" + - " return 10\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs deleted file mode 100644 index 14988e58f1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MethodWithBodyConversionTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a method with - /// simple integer assignment in the body. - /// - [TestFixture] - public class MethodWithBodyConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " int i = 0;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def Run()\r\n" + - " i = 0\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs deleted file mode 100644 index 42e5c62d74..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ModulusOperatorConversionTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ModulusOperatorConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public void Convert(int a)\r\n" + - " {\r\n" + - " a %= 5;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Convert(a)\r\n" + - " a %= 5\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultiLineCommentConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultiLineCommentConversionTestFixture.cs deleted file mode 100644 index d0aa268182..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultiLineCommentConversionTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class MultiLineCommentConversionTestFixture - { - string csharp = "/* \r\n" + - "Class Foo\r\n" + - "*/ \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " /* Initialize. */\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " /* Initialize j.\r\n" + - " set to zero */\r\n" + - " j = 0; /* Set to zero */\r\n" + - " /* test */\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "# \r\n" + - "# Class Foo\r\n" + - "# \r\n" + - "class Foo\r\n" + - " # Initialize.\r\n"+ - " def initialize()\r\n" + - " # Initialize j.\r\n" + - " # set to zero\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0 then\r\n" + - " j = 2\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs deleted file mode 100644 index 2fc58ab4c9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/MultipleFieldsOnSameLineTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class MultipleFieldsOnSameLineTests - { - string csharpClassWithFieldsThatHaveInitialValues = - "class Foo\r\n" + - "{\r\n" + - " int i = 0, j = 1;\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithFieldsThatHaveInitialValues() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string ruby = converter.Convert(csharpClassWithFieldsThatHaveInitialValues); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " @j = 1\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - - string csharpClassWithTwoFieldsWhereFirstDoesNotHaveInitialValue = - "class Foo\r\n" + - "{\r\n" + - " int i, j = 1;\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithFieldsWhereFirstFieldDoesNotHaveInitialValue() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string ruby = converter.Convert(csharpClassWithTwoFieldsWhereFirstDoesNotHaveInitialValue); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @j = 1\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - - string csharpClassWithTwoFieldsInitializedInMethod = - "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " int j, k;\r\n" + - "\r\n" + - " public void Test()\r\n" + - " {\r\n" + - " j = 1;\r\n" + - " k = 3;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertCSharpClassWithTwoFieldsInitializedInMethod() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string ruby = converter.Convert(csharpClassWithTwoFieldsInitializedInMethod); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Test()\r\n" + - " @j = 1\r\n" + - " @k = 3\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - - string vnetClassWithTwoArrayFieldsOnSameLine = - "class Foo\r\n" + - " Private i(10), j(20) as integer\r\n" + - "end class"; - - [Test] - public void ConvertVBNetClassWithTwoArrayFieldsOnSameLine() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string ruby = converter.Convert(vnetClassWithTwoArrayFieldsOnSameLine); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = Array.CreateInstance(System::Int32, 10)\r\n" + - " @j = Array.CreateInstance(System::Int32, 20)\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedClassConversionTestFixture.cs deleted file mode 100644 index b9bb323ce8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedClassConversionTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that the indentation after the nested class is correct for any outer class methods. - /// - [TestFixture] - public class NestedClassConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " class Bar\r\n" + - " {\r\n" + - " public void Test()\r\n" + - " {\r\n" + - " }\r\n" + - " }\r\n" + - "\r\n" + - " public void AnotherRun()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def Run()\r\n" + - " end\r\n" + - "\r\n" + - " class Bar\r\n" + - " def Test()\r\n" + - " end\r\n" + - " end\r\n" + - "\r\n" + - " def AnotherRun()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby, ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs deleted file mode 100644 index c1ddbfb7b6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NestedIfStatementConversionTestFixture.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the conversion of an if-else statement where the - /// if and else blocks each have nested if-else statements. - /// - [TestFixture] - public class NestedIfStatementConversionTestFixture - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " int i = 0;\r\n" + - " public int GetCount()\r\n" + - " {" + - " if (i == 0) {\r\n" + - " if (i == 0) {\r\n" + - " i = 10;\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " i = 4;\r\n" + - " return 4;\r\n" + - " }\r\n" + - " } else {\r\n" + - " if (i == 0) {\r\n" + - " i = 10;\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " i = 4;\r\n" + - " return 4;\r\n" + - " }\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def GetCount()\r\n" + - " if @i == 0 then\r\n" + - " if @i == 0 then\r\n" + - " @i = 10\r\n" + - " return 10\r\n" + - " else\r\n" + - " @i = 4\r\n" + - " return 4\r\n" + - " end\r\n" + - " else\r\n" + - " if @i == 0 then\r\n" + - " @i = 10\r\n" + - " return 10\r\n" + - " else\r\n" + - " @i = 4\r\n" + - " return 4\r\n" + - " end\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullConversionTestFixture.cs deleted file mode 100644 index 92678dde55..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullConversionTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that null is converted to None in Ruby. - /// - [TestFixture] - public class NullConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public int Run(string a)\r\n" + - " {\r\n" + - " if (a == null) {\r\n" + - " return 4;\r\n" + - " }\r\n" + - " return 2;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def Run(a)\r\n" + - " if a == nil then\r\n" + - " return 4\r\n" + - " end\r\n" + - " return 2\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullParseInfoCompilationUnitWhenConvertingEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullParseInfoCompilationUnitWhenConvertingEventHandlerTestFixture.cs deleted file mode 100644 index 9c92bf49d0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/NullParseInfoCompilationUnitWhenConvertingEventHandlerTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class NullParseInfoCompilationUnitWhenConvertingEventHandlerTestFixture - { - ParseInformation parseInfo; - - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click += ButtonClick;\r\n" + - " button.MouseDown += self.OnMouseDown;\r\n" + - " }\r\n" + - "}"; - - [SetUp] - public void Init() - { - parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - } - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click { self.ButtonClick() }\r\n" + - " button.MouseDown { self.OnMouseDown() }\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp, parseInfo); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectCreationTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectCreationTestFixture.cs deleted file mode 100644 index 08cf00cdfb..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectCreationTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that C# code that creates a new XmlDocument object - /// is converted to Ruby correctly. - /// - [TestFixture] - public class ObjectCreationTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " XmlDocument doc = new XmlDocument();\r\n" + - " doc.LoadXml(\"\");\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " doc = XmlDocument.new()\r\n" + - " doc.LoadXml(\"\")\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs deleted file mode 100644 index 42f3dfe5ea..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectInitializerConversionTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Object initializers should be converted to calling the appropriate property setters, but - /// this means a single line statement would need to be replaced with multiple statements. - /// - [TestFixture] - public class ObjectInitializerConversionTestFixture - { - string csharp = "class Class1\r\n" + - "{\r\n" + - " string name = String.Empty;\r\n" + - " string lastName = String.Empty;\r\n" + - "\r\n" + - " public string Name {\r\n" + - " get { return name; }\r\n" + - " set { name = value; }\r\n" + - " }\r\n" + - "\r\n" + - " public string LastName {\r\n" + - " get { return lastName; }\r\n" + - " set { lastName = value; }\r\n" + - " }\r\n" + - "\r\n" + - " public Class1 Clone()\r\n" + - " {\r\n" + - " return new Class1 { Name = \"First\", LastName = \"Last\" };\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Class1\r\n" + - " def initialize()\r\n" + - " @name = String.Empty\r\n" + - " @lastName = String.Empty\r\n" + - " end\r\n" + - "\r\n" + - " def Name\r\n" + - " return @name\r\n" + - " end\r\n" + - "\r\n" + - " def Name=(value)\r\n" + - " @name = value\r\n" + - " end\r\n" + - "\r\n" + - " def LastName\r\n" + - " return @lastName\r\n" + - " end\r\n" + - "\r\n" + - " def LastName=(value)\r\n" + - " @lastName = value\r\n" + - " end\r\n" + - "\r\n" + - " def Clone()\r\n" + - " return Class1.new(Name = \"First\", LastName = \"Last\")\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs deleted file mode 100644 index 582e39436d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ObjectReferenceEqualsConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class ObjectReferenceEqualsConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public bool IsEqual(object o)\r\n" + - " {\r\n" + - " return object.ReferenceEquals(o, null);\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def IsEqual(o)\r\n" + - " return System::Object.ReferenceEquals(o, nil)\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyConversionTestFixture.cs deleted file mode 100644 index 3a59e492c1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyConversionTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a C# property to - /// two get and set methods in Ruby. - /// - [TestFixture] - public class PropertyConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " public int Count\r\n" + - " {\r\n" + - " get { return count; }\r\n" + - " set { count = value; }\r\n" + - " }\r\n" + - "\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @count = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Count\r\n" + - " return @count\r\n" + - " end\r\n" + - "\r\n" + - " def Count=(value)\r\n" + - " @count = value\r\n" + - " end\r\n" + - "\r\n" + - " def Run()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs deleted file mode 100644 index 1ce2c8ce0a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyReferenceConversionTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class PropertyReferenceConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " public int Count {\r\n" + - " get {\r\n" + - " return count;\r\n" + - " }\r\n" + - " }\r\n" + - "\r\n" + - " public void Increment()\r\n" + - " {\r\n" + - " Count++;\r\n" + - " }\r\n" + - "\r\n" + - " public void SetCount(int Count)\r\n" + - " {\r\n" + - " this.Count = Count;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @count = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Count\r\n" + - " return @count\r\n" + - " end\r\n" + - "\r\n" + - " def Increment()\r\n" + - " self.Count += 1\r\n" + - " end\r\n" + - "\r\n" + - " def SetCount(Count)\r\n" + - " self.Count = Count\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetSetStatementsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetSetStatementsTestFixture.cs deleted file mode 100644 index efb18c2c8c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetSetStatementsTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests the CSharpToRubyConverter class can convert a C# property to - /// two get and set methods in Ruby. - /// - [TestFixture] - public class PropertyWithGetSetStatementsTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " int i = 0;\r\n" + - " public int Count\r\n" + - " {\r\n" + - " get {\r\n" + - " if (i == 0) {\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " return count;\r\n" + - " }\r\n" + - " }\r\n" + - " set {\r\n" + - " if (i == 1) {\r\n" + - " count = value;\r\n" + - " } else {\r\n" + - " count = value + 5;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @count = 0\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Count\r\n" + - " if @i == 0 then\r\n" + - " return 10\r\n" + - " else\r\n" + - " return @count\r\n" + - " end\r\n" + - " end\r\n" + - "\r\n" + - " def Count=(value)\r\n" + - " if @i == 1 then\r\n" + - " @count = value\r\n" + - " else\r\n" + - " @count = value + 5\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetterTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetterTestFixture.cs deleted file mode 100644 index e5b79c9eb5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithGetterTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class PropertyWithGetterTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " int i = 0;\r\n" + - " public int Count {\r\n" + - " get {\r\n" + - " if (i == 0) {\r\n" + - " return 10;\r\n" + - " } else {\r\n" + - " return count;\r\n" + - " }\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @count = 0\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Count\r\n" + - " if @i == 0 then\r\n" + - " return 10\r\n" + - " else\r\n" + - " return @count\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithSetterTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithSetterTestFixture.cs deleted file mode 100644 index b999556c25..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/PropertyWithSetterTestFixture.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class PropertyWithSetterTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " int count = 0;\r\n" + - " int i = 0;\r\n" + - " public int Count {\r\n" + - " set {\r\n" + - " count = value;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " @count = 0\r\n" + - " @i = 0\r\n" + - " end\r\n" + - "\r\n" + - " def Count=(value)\r\n" + - " @count = value\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs deleted file mode 100644 index 15c6a7cb88..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/RemoveHandlerConversionTestFixture.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that removing a method from an event handler is converted - /// from C# to Ruby correctly. - /// - [TestFixture] - public class RemoveHandlerConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {" + - " button = new Button();\r\n" + - " button.Click -= ButtonClick;\r\n" + - " }\r\n" + - "\r\n" + - " void ButtonClick(object sender, EventArgs e)\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = - "class Foo\r\n" + - " def initialize()\r\n" + - " button = Button.new()\r\n" + - " button.Click.remove(OnButtonClick)\r\n" + - " end\r\n" + - "\r\n" + - " def ButtonClick(sender, e)\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs deleted file mode 100644 index 1a23d4ec97..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleClassMethodConversionTestFixture.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests a single class method is converted. - /// - [TestFixture] - public class SingleClassMethodConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Init()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - [Test] - public void GeneratedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def Init()\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs deleted file mode 100644 index 420a5242c4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SingleLineCommentConversionTestFixture.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class SingleLineCommentConversionTestFixture - { - string csharp = "// \r\n" + - "// Class Foo\r\n" + - "// \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " // Initialize.\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " // Initialize j.\r\n" + - " j = 0; // Set to zero\r\n" + - " // test\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "# \r\n" + - "# Class Foo\r\n" + - "# \r\n" + - "class Foo\r\n" + - " # Initialize.\r\n"+ - " def initialize()\r\n" + - " # Initialize j.\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0 then\r\n" + - " j = 2\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticClassReferenceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticClassReferenceTestFixture.cs deleted file mode 100644 index e0caa9978a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticClassReferenceTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that C# code such as "System.Console.WriteLine("Test");" - /// is converted to Ruby code correctly. - /// - [TestFixture] - public class StaticClassReferenceTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " System.Console.WriteLine(\"Test\");\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def initialize()\r\n" + - " System.Console.WriteLine(\"Test\")\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticMethodConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticMethodConversionTestFixture.cs deleted file mode 100644 index b00c6b4f85..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/StaticMethodConversionTestFixture.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class StaticMethodConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " static void Main(string[] args)\r\n" + - " {\r\n" + - " Stop();\r\n" + - " }\r\n" + - "\r\n" + - " static void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "}"; - - string Ruby; - NRefactoryToRubyConverter converter; - - [SetUp] - public void Init() - { - converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - Ruby = converter.Convert(csharp); - } - - [Test] - public void ConvertedRubyCode() - { - string expectedRuby = - "class Foo\r\n" + - " def Foo.Main(args)\r\n" + - " Foo.Stop()\r\n" + - " end\r\n" + - "\r\n" + - " def Foo.Stop()\r\n" + - " end\r\n" + - "\r\n" + - " def Run()\r\n" + - " end\r\n" + - "end"; - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - - [Test] - public void EntryPointMethodFound() - { - Assert.AreEqual(1, converter.EntryPointMethods.Count); - } - - [Test] - public void MainEntryPointMethodNameIsMain() - { - Assert.AreEqual("Main", converter.EntryPointMethods[0].Name); - } - - [Test] - public void GenerateCodeToCallMainMethod() - { - Assert.AreEqual("Foo.Main(nil)", converter.GenerateMainMethodCall(converter.EntryPointMethods[0])); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SwitchStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SwitchStatementConversionTestFixture.cs deleted file mode 100644 index 21bad37fa5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/SwitchStatementConversionTestFixture.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class SwitchStatementConversionTestFixture - { - [Test] - public void SwitchStatement() - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public int Run(int i)\r\n" + - " {\r\n" + - " switch (i) {\r\n" + - " case 7:\r\n" + - " i = 4;\r\n" + - " break;\r\n" + - " case 10:\r\n" + - " return 0;\r\n" + - " case 9:\r\n" + - " return 2;\r\n" + - " case 8:\r\n" + - " break;\r\n" + - " default:\r\n" + - " return -1;\r\n" + - " }\r\n" + - " return i;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = - "class Foo\r\n" + - " def Run(i)\r\n" + - " case i\r\n" + - " when 7\r\n" + - " i = 4\r\n" + - " when 10\r\n" + - " return 0\r\n" + - " when 9\r\n" + - " return 2\r\n" + - " when 8\r\n" + - " else\r\n" + - " return -1\r\n" + - " end\r\n" + - " return i\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code, code); - } - - [Test] - public void CaseFallThrough() - { - string csharp = - "class Foo\r\n" + - "{\r\n" + - " public int Run(int i)\r\n" + - " {\r\n" + - " switch (i) {\r\n" + - " case 10:\r\n" + - " case 11:\r\n" + - " return 0;\r\n" + - " case 9:\r\n" + - " return 2;\r\n" + - " default:\r\n" + - " return -1;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = - "class Foo\r\n" + - " def Run(i)\r\n" + - " case i\r\n" + - " when 10, 11\r\n" + - " return 0\r\n" + - " when 9\r\n" + - " return 2\r\n" + - " else\r\n" + - " return -1\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs deleted file mode 100644 index 9b26bab07a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TernaryOperatorConversionTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class TernaryOperatorConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public string TestMe(bool test)\r\n" + - " {\r\n" + - " string a = test ? \"Ape\" : \"Monkey\";\r\n" + - " return a;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = "class Foo\r\n" + - " def TestMe(test)\r\n" + - " a = test ? \"Ape\" : \"Monkey\"\r\n" + - " return a\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs deleted file mode 100644 index 92f12c71e7..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/ThrowExceptionConversionTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that a throw statement is converted to a - /// raise keyword in Ruby when converting - /// from C#. - /// - [TestFixture] - public class ThrowExceptionConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public string Run()\r\n" + - " {" + - " throw new XmlException();\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - string expectedCode = "class Foo\r\n" + - " def Run()\r\n" + - " raise XmlException.new()\r\n" + - " end\r\n" + - "end"; - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedCode, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs deleted file mode 100644 index fa0994a9b7..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TryCatchFinallyConversionTestFixture.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Converts a C# try-catch-finally to Ruby. - /// - [TestFixture] - public class TryCatchFinallyConversionTestFixture - { - string csharp = "class Loader\r\n" + - "{\r\n" + - " public void load(string xml)\r\n" + - " {\r\n" + - " try {\r\n" + - " XmlDocument doc = new XmlDocument();\r\n" + - " doc.LoadXml(xml);\r\n" + - " } catch (XmlException ex) {\r\n" + - " Console.WriteLine(ex.ToString());\r\n" + - " } finally {\r\n" + - " Console.WriteLine(xml);\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedCode() - { - string expectedRuby = - "class Loader\r\n" + - " def load(xml)\r\n" + - " begin\r\n" + - " doc = XmlDocument.new()\r\n" + - " doc.LoadXml(xml)\r\n" + - " rescue XmlException => ex\r\n" + - " Console.WriteLine(ex.ToString())\r\n" + - " ensure\r\n" + - " Console.WriteLine(xml)\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TypeofConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TypeofConversionTestFixture.cs deleted file mode 100644 index a594e773ed..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/TypeofConversionTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class TypeofConversionTestFixture - { - string typeofIntCode = "class Foo\r\n" + - "{\r\n" + - " public string ToString()\r\n" + - " {\r\n" + - " typeof(int).FullName;\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedTypeOfIntegerCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(typeofIntCode); - string expectedRuby = - "require \"mscorlib\"\r\n" + - "\r\n" + - "class Foo\r\n" + - " def ToString()\r\n" + - " System::Int32.to_clr_type.FullName\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UnaryOperatorConversionTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UnaryOperatorConversionTests.cs deleted file mode 100644 index 5d0f9075ae..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UnaryOperatorConversionTests.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class UnaryOperatorConversionTests - { - [Test] - public void MinusOne() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = -1;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - "\tdef Run(i)\r\n" + - "\t\ti = -1\r\n" + - "\tend\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void PlusOne() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(int i)\r\n" + - " {\r\n" + - " i = +1;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - "\tdef Run(i)\r\n" + - "\t\ti = +1\r\n" + - "\tend\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void NotOperator() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(bool i)\r\n" + - " {\r\n" + - " j = !i;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - "\tdef Run(i)\r\n" + - "\t\tj = not i\r\n" + - "\tend\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - - [Test] - public void BitwiseNotOperator() - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void Run(bool i)\r\n" + - " {\r\n" + - " j = ~i;\r\n" + - " }\r\n" + - "}"; - - string expectedRuby = "class Foo\r\n" + - "\tdef Run(i)\r\n" + - "\t\tj = ~i\r\n" + - "\tend\r\n" + - "end"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string code = converter.Convert(csharp); - - Assert.AreEqual(expectedRuby, code); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UsingStatementConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UsingStatementConversionTestFixture.cs deleted file mode 100644 index 43f8c89a12..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/UsingStatementConversionTestFixture.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class UsingStatementConversionTestFixture - { - string csharp = "using System\r\n" + - "class Foo\r\n" + - "{\r\n" + - "}"; - - [Test] - public void GeneratedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string Ruby = converter.Convert(csharp); - string expectedRuby = "require \"mscorlib\"\r\n" + - "require \"System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" + - "\r\n" + - "class Foo\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - - [Test] - public void MultipleUsingStatements() - { - string csharp = "using System\r\n" + - "using System.Drawing\r\n" + - "class Foo\r\n" + - "{\r\n" + - "}"; - - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - string Ruby = converter.Convert(csharp); - string expectedRuby = "require \"mscorlib\"\r\n" + - "require \"System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" + - "require \"System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\"\r\n" + - "\r\n" + - "class Foo\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBClassConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBClassConversionTestFixture.cs deleted file mode 100644 index aa9cedcdef..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBClassConversionTestFixture.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - /// - /// Tests that a VB.NET class is converted to Ruby successfully. - /// - [TestFixture] - public class VBClassConversionTestFixture - { - string vb = "Namespace DefaultNamespace\r\n" + - " Public Class Class1\r\n" + - " End Class\r\n" + - "End Namespace"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string Ruby = converter.Convert(vb); - string expectedRuby = - "module DefaultNamespace\r\n" + - " class Class1\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBExitConversionTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBExitConversionTests.cs deleted file mode 100644 index 81bb04ca7f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBExitConversionTests.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class VBExitConversionTests - { - string vb = - "Public Class Class1\r\n" + - " Public Sub Test\r\n" + - " While True\r\n" + - " Exit While\r\n" + - " End While\r\n" + - " End Sub\r\n" + - "End Class\r\n"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string ruby = converter.Convert(vb); - string expectedRuby = - "class Class1\r\n" + - " def Test()\r\n" + - " while true\r\n" + - " break\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBStringConcatTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBStringConcatTestFixture.cs deleted file mode 100644 index 27e3d78658..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/VBStringConcatTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class VBStringConcatTestFixture - { - string vb = "Namespace DefaultNamespace\r\n" + - " Public Class Class1\r\n" + - " Public Sub Test\r\n" + - " Dim a as String\r\n" + - " a = \"test\" & \" this\"\r\n" + - " End Sub\r\n" + - " End Class\r\n" + - "End Namespace"; - - [Test] - public void GeneratedRubySourceCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.VBNet); - converter.IndentString = " "; - string Ruby = converter.Convert(vb); - string expectedRuby = - "module DefaultNamespace\r\n" + - " class Class1\r\n" + - " def Test()\r\n" + - " a = \"test\" + \" this\"\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/WhileLoopConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/WhileLoopConversionTestFixture.cs deleted file mode 100644 index ea7fdc63e1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/WhileLoopConversionTestFixture.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class WhileLoopConversionTestFixture - { - string csharp = "class Foo\r\n" + - "{\r\n" + - " public void CountDown()\r\n" + - " {\r\n" + - " int i = 10;\r\n" + - " while (i > 0) {\r\n" + - " i--;\r\n" + - " }\r\n" + - " }\r\n" + - "}"; - - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "class Foo\r\n" + - " def CountDown()\r\n" + - " i = 10\r\n" + - " while i > 0\r\n" + - " i -= 1\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs deleted file mode 100644 index dfc99c2632..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Converter/XmlDocCommentConversionTestFixture.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.NRefactory; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Converter -{ - [TestFixture] - public class XmlDocCommentConversionTestFixture - { - string csharp = "/// \r\n" + - "/// Class Foo\r\n" + - "/// \r\n" + - "public class Foo\r\n" + - "{\r\n" + - " /// \r\n" + - " /// Run\r\n" + - " /// \r\n" + - " public void Run()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " /// Stop \r\n" + - " public void Stop()\r\n" + - " {\r\n" + - " }\r\n" + - "\r\n" + - " /// Initialize.\r\n" + - " public Foo()\r\n" + - " {\r\n" + - " /// Initialize j.\r\n" + - " int j = 0; /// Set to zero\r\n" + - " /// test\r\n" + - " if (j == 0) j = 2;\r\n" + - " }\r\n" + - "}"; - [Test] - public void ConvertedRubyCode() - { - NRefactoryToRubyConverter converter = new NRefactoryToRubyConverter(SupportedLanguage.CSharp); - converter.IndentString = " "; - string Ruby = converter.Convert(csharp); - string expectedRuby = - "# \r\n" + - "# Class Foo\r\n" + - "# \r\n" + - "class Foo\r\n" + - " # \r\n" + - " # Run\r\n" + - " # \r\n" + - " def Run()\r\n" + - " end\r\n" + - "\r\n" + - " # Stop \r\n" + - " def Stop()\r\n" + - " end\r\n" + - "\r\n" + - " # Initialize.\r\n" + - " def initialize()\r\n" + - " # Initialize j.\r\n" + - " j = 0 # Set to zero\r\n" + - " # test\r\n" + - " if j == 0 then\r\n" + - " j = 2\r\n" + - " end\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedRuby, Ruby, Ruby); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/App.ico b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/App.ico deleted file mode 100644 index 3a5525fd79..0000000000 Binary files a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/App.ico and /dev/null differ diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs deleted file mode 100644 index 003854f702..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CallBeginInitOnLoadTestFixture.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the control's BeginInit and EndInit methods are called. - /// - [TestFixture] - public class CallBeginInitOnLoadTestFixture : CallBeginInitOnLoadTestsBase - { - public override string Code { - get { - ComponentCreator.AddType("ICSharpCode.Scripting.Tests.Utils.SupportInitCustomControl", typeof(SupportInitCustomControl)); - - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @control = ICSharpCode::Scripting::Tests::Utils::SupportInitCustomControl.new()\r\n" + - " @control.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n" + - " localVariable = ICSharpCode::Scripting::Tests::Utils::SupportInitCustomControl.new()\r\n" + - " localVariable.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AccessibleRole = System::Windows::Forms::AccessibleRole.None\r\n" + - " self.Controls.Add(@control)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " @control.EndInit()\r\n" + - " localVariable.EndInit()\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return RubyComponentWalkerHelper.CreateComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs deleted file mode 100644 index 760a3b145d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ConvertCustomClassUsingTypeConverterTestFixture.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Converts a custom class that has a custom TypeConverter defined. - /// This type converter implements an InstanceDescriptor which is used to generate the - /// code to create an instance of the class. - /// - [TestFixture] - public class ConvertCustomClassUsingTypeConverterTestFixture - { - [Test] - public void ConvertCustomClass() - { - CustomClass customClass = new CustomClass("Test", "Category"); - string text = RubyPropertyValueAssignment.ToString(customClass); - string expectedText = "ICSharpCode::Scripting::Tests::Utils::CustomClass.new(\"Test\", \"Category\")"; - Assert.AreEqual(expectedText, text); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CursorTypeResolutionTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CursorTypeResolutionTestFixture.cs deleted file mode 100644 index cc78ef216f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/CursorTypeResolutionTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the string "System.Windows.Forms.Cursors.AppStarting" can be resolved by the - /// RubyCodeDeserializer. - /// - [TestFixture] - public class CursorTypeResolutionTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetRubyCode() - { - return "self.Cursors = System::Windows::Forms::Cursors.AppStarting"; - } - - [Test] - public void DeserializedObjectIsCursorsAppStarting() - { - Assert.AreEqual(Cursors.AppStarting, deserializedObject); - } - - [Test] - public void CursorsTypeResolved() - { - Assert.AreEqual("System.Windows.Forms.Cursors", base.componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs deleted file mode 100644 index 675c1da62e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeAssignmentTestFixtureBase.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Base class for all tests of the RubyCodeDeserialize when deserializing an - /// assignment. - /// - public abstract class DeserializeAssignmentTestFixtureBase - { - protected Expression rhsAssignmentExpression; - protected object deserializedObject; - protected MockDesignerLoaderHost mockDesignerLoaderHost; - protected MockTypeResolutionService typeResolutionService; - protected MockComponentCreator componentCreator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(GetRubyCode()); - rhsAssignmentExpression = assignment.Right; - - mockDesignerLoaderHost = new MockDesignerLoaderHost(); - typeResolutionService = mockDesignerLoaderHost.TypeResolutionService; - RubyCodeDeserializer deserializer = new RubyCodeDeserializer(componentCreator); - deserializedObject = deserializer.Deserialize(rhsAssignmentExpression); - } - - public abstract string GetRubyCode(); - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs deleted file mode 100644 index 92a8a11815..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeColorFromArgbTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the string "System::Drawing::Color.FromArgb(0, 192, 10)" can be converted to an object by the - /// RubyCodeDeserializer. - /// - [TestFixture] - public class DeserializeColorFromArgbTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetRubyCode() - { - return "self.BackColor = System::Drawing::Color.FromArgb(0, 192, 10)"; - } - - [Test] - public void DeserializedObjectIsExpectedCustomColor() - { - Color customColor = Color.FromArgb(0, 192, 10); - Assert.AreEqual(customColor, deserializedObject); - } - - [Test] - public void ColorTypeResolved() - { - Assert.AreEqual("System.Drawing.Color", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs deleted file mode 100644 index 4638672afa..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeComponentAssignmentTestFixture.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the string "@menuItem1" is converted to the matching component. - /// - [TestFixture] - public class DeserializeComponentAssignmentTestFixture : DeserializeAssignmentTestFixtureBase - { - Button button; - - public override string GetRubyCode() - { - button = (Button)base.componentCreator.CreateInstance(typeof(Button), new object[0], "button1", false); - return "self.AcceptButton = @button1"; - } - - [Test] - public void DeserializedObjectIsButton() - { - Assert.AreSame(button, deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeConstructorStringArrayTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeConstructorStringArrayTestFixture.cs deleted file mode 100644 index 9b5e50e228..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeConstructorStringArrayTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the constructor arguments are returned when the first argument is - /// an array. - /// - [TestFixture] - public class DeserializeConstructorStringArrayTestFixture - { - string code = "System::Windows::Forms::ListViewItem(System::Array[System::String].new(\r\n" + - " [\"a\",\r\n" + - " \"sa\",\r\n" + - " \"sa2\"]))\r\n"; - - List args; - - [TestFixtureSetUp] - public void SetUpFixture() - { - MockComponentCreator componentCreator = new MockComponentCreator(); - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - RubyCodeDeserializer deserializer = new RubyCodeDeserializer(componentCreator); - args = deserializer.GetArguments(callExpression); - } - - [Test] - public void OneArgument() - { - Assert.AreEqual(1, args.Count); - } - - [Test] - public void ArgumentIsStringArray() - { - string[] array = new string[0]; - Assert.IsInstanceOf(array.GetType(), args[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs deleted file mode 100644 index 025e42c878..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeDateTimeArrayTestFixture.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeDateTimeArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetRubyCode() - { - return "self.Items = System::Array[System::DateTime].new(\r\n" + - " [System::DateTime.new(2010, 2, 3, 0, 0, 0, 0),\r\n" + - " System::DateTime.new(0)])"; - } - - [Test] - public void DeserializedObjectIsExpectedArray() - { - DateTime[] expectedArray = new DateTime[] {new DateTime(2010, 2, 3), new DateTime(0)}; - Assert.AreEqual(expectedArray, deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs deleted file mode 100644 index 95b554157d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeLocalVariableTestFixture.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that a local variable can be deserialized. Local variables are used when adding - /// ListViewItems to a ListView. - /// - [TestFixture] - public class DeserializeLocalVariableTestFixture - { - string RubyCode = "self.Items.AddRange(System::Array[System::Windows::Forms::ListViewItem].new([listViewItem1]))"; - - MockDesignerLoaderHost mockDesignerLoaderHost; - MockTypeResolutionService typeResolutionService; - MockComponentCreator componentCreator; - ListViewItem listViewItem1; - object deserializedObject; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - listViewItem1 = (ListViewItem)componentCreator.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem1", false); - - MethodCall callExpression = RubyParserHelper.GetMethodCall(RubyCode); - - mockDesignerLoaderHost = new MockDesignerLoaderHost(); - typeResolutionService = mockDesignerLoaderHost.TypeResolutionService; - RubyCodeDeserializer deserializer = new RubyCodeDeserializer(componentCreator); - deserializedObject = deserializer.Deserialize(callExpression.Arguments.Expressions[0]); - } - - [Test] - public void ListViewItemDeserialized() - { - ListViewItem[] array = (ListViewItem[])deserializedObject; - Assert.AreSame(listViewItem1, array[0]); - } - - [Test] - public void ListViewItemIsNotNull() - { - Assert.IsNotNull(deserializedObject); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs deleted file mode 100644 index 95d5cdb6b1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeMethodParametersTestFixture.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeMethodParametersTestFixture - { - RubyCodeDeserializer deserializer; - MockComponentCreator componentCreator; - - [SetUp] - public void Init() - { - componentCreator = new MockComponentCreator(); - MockDesignerLoaderHost mockDesignerLoaderHost = new MockDesignerLoaderHost(); - deserializer = new RubyCodeDeserializer(componentCreator); - } - - [Test] - public void NegativeIntegerParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(-1); - - string code = "TestClass(-1)"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void NegativeDoubleParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(-1.0); - - string code = "TestClass(-1.0)"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void EnumParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(AnchorStyles.Top); - - string code = "TestClass(System::Windows::Forms::AnchorStyles.Top)"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void BooleanParameter() - { - List expectedArgs = new List(); - expectedArgs.Add(true); - - string code = "TestClass(true)"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void LocalVariableInstance() - { - string s = "abc"; - CreatedInstance instance = new CreatedInstance(typeof(string), new object[0], "localVariable", false); - instance.Object = s; - componentCreator.CreatedInstances.Add(instance); - List expectedArgs = new List(); - expectedArgs.Add(s); - - string code = "TestClass(localVariable)"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void MethodHasNoArguments() - { - string code = "TestClass()"; - MethodCall callExpression = RubyParserHelper.GetMethodCall(code); - List args = deserializer.GetArguments(callExpression); - - List expectedArgs = new List(); - Assert.AreEqual(expectedArgs, args); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeStringArrayTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeStringArrayTestFixture.cs deleted file mode 100644 index b08d58ae4e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeStringArrayTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the string "System.Array" can be converted to an array. - /// - [TestFixture] - public class DeserializeStringArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - public override string GetRubyCode() - { - return "self.Items = System::Array[System::String].new(\r\n" + - " [\"a\",\r\n" + - " \"b\"])"; - } - - [Test] - public void DeserializedObjectIsExpectedArray() - { - string[] expectedArray = new string[] {"a", "b"}; - Assert.AreEqual(expectedArray, deserializedObject); - } - - [Test] - public void StringTypeResolved() - { - Assert.AreEqual("System.String", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs deleted file mode 100644 index af572f74c3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/DeserializeToolStripItemArrayTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class DeserializeToolStripItemArrayTestFixture : DeserializeAssignmentTestFixtureBase - { - ToolStripMenuItem fileMenuItem; - ToolStripMenuItem editMenuItem; - - public override string GetRubyCode() - { - fileMenuItem = (ToolStripMenuItem)componentCreator.CreateComponent(typeof(ToolStripMenuItem), "fileToolStripMenuItem"); - editMenuItem = (ToolStripMenuItem)componentCreator.CreateComponent(typeof(ToolStripMenuItem), "editToolStripMenuItem"); - - componentCreator.Add(fileMenuItem, "fileToolStripMenuItem"); - componentCreator.Add(editMenuItem, "editToolStripMenuItem"); - - return "self.Items = System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@fileToolStripMenuItem,\r\n" + - " @editToolStripMenuItem])"; - } - - [Test] - public void DeserializedObjectIsExpectedCustomColor() - { - ToolStripItem[] expectedArray = new ToolStripItem[] {fileMenuItem, editMenuItem}; - Assert.AreEqual(expectedArray, deserializedObject); - } - - [Test] - public void StringTypeResolved() - { - Assert.AreEqual("System.Windows.Forms.ToolStripItem", componentCreator.LastTypeNameResolved); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs deleted file mode 100644 index 425c80526b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EnabledSetUsingPropertyDescriptorTestFixture.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// The RubyComponentWalker class should be getting the value from the PropertyDescriptor and not - /// the PropertyInfo information returned from the form object. If this is not done then when the - /// user sets Enabled to false in the designer the value is not generated in the InitializeComponent method. - /// - [TestFixture] - public class EnabledSetUsingPropertyDescriptorTestFixture : GenerateEnabledUsingPropertyDescriptorTestsBase - { - [Test] - public void GeneratedCode() - { - string expectedCode = - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - "self.Enabled = false\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedCode); - } - - protected override IScriptingCodeDomSerializer CreateSerializer() - { - return RubyCodeDomSerializerHelper.CreateSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs deleted file mode 100644 index 76ef2b92b5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerAlreadyExistsTestFixture.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyDesignerGenerator does not insert an event handler if a method already exists with the same - /// name. - /// - [TestFixture] - public class EventHandlerAlreadyExistsTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - } - - [Test] - public void CodeAfterInsertComponentEventMethodCalledIsNotChanged() - { - string expectedCode = GetTextEditorCode(); - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - [Test] - public void InsertComponentEventMethodReturnsTrue() - { - Assert.IsTrue(insertedEventHandler); - } - - [Test] - public void FileIsForm() - { - Assert.AreEqual(fileName, file); - } - - [Test] - public void PositionOfEventHandlerIsLine12() - { - Assert.AreEqual(12, position); - } - - protected override string GetTextEditorCode() - { - return "class MainForm < System::Windows::Forms::Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\t@button1.Click { |sender, e| self.mybuttonclick() }\r\n" + - "\t\tself.Controls.Add(@button1)\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef mybuttonclick(sender, e)\r\n" + - "\t\t\r\n" + - "\tend\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs deleted file mode 100644 index 766205f174..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/EventHandlerExistsWithIncorrectParameterCountTestFixture.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// An event handler should be inserted if a method exists in the form's class but has the incorrect - /// number of parameters. - /// - [TestFixture] - public class EventHandlerExistsWithIncorrectParameterCountTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "mybuttonclick", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\t@button1.Click { self.mybuttonclick() }\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef mybuttonclick()\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef mybuttonclick(sender, e)\r\n" + - "\t\t\r\n" + - "\tend\r\n" + - "end"; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent, viewContent.DesignerCodeFileContent); - } - - protected override string GetTextEditorCode() - { - return - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\t@button1.Click { self.mybuttonclick() }\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef mybuttonclick()\r\n" + - "\tend\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs deleted file mode 100644 index 7f043bf88b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FindInitializeComponentMethodTestFixture.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the GeneratedInitializeComponentMethod class locates - /// the InitializeComponents method in the source code. - /// - /// Note that the source code contains a non-designable class - /// before the Form. This tests that the first designable class - /// is correctly picked up. - /// - [TestFixture] - public class FindInitializeComponentMethodTestFixture - { - IMethod initializeComponentMethod; - ParseInformation parseInfo; - IMethod expectedInitializeComponentMethod; - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyParser parser = new RubyParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\Test\MainForm.rb", GetFormCode()); - - // Create parse info to return from ParseFile method. - parseInfo = new ParseInformation(compilationUnit); - - // Get the InitializeComponent method from the - // compilation unit. - expectedInitializeComponentMethod = GetInitializeComponentMethod(compilationUnit); - - // Find the InitializeComponent method using the designer generator. - initializeComponentMethod = RubyDesignerGenerator.GetInitializeComponents(compilationUnit); - } - - /// - /// Sanity check. Make sure we found the InitializeComponent method - /// from the compilation unit during the SetUpFixture method. - /// - [Test] - public void ExpectedInitializeComponentMethodFound() - { - Assert.IsNotNull(expectedInitializeComponentMethod); - } - - [Test] - public void InitializeComponentMethodFound() - { - Assert.AreSame(expectedInitializeComponentMethod, initializeComponentMethod); - } - - [Test] - public void GetInitializeComponentWhenNoClassesInCompilationUnit() - { - DefaultCompilationUnit unit = new DefaultCompilationUnit(new MockProjectContent()); - ParseInformation parseInfo = new ParseInformation(unit); - Assert.IsNull(RubyDesignerGenerator.GetInitializeComponents(unit)); - } - - /// - /// Tests that the RubyDesignerGenerator handles the InitializeComponent - /// method being "InitializeComponents" and not "InitializeComponent". - /// - [Test] - public void InitializeComponentsUsedInsteadOfInitializeComponent() - { - RubyParser parser = new RubyParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - string code = GetFormCode().Replace("InitializeComponent", "InitializeComponents"); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\Test\MainForm.rb", code); - ParseInformation parseInfo = new ParseInformation(compilationUnit); - IMethod expectedMethod = GetInitializeComponentMethod(compilationUnit); - - IMethod method = RubyDesignerGenerator.GetInitializeComponents(compilationUnit); - - Assert.IsNotNull(method); - Assert.AreSame(expectedMethod, method); - } - - string GetFormCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class IgnoreMe\r\n" + - "\tdef initialize()\r\n" + - "\tend\r\n"+ - "end\r\n" + - "\r\n" + - "class IgnoreMeSinceIHaveNoInitializeComponentMethod < Form\r\n" + - "\tdef initialize()\r\n" + - "\tend\r\n" + - "end\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponent()\r\n" + - "\tend\r\n" + - "end"; - } - - static IMethod GetInitializeComponentMethod(ICompilationUnit unit) - { - IClass c = unit.Classes[2]; - foreach (IMethod m in c.Methods) { - if (m.Name == "InitializeComponent" || m.Name == "InitializeComponents") { - return m; - } - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs deleted file mode 100644 index c93d6dbf1f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormBaseClassCreatedOnLoadTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class FormBaseClassCreatedOnLoadTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - ComponentCreator.AddType("FormBase.FormBase", typeof(Component)); - - return - "class TestForm < FormBase::FormBase\r\n" + - " def InitializeComponent()\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void BaseClassNamePassedAsGetTypeParam() - { - Assert.AreEqual("FormBase.FormBase", ComponentCreator.TypeNames[0]); - } - - [Test] - public void BaseClassTypePassedToCreateComponent() - { - Assert.AreEqual(typeof(Component).FullName, ComponentCreator.CreatedComponents[0].TypeName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormsDesignerDisplayBindingTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormsDesignerDisplayBindingTestFixture.cs deleted file mode 100644 index 543da42fb5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/FormsDesignerDisplayBindingTestFixture.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyFormsDesignerDisplayBinding. - /// - [TestFixture] - public class FormsDesignerDisplayBindingTestFixture - { - DerivedRubyFormsDesignerDisplayBinding displayBinding; - MockTextEditorViewContent viewContent; - bool canAttachToDesignableClass; - ParseInformation parseInfo; - - [SetUp] - public void SetUp() - { - displayBinding = new DerivedRubyFormsDesignerDisplayBinding(); - viewContent = new MockTextEditorViewContent(); - viewContent.PrimaryFileName = new FileName("test.rb"); - viewContent.TextEditor.Document.Text = "text content"; - parseInfo = new ParseInformation(new DefaultCompilationUnit(new DefaultProjectContent())); - displayBinding.ParseServiceParseInfoToReturn = parseInfo; - displayBinding.IsParseInfoDesignable = true; - canAttachToDesignableClass = displayBinding.CanAttachTo(viewContent); - } - - [Test] - public void ReattachWhenParserServiceIsReady() - { - Assert.IsTrue(displayBinding.ReattachWhenParserServiceIsReady); - } - - [Test] - public void CanAttachToNullViewContent() - { - Assert.IsFalse(displayBinding.CanAttachTo(null)); - } - - [Test] - public void CanAttachToDesignableClass() - { - Assert.IsTrue(canAttachToDesignableClass); - } - - [Test] - public void CannotAttachToNonTextEditorViewContent() - { - MockViewContent viewContent = new MockViewContent(); - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void ParseInfoPassedToFormsDesignerIsDesignableMethod() - { - Assert.AreEqual(parseInfo, displayBinding.ParseInfoTestedForDesignability); - } - - [Test] - public void ParseInfoIsNotDesignable() - { - displayBinding.IsParseInfoDesignable = false; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void NullViewContentFileName() - { - viewContent.PrimaryFileName = null; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void FileNamePassedToGetParseInfo() - { - Assert.AreEqual("test.rb", displayBinding.FileNamePassedToGetParseInfo); - } - - [Test] - public void TextContentPassedToGetParseInfo() - { - Assert.AreEqual("text content", displayBinding.TextContentPassedToGetParseInfo); - } - - [Test] - public void NonRubyFileNameCannotBeAttachedTo() - { - viewContent.PrimaryFileName = new FileName("test.cs"); - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void NullViewContentPrimaryFileName() - { - viewContent.PrimaryFileName = null; - Assert.IsFalse(displayBinding.CanAttachTo(viewContent)); - } - - [Test] - public void CreatesRubyFormsDesigner() - { - MockTextEditorViewContent view = new MockTextEditorViewContent(); - IViewContent[] views = displayBinding.CreateSecondaryViewContent(view, new MockTextEditorOptions()); - Assert.AreEqual(1, views.Length); - Assert.IsTrue(views[0] is FormsDesignerViewContent); - views[0].Dispose(); - } - - [Test] - public void FormDesignerNotCreatedIfAlreadyAttached() - { - MockTextEditorViewContent view = new MockTextEditorViewContent(); - IViewContent[] views = null; - using (FormsDesignerViewContent formsDesigner = new FormsDesignerViewContent(view, new MockOpenedFile("test.rb"))) { - view.SecondaryViewContents.Add(formsDesigner); - views = displayBinding.CreateSecondaryViewContent(view, new MockTextEditorOptions()); - } - Assert.AreEqual(0, views.Length); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs deleted file mode 100644 index bdfb5dc6e5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAcceptButtonFormTestFixture.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAcceptButtonFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - Button button = (Button)host.CreateComponent(typeof(Button), "button1"); - button.Location = new Point(0, 0); - button.Size = new Size(10, 10); - button.Text = "button1"; - button.UseCompatibleTextRendering = false; - form.Controls.Add(button); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor acceptButtonPropertyDescriptor = descriptors.Find("AcceptButton", false); - acceptButtonPropertyDescriptor.SetValue(form, button); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = "@button1 = System::Windows::Forms::Button.new()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# button1\r\n" + - "# \r\n" + - "@button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - "@button1.Name = \"button1\"\r\n" + - "@button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - "@button1.TabIndex = 0\r\n" + - "@button1.Text = \"button1\"\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AcceptButton = @button1\r\n" + - "self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - "self.Controls.Add(@button1)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs deleted file mode 100644 index f78fc6a984..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAccessibleRoleFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAccessibleRoleFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor accessibleRoleDescriptor = descriptors.Find("AccessibleRole", false); - accessibleRoleDescriptor.SetValue(form, AccessibleRole.None); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AccessibleRole = System::Windows::Forms::AccessibleRole.None\r\n" + - "self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs deleted file mode 100644 index 0351878c5a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScaleModeFormTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAutoScaleModeFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - PropertyDescriptor autoScaleModeDescriptor = descriptors.Find("AutoScaleMode", false); - autoScaleModeDescriptor.SetValue(form, AutoScaleMode.Font); - - PropertyDescriptor autoScaleDimensionsDescriptor = descriptors.Find("AutoScaleDimensions", false); - autoScaleDimensionsDescriptor.SetValue(form, new SizeF(6F, 13F)); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AutoScaleDimensions = System::Drawing::SizeF.new(6, 13)\r\n" + - " self.AutoScaleMode = System::Windows::Forms::AutoScaleMode.Font\r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs deleted file mode 100644 index 411fe836ab..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateAutoScrollFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateAutoScrollFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor autoScrollDescriptor = descriptors.Find("AutoScroll", false); - autoScrollDescriptor.SetValue(form, true); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = "self.SuspendLayout()\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.AutoScroll = true\r\n" + - "self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs deleted file mode 100644 index e8a5136184..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateBackgroundWorkerTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateBackgroundWorkerTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor propertyDescriptor = descriptors.Find("Name", false); - propertyDescriptor.SetValue(form, "MainForm"); - - BackgroundWorker worker = (BackgroundWorker)host.CreateComponent(typeof(BackgroundWorker), "backgroundWorker1"); - descriptors = TypeDescriptor.GetProperties(worker); - propertyDescriptor = descriptors.Find("WorkerReportsProgress", false); - propertyDescriptor.SetValue(worker, true); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @backgroundWorker1 = System::ComponentModel::BackgroundWorker.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # backgroundWorker1\r\n" + - " # \r\n" + - " @backgroundWorker1.WorkerReportsProgress = true\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs deleted file mode 100644 index 76201acb47..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateButtonFlatAppearanceTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateButtonFlatAppearanceTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - Button button = (Button)host.CreateComponent(typeof(Button), "button1"); - button.Location = new Point(0, 0); - button.Size = new Size(10, 10); - button.Text = "button1"; - button.UseCompatibleTextRendering = false; - - button.FlatAppearance.BorderSize = 2; - button.FlatAppearance.BorderColor = Color.Red; - button.FlatAppearance.MouseOverBackColor = Color.Yellow; - - form.Controls.Add(button); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.FlatAppearance.BorderColor = System::Drawing::Color.Red\r\n" + - " @button1.FlatAppearance.BorderSize = 2\r\n" + - " @button1.FlatAppearance.MouseOverBackColor = System::Drawing::Color.Yellow\r\n" + - " @button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@button1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs deleted file mode 100644 index 5a78473ce1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateComboBoxItemsTestFixture.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateComboBoxItemsFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add combo box. - ComboBox comboBox = (ComboBox)host.CreateComponent(typeof(ComboBox), "comboBox1"); - comboBox.TabIndex = 0; - comboBox.Location = new Point(0, 0); - comboBox.Size = new System.Drawing.Size(121, 21); - comboBox.Items.Add("aaa"); - comboBox.Items.Add("bbb"); - comboBox.Items.Add("ccc"); - - form.Controls.Add(comboBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @comboBox1 = System::Windows::Forms::ComboBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # comboBox1\r\n" + - " # \r\n" + - " @comboBox1.Items.AddRange(System::Array[System::Object].new(\r\n" + - " [\"aaa\",\r\n" + - " \"bbb\",\r\n" + - " \"ccc\"]))\r\n" + - " @comboBox1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @comboBox1.Name = \"comboBox1\"\r\n" + - " @comboBox1.Size = System::Drawing::Size.new(121, 21)\r\n" + - " @comboBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@comboBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs deleted file mode 100644 index 202382e1f2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateContextMenuStripTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateContextMenuStripTestFixture - { - string generatedRubyCode; - Size menuStripSize; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add timer. This checks that the components Container is only created once in the - // generated code. - Timer timer = (Timer)host.CreateComponent(typeof(Timer), "timer1"); - - // Add menu strip. - ContextMenuStrip menuStrip = (ContextMenuStrip)host.CreateComponent(typeof(ContextMenuStrip), "contextMenuStrip1"); - - // Set the context menu strip OwnerItem to simulate leaving the context menu - // open in the designer before generating the source code. We do not want the - // OwnerItem to be serialized. - menuStrip.OwnerItem = new DerivedToolStripMenuItem(); - menuStrip.RightToLeft = RightToLeft.No; - menuStripSize = menuStrip.Size; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @components = System::ComponentModel::Container.new()\r\n" + - " @timer1 = System::Windows::Forms::Timer.new(@components)\r\n" + - " @contextMenuStrip1 = System::Windows::Forms::ContextMenuStrip.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # contextMenuStrip1\r\n" + - " # \r\n" + - " @contextMenuStrip1.Name = \"contextMenuStrip1\"\r\n" + - " @contextMenuStrip1.Size = " + RubyPropertyValueAssignment.ToString(menuStripSize) + "\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCursorFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCursorFormTestFixture.cs deleted file mode 100644 index 828bd0fb52..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCursorFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateCursorFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor cursorDescriptor = descriptors.Find("Cursor", false); - cursorDescriptor.SetValue(form, Cursors.Help); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Cursor = System::Windows::Forms::Cursors.Help\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs deleted file mode 100644 index c1c43f73e0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateCustomCollectionItemsTestFixture.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that a custom collection class generates the correct code. - /// The collection class should be a property of a custom component or user control - /// and it should be marked with DesignerSerializationVisibility.Content. - /// - [TestFixture] - public class GenerateCustomCollectionItemsTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add custom control - CustomUserControl userControl = (CustomUserControl)host.CreateComponent(typeof(CustomUserControl), "userControl1"); - userControl.Location = new Point(0, 0); - userControl.ClientSize = new Size(200, 100); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - FooItem fooItem = (FooItem)serializationManager.CreateInstance(typeof(FooItem), new object[] {"aa"}, "fooItem1", false); - userControl.FooItems.Add(fooItem); - fooItem = (FooItem)serializationManager.CreateInstance(typeof(FooItem), new object[] {"bb"}, "fooItem2", false); - userControl.FooItems.Add(fooItem); - - BarItem barItem = (BarItem)serializationManager.CreateInstance(typeof(BarItem), new object[] {"cc"}, "barItem1", false); - userControl.ParentComponent.ParentBarItems.Add(barItem); - barItem = (BarItem)serializationManager.CreateInstance(typeof(BarItem), new object[] {"dd"}, "barItem2", false); - userControl.ParentComponent.ParentBarItems.Add(barItem); - form.Controls.Add(userControl); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " fooItem1 = ICSharpCode::Scripting::Tests::Utils::FooItem.new()\r\n" + - " fooItem2 = ICSharpCode::Scripting::Tests::Utils::FooItem.new()\r\n" + - " barItem1 = ICSharpCode::Scripting::Tests::Utils::BarItem.new()\r\n" + - " barItem2 = ICSharpCode::Scripting::Tests::Utils::BarItem.new()\r\n" + - " @userControl1 = ICSharpCode::Scripting::Tests::Utils::CustomUserControl.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " fooItem1.Text = \"aa\"\r\n" + - " fooItem2.Text = \"bb\"\r\n" + - " @userControl1.FooItems.AddRange(System::Array[ICSharpCode::Scripting::Tests::Utils::FooItem].new(\r\n" + - " [fooItem1,\r\n" + - " fooItem2]))\r\n" + - " @userControl1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @userControl1.Name = \"userControl1\"\r\n" + - " # \r\n" + - " # \r\n" + - " # \r\n" + - " barItem1.Text = \"cc\"\r\n" + - " barItem2.Text = \"dd\"\r\n" + - " @userControl1.ParentComponent.ParentBarItems.AddRange(System::Array[ICSharpCode::Scripting::Tests::Utils::BarItem].new(\r\n" + - " [barItem1,\r\n" + - " barItem2]))\r\n" + - " @userControl1.Size = System::Drawing::Size.new(200, 100)\r\n" + - " @userControl1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@userControl1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDataSetTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDataSetTestFixture.cs deleted file mode 100644 index e706daad5f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDataSetTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Data; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateDataSetTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - DataGridView dataGridView = (DataGridView)host.CreateComponent(typeof(DataGridView), "dataGridView1"); - dataGridView.Location = new Point(0, 0); - dataGridView.Size = new Size(100, 100); - form.Controls.Add(dataGridView); - - DataSet dataSet = (DataSet)host.CreateComponent(typeof(DataSet), "dataSet1"); - dataGridView.DataSource = dataSet; - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @dataGridView1 = System::Windows::Forms::DataGridView.new()\r\n" + - " @dataSet1 = System::Data::DataSet.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # dataGridView1\r\n" + - " # \r\n" + - " @dataGridView1.AutoGenerateColumns = false\r\n" + - " @dataGridView1.DataSource = @dataSet1\r\n" + - " @dataGridView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @dataGridView1.Name = \"dataGridView1\"\r\n" + - " @dataGridView1.Size = System::Drawing::Size.new(100, 100)\r\n" + - " @dataGridView1.TabIndex = 0\r\n" + - " # \r\n" + - " # dataSet1\r\n" + - " # \r\n" + - " @dataSet1.DataSetName = \"NewDataSet\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@dataGridView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs deleted file mode 100644 index cf5eb9235e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateDoubleBufferedFormTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// The DoubleBuffered property on the Control class is a protected method so using the GetType().GetProperty(...) - /// method will not return it. This test checks that this property is generated when creating the Ruby code - /// for the form. - /// - [TestFixture] - public class GenerateDoubleBufferedFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - form.AllowDrop = false; - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("DoubleBuffered", false); - doubleBufferedPropertyDescriptor.SetValue(form, true); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.DoubleBuffered = true\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs deleted file mode 100644 index c268b2f39f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventHandlerFormTestFixture.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Reflection; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that an event is wired to its event handler after the user specifies an event handler - /// method in the property grid. - /// - [TestFixture] - public class GenerateEventHandlerFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IEventBindingService), eventBindingService); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Simulate giving a name to the Load event handler in the property grid. - EventDescriptorCollection events = TypeDescriptor.GetEvents(form); - EventDescriptor loadEvent = events.Find("Load", false); - PropertyDescriptor loadEventProperty = eventBindingService.GetEventProperty(loadEvent); - loadEventProperty.SetValue(form, "MainFormLoad"); - - // Add a second event handler method. - EventDescriptor closedEvent = events.Find("FormClosed", false); - PropertyDescriptor closedEventProperty = eventBindingService.GetEventProperty(closedEvent); - closedEventProperty.SetValue(form, "MainFormClosed"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.FormClosed { |sender, e| self.MainFormClosed(sender, e) }\r\n" + - " self.Load { |sender, e| self.MainFormLoad(sender, e) }\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventLogTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventLogTestFixture.cs deleted file mode 100644 index 4222542c86..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateEventLogTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Diagnostics; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateEventLogTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - EventLog eventLog = (EventLog)host.CreateComponent(typeof(EventLog), "eventLog1"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - - [Test] - public void GeneratedCode() - { - string expectedCode = " @eventLog1 = System::Diagnostics::EventLog.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # eventLog1\r\n" + - " # \r\n" + - " @eventLog1.SynchronizingObject = self\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs deleted file mode 100644 index 4553e07e90..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFolderBrowserDialogRootFolderTestFixture.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFolderBrowserDialogRootFolderTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - FolderBrowserDialog dialog = (FolderBrowserDialog)host.CreateComponent(typeof(FolderBrowserDialog), "folderBrowserDialog1"); - dialog.RootFolder = Environment.SpecialFolder.ApplicationData; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "@folderBrowserDialog1 = System::Windows::Forms::FolderBrowserDialog.new()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# folderBrowserDialog1\r\n" + - "# \r\n" + - "@folderBrowserDialog1.RootFolder = System::Environment::SpecialFolder.ApplicationData\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormColorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormColorTestFixture.cs deleted file mode 100644 index f6b5f1dd7b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormColorTestFixture.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormColorTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor colorDescriptor = descriptors.Find("BackColor", false); - colorDescriptor.SetValue(form, SystemColors.HotTrack); - colorDescriptor = descriptors.Find("ForeColor", false); - colorDescriptor.SetValue(form, Color.Red); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackColor = System::Drawing::SystemColors.HotTrack\r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.ForeColor = System::Drawing::Color.Red\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormLocationTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormLocationTestFixture.cs deleted file mode 100644 index de7185238d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormLocationTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormLocationTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Location", false); - descriptor.SetValue(form, new Point(10, 20)); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Location = System::Drawing::Point.new(10, 20)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormPaddingTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormPaddingTestFixture.cs deleted file mode 100644 index ed86ffbeeb..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormPaddingTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormPaddingTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Padding", false); - descriptor.SetValue(form, new Padding(10, 20, 15, 18)); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Padding = System::Windows::Forms::Padding.new(10, 20, 15, 18)\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormResourceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormResourceTestFixture.cs deleted file mode 100644 index 98fc4f2e25..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateFormResourceTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateFormResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedRubyCode; - Bitmap bitmap; - Icon icon; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Set bitmap as form background image. - bitmap = new Bitmap(10, 10); - form.BackgroundImage = bitmap; - - icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - form.Icon = icon; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1); - } - } - } - - [Test] - public void TearDownFixture() - { - bitmap.Dispose(); - icon.Dispose(); - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " resources = System::Resources::ResourceManager.new(\"RootNamespace.MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackgroundImage = resources.GetObject(\"$this.BackgroundImage\")\r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Icon = resources.GetObject(\"$this.Icon\")\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - - [Test] - public void BitmapAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(bitmap, resourceWriter.GetResource("$this.BackgroundImage"))); - } - - [Test] - public void IconAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(icon, resourceWriter.GetResource("$this.Icon"))); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImageListResourceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImageListResourceTestFixture.cs deleted file mode 100644 index bf9dc1754a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImageListResourceTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateImageListResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedRubyCode; - Icon icon; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add ImageList. - icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1"); - imageList.Images.Add("App.ico", icon); - imageList.Images.Add("", icon); - imageList.Images.Add("", icon); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, "RootNamespace", 1); - } - } - } - - [Test] - public void TearDownFixture() - { - icon.Dispose(); - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @components = System::ComponentModel::Container.new()\r\n" + - " resources = System::Resources::ResourceManager.new(\"RootNamespace.MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " @imageList1 = System::Windows::Forms::ImageList.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # imageList1\r\n" + - " # \r\n" + - " @imageList1.ImageStream = resources.GetObject(\"imageList1.ImageStream\")\r\n" + - " @imageList1.TransparentColor = System::Drawing::Color.Transparent\r\n" + - " @imageList1.Images.SetKeyName(0, \"App.ico\")\r\n" + - " @imageList1.Images.SetKeyName(1, \"\")\r\n" + - " @imageList1.Images.SetKeyName(2, \"\")\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - - [Test] - public void ImageStreamAddedToResourceWriter() - { - Assert.IsNotNull(resourceWriter.GetResource("imageList1.ImageStream")); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImeModeFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImeModeFormTestFixture.cs deleted file mode 100644 index 2738b2c39a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateImeModeFormTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateImeModeFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("ImeMode", false); - doubleBufferedPropertyDescriptor.SetValue(form, ImeMode.Alpha); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.ImeMode = System::Windows::Forms::ImeMode.Alpha\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedFormTestFixture.cs deleted file mode 100644 index 42aeac9027..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedFormTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - class BaseForm : Form - { - Button button1 = new Button(); - - public BaseForm() - { - button1.Name = "button1"; - Controls.Add(button1); - } - } - - class DerivedForm : BaseForm - { - } - - /// - /// Tests that no code is generated for controls that are inherited from the base class. - /// - [TestFixture] - public class GenerateInheritedFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(DerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs deleted file mode 100644 index e0053370d4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedProtectedPanelFormTestFixture.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - class ProtectedPanelBaseForm : Form - { - protected Panel panel1 = new Panel(); - Button button1 = new Button(); - - public ProtectedPanelBaseForm() - { - button1.Name = "button1"; - - panel1.Name = "panel1"; - panel1.Location = new Point(5, 10); - panel1.Size = new Size(200, 100); - panel1.Controls.Add(button1); - - Controls.Add(panel1); - } - } - - class ProtectedPanelDerivedForm : ProtectedPanelBaseForm - { - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Point PanelLocation { - get { return panel1.Location; } - set { panel1.Location = value; } - } - - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Size PanelSize { - get { return panel1.Size; } - set { panel1.Size = value; } - } - - [EditorBrowsableAttribute(EditorBrowsableState.Never)] - internal Panel GetPanel() - { - return panel1; - } - } - - /// - /// Tests that no code is generated for a protected panel control in the base class - /// that has child controls. - /// - [TestFixture] - public class GenerateInheritedProtectedPanelFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(ProtectedPanelDerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Move protected panel so we generate code for the new location. - ProtectedPanelDerivedForm derivedForm = (ProtectedPanelDerivedForm)form; - derivedForm.PanelLocation = new Point(10, 15); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System::Drawing::Point.new(10, 15)\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs deleted file mode 100644 index 8cbe908112..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateInheritedToolTipTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - class PublicToolTipBaseForm : Form - { - public ToolTip toolTip; - Container components = new Container(); - - public PublicToolTipBaseForm() - { - toolTip = new ToolTip(components); - } - } - - class PublicToolTipDerivedForm : PublicToolTipBaseForm - { - } - - [TestFixture] - public class GenerateInheritedToolTipTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(PublicToolTipDerivedForm))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - PublicToolTipDerivedForm form = (PublicToolTipDerivedForm)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - form.toolTip.SetToolTip(form, "test"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.toolTip.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs deleted file mode 100644 index d6ab8df64c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewGroupsTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewGroupsTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add groups. - ListViewGroup group1 = (ListViewGroup)serializationManager.CreateInstance(typeof(ListViewGroup), new object[0], "listViewGroup1", false); - group1.Header = "ListViewGroup"; - group1.HeaderAlignment = HorizontalAlignment.Right; - group1.Name = "defaultGroup"; - group1.Tag = "tag1"; - listView.Groups.Add(group1); - - ListViewGroup group2 = (ListViewGroup)serializationManager.CreateInstance(typeof(ListViewGroup), new object[0], "listViewGroup2", false); - group2.Header = "ListViewGroup"; - group2.HeaderAlignment = HorizontalAlignment.Center; - group2.Name = "listViewGroup2"; - listView.Groups.Add(group2); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewGroup1 = System::Windows::Forms::ListViewGroup.new(\"ListViewGroup\", System::Windows::Forms::HorizontalAlignment.Right)\r\n" + - " listViewGroup2 = System::Windows::Forms::ListViewGroup.new(\"ListViewGroup\", System::Windows::Forms::HorizontalAlignment.Center)\r\n" + - " @listView1 = System::Windows::Forms::ListView.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " listViewGroup1.Header = \"ListViewGroup\"\r\n" + - " listViewGroup1.HeaderAlignment = System::Windows::Forms::HorizontalAlignment.Right\r\n" + - " listViewGroup1.Name = \"defaultGroup\"\r\n" + - " listViewGroup1.Tag = \"tag1\"\r\n" + - " listViewGroup2.Header = \"ListViewGroup\"\r\n" + - " listViewGroup2.HeaderAlignment = System::Windows::Forms::HorizontalAlignment.Center\r\n" + - " listViewGroup2.Name = \"listViewGroup2\"\r\n" + - " @listView1.Groups.AddRange(System::Array[System::Windows::Forms::ListViewGroup].new(\r\n" + - " [listViewGroup1,\r\n" + - " listViewGroup2]))\r\n" + - " @listView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @listView1.Name = \"listView1\"\r\n" + - " @listView1.Size = System::Drawing::Size.new(204, 104)\r\n" + - " @listView1.TabIndex = 0\r\n" + - " @listView1.View = System::Windows::Forms::View.Details\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewItemTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewItemTestFixture.cs deleted file mode 100644 index 74de9d66da..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewItemTestFixture.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewItemsFormTestFixture - { - string generatedRubyCode; - ColumnHeader columnHeader1; - ColumnHeader columnHeader2; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add column headers. - columnHeader1 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader1"); - descriptors = TypeDescriptor.GetProperties(columnHeader1); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader1, "columnHeader1"); - listView.Columns.Add(columnHeader1); - - columnHeader2 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader2"); - descriptors = TypeDescriptor.GetProperties(columnHeader2); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader2, "columnHeader2"); - listView.Columns.Add(columnHeader2); - - // Add list view items. - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"aaa"}, "listViewItem1", false); - item.ToolTipText = "tooltip"; - listView.Items.Add(item); - - item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"bbb"}, "listViewItem2", false); - listView.Items.Add(item); - - item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem3", false); - listView.Items.Add(item); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewItem1 = System::Windows::Forms::ListViewItem.new(\"aaa\")\r\n" + - " listViewItem2 = System::Windows::Forms::ListViewItem.new(\"bbb\")\r\n" + - " listViewItem3 = System::Windows::Forms::ListViewItem.new(\"\")\r\n" + - " @listView1 = System::Windows::Forms::ListView.new()\r\n" + - " @columnHeader1 = System::Windows::Forms::ColumnHeader.new()\r\n" + - " @columnHeader2 = System::Windows::Forms::ColumnHeader.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " @listView1.Columns.AddRange(System::Array[System::Windows::Forms::ColumnHeader].new(\r\n" + - " [@columnHeader1,\r\n" + - " @columnHeader2]))\r\n" + - " listViewItem1.ToolTipText = \"tooltip\"\r\n" + - " @listView1.Items.AddRange(System::Array[System::Windows::Forms::ListViewItem].new(\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2,\r\n" + - " listViewItem3]))\r\n" + - " @listView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @listView1.Name = \"listView1\"\r\n" + - " @listView1.Size = System::Drawing::Size.new(204, 104)\r\n" + - " @listView1.TabIndex = 0\r\n" + - " @listView1.View = System::Windows::Forms::View.Details\r\n" + - " # \r\n" + - " # columnHeader1\r\n" + - " # \r\n" + - " @columnHeader1.Text = \"columnHeader1\"\r\n" + - " # \r\n" + - " # columnHeader2\r\n" + - " # \r\n" + - " @columnHeader2.Text = \"columnHeader2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs deleted file mode 100644 index f29d4578e1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewSubItemsTestFixture.cs +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewSubItemsTestFixture - { - string generatedRubyCode; - ColumnHeader columnHeader1; - ColumnHeader columnHeader2; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add column headers. - columnHeader1 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader1"); - descriptors = TypeDescriptor.GetProperties(columnHeader1); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader1, "columnHeader1"); - listView.Columns.Add(columnHeader1); - - columnHeader2 = (ColumnHeader)host.CreateComponent(typeof(ColumnHeader), "columnHeader2"); - descriptors = TypeDescriptor.GetProperties(columnHeader2); - descriptor = descriptors.Find("Text", false); - descriptor.SetValue(columnHeader2, "columnHeader2"); - listView.Columns.Add(columnHeader2); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add list view item with 3 sub items. - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"listItem1"}, "listViewItem1", false); - item.SubItems.Add("subItem1"); - item.SubItems.Add("subItem2"); - item.SubItems.Add("subItem3"); - listView.Items.Add(item); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - /// - /// Should include the column header and list view item creation. - /// - [Test] - public void GeneratedCode() - { - string expectedCode = " listViewItem1 = System::Windows::Forms::ListViewItem.new(System::Array[System::String].new(\r\n" + - " [\"listItem1\",\r\n" + - " \"subItem1\",\r\n" + - " \"subItem2\",\r\n" + - " \"subItem3\"]), -1)\r\n" + - " @listView1 = System::Windows::Forms::ListView.new()\r\n" + - " @columnHeader1 = System::Windows::Forms::ColumnHeader.new()\r\n" + - " @columnHeader2 = System::Windows::Forms::ColumnHeader.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " @listView1.Columns.AddRange(System::Array[System::Windows::Forms::ColumnHeader].new(\r\n" + - " [@columnHeader1,\r\n" + - " @columnHeader2]))\r\n" + - " @listView1.Items.AddRange(System::Array[System::Windows::Forms::ListViewItem].new(\r\n" + - " [listViewItem1]))\r\n" + - " @listView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @listView1.Name = \"listView1\"\r\n" + - " @listView1.Size = System::Drawing::Size.new(204, 104)\r\n" + - " @listView1.TabIndex = 0\r\n" + - " @listView1.View = System::Windows::Forms::View.Details\r\n" + - " # \r\n" + - " # columnHeader1\r\n" + - " # \r\n" + - " @columnHeader1.Text = \"columnHeader1\"\r\n" + - " # \r\n" + - " # columnHeader2\r\n" + - " # \r\n" + - " @columnHeader2.Text = \"columnHeader2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewWithImageListFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewWithImageListFormTestFixture.cs deleted file mode 100644 index 2171a30714..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateListViewWithImageListFormTestFixture.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateListViewWithImageListFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add list view. - ListView listView = (ListView)host.CreateComponent(typeof(ListView), "listView1"); - listView.TabIndex = 0; - listView.Location = new Point(0, 0); - listView.ClientSize = new Size(200, 100); - descriptors = TypeDescriptor.GetProperties(listView); - PropertyDescriptor descriptor = descriptors.Find("UseCompatibleStateImageBehavior", false); - descriptor.SetValue(listView, true); - descriptor = descriptors.Find("View", false); - descriptor.SetValue(listView, View.Details); - form.Controls.Add(listView); - - // Add ImageList. - Icon icon = new Icon(typeof(GenerateFormResourceTestFixture), "App.ico"); - ImageList imageList = (ImageList)host.CreateComponent(typeof(ImageList), "imageList1"); - imageList.Images.Add("App.ico", icon); - imageList.Images.Add("b.ico", icon); - imageList.Images.Add("c.ico", icon); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - // Add list view items. - ListViewItem item = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"aaa"}, "listViewItem1", false); - item.ImageIndex = 1; - listView.Items.Add(item); - - ListViewItem item2 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[] {"bbb"}, "listViewItem2", false); - item2.ImageKey = "App.ico"; - listView.Items.Add(item2); - - ListViewItem item3 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem3", false); - item3.ImageIndex = 2; - listView.Items.Add(item3); - - ListViewItem item4 = (ListViewItem)serializationManager.CreateInstance(typeof(ListViewItem), new object[0], "listViewItem4", false); - item4.ImageKey = "b.ico"; - listView.Items.Add(item4); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager); - } - } - } - - /// - /// Should include the column header and list view item creation. - /// - [Test] - public void GenerateCode() - { - string expectedCode = "@components = System::ComponentModel::Container.new()\r\n" + - "listViewItem1 = System::Windows::Forms::ListViewItem.new(\"aaa\", 1)\r\n" + - "listViewItem2 = System::Windows::Forms::ListViewItem.new(\"bbb\", \"App.ico\")\r\n" + - "listViewItem3 = System::Windows::Forms::ListViewItem.new(\"\", 2)\r\n" + - "listViewItem4 = System::Windows::Forms::ListViewItem.new(\"\", \"b.ico\")\r\n" + - "resources = System::Resources::ResourceManager.new(\"MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - "@listView1 = System::Windows::Forms::ListView.new()\r\n" + - "@imageList1 = System::Windows::Forms::ImageList.new(@components)\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# listView1\r\n" + - "# \r\n" + - "@listView1.Items.AddRange(System::Array[System::Windows::Forms::ListViewItem].new(\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2,\r\n" + - " listViewItem3,\r\n" + - " listViewItem4]))\r\n" + - "@listView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - "@listView1.Name = \"listView1\"\r\n" + - "@listView1.Size = System::Drawing::Size.new(204, 104)\r\n" + - "@listView1.TabIndex = 0\r\n" + - "@listView1.View = System::Windows::Forms::View.Details\r\n" + - "# \r\n" + - "# imageList1\r\n" + - "# \r\n" + - "@imageList1.ImageStream = resources.GetObject(\"imageList1.ImageStream\")\r\n" + - "@imageList1.TransparentColor = System::Drawing::Color.Transparent\r\n" + - "@imageList1.Images.SetKeyName(0, \"App.ico\")\r\n" + - "@imageList1.Images.SetKeyName(1, \"b.ico\")\r\n" + - "@imageList1.Images.SetKeyName(2, \"c.ico\")\r\n" + - "# \r\n" + - "# MainForm\r\n" + - "# \r\n" + - "self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - "self.Controls.Add(@listView1)\r\n" + - "self.Name = \"MainForm\"\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs deleted file mode 100644 index 3ad8fe858d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateLocalImageResourceTestFixture.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Globalization; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateLocalImageResourceTestFixture - { - MockResourceWriter resourceWriter; - MockComponentCreator componentCreator; - string generatedRubyCode; - MockResourceWriter resourceWriter2; - MockComponentCreator componentCreator2; - Bitmap bitmap; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - componentCreator = new MockComponentCreator(); - componentCreator.SetResourceWriter(resourceWriter); - - resourceWriter2 = new MockResourceWriter(); - componentCreator2 = new MockComponentCreator(); - componentCreator2.SetResourceWriter(resourceWriter2); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IResourceService), componentCreator); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add picture box - PictureBox pictureBox = (PictureBox)host.CreateComponent(typeof(PictureBox), "pictureBox1"); - pictureBox.Location = new Point(0, 0); - bitmap = new Bitmap(10, 10); - pictureBox.Image = bitmap; - pictureBox.Size = new Size(100, 120); - pictureBox.TabIndex = 0; - form.Controls.Add(pictureBox); - - // Add bitmap to form. - form.BackgroundImage = new Bitmap(10, 10); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - - // Check that calling the GenerateInitializeComponentMethodBody also generates a resource file. - host.RemoveService(typeof(IResourceService)); - host.AddService(typeof(IResourceService), componentCreator2); - - serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " resources = System::Resources::ResourceManager.new(\"MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " @pictureBox1 = System::Windows::Forms::PictureBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " @pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " @pictureBox1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @pictureBox1.Name = \"pictureBox1\"\r\n" + - " @pictureBox1.Size = System::Drawing::Size.new(100, 120)\r\n" + - " @pictureBox1.TabIndex = 0\r\n" + - " @pictureBox1.TabStop = false\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.BackgroundImage = resources.GetObject(\"$this.BackgroundImage\")\r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@pictureBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - - [Test] - public void ResourceWriterRetrievedFromComponentCreator() - { - Assert.IsTrue(componentCreator.GetResourceWriterCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceWriter() - { - Assert.AreEqual(CultureInfo.InvariantCulture, componentCreator.CultureInfoPassedToGetResourceWriter); - } - - [Test] - public void ResourceWriterRetrievedFromComponentCreator2() - { - Assert.IsTrue(componentCreator2.GetResourceWriterCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceWriter2() - { - Assert.AreEqual(CultureInfo.InvariantCulture, componentCreator2.CultureInfoPassedToGetResourceWriter); - } - -// [Test] -// public void ResourceWriter2IsDisposed() -// { -// Assert.IsTrue(resourceWriter2.IsDisposed); -// } - - [Test] - public void BitmapAddedToResourceWriter() - { - Assert.IsTrue(Object.ReferenceEquals(bitmap, resourceWriter.GetResource("pictureBox1.Image"))); - } - - [Test] - public void ResourceWriterHasNonNullPictureBox1ImageResource() - { - Assert.IsNotNull(resourceWriter.GetResource("pictureBox1.Image")); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs deleted file mode 100644 index b7a7575cbc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripFormTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Adding a MenuStrip control to a form in the designer generates code for a - /// miniToolStrip - System.Windows.Forms.Design.ToolStripTemplateNode+TransparentToolStrip() - /// This is a design time control and should be ignored. - /// - [TestFixture] - public class GenerateMenuStripFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - form.Controls.Add(menuStrip); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @menuStrip1 = System::Windows::Forms::MenuStrip.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " @menuStrip1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @menuStrip1.Name = \"menuStrip1\"\r\n" + - " @menuStrip1.Size = System::Drawing::Size.new(200, 24)\r\n" + - " @menuStrip1.TabIndex = 0\r\n" + - " @menuStrip1.Text = \"menuStrip1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@menuStrip1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripItemsFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripItemsFormTestFixture.cs deleted file mode 100644 index 4a8ce8bbdc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMenuStripItemsFormTestFixture.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateMenuStripItemsFormTestFixture - { - string generatedRubyCode; - Size fileMenuItemSize; - Size openMenuItemSize; - Size exitMenuItemSize; - Size editMenuItemSize; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - menuStrip.Size = new System.Drawing.Size(200, 24); - - // Add menu strip items. - ToolStripMenuItem fileMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "fileToolStripMenuItem"); - fileMenuItem.Text = "&File"; - - ToolStripMenuItem openMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "openToolStripMenuItem"); - openMenuItem.Text = "&Open"; - - ToolStripMenuItem exitMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "exitToolStripMenuItem"); - exitMenuItem.Text = "E&xit"; - fileMenuItem.DropDownItems.Add(openMenuItem); - fileMenuItem.DropDownItems.Add(exitMenuItem); - - // Add non-sited component. - fileMenuItem.DropDownItems.Add(new ToolStripMenuItem()); - - menuStrip.Items.Add(fileMenuItem); - - ToolStripMenuItem editMenuItem = (ToolStripMenuItem)host.CreateComponent(typeof(ToolStripMenuItem), "editToolStripMenuItem"); - editMenuItem.Text = "&Edit"; - menuStrip.Items.Add(editMenuItem); - - form.Controls.Add(menuStrip); - - fileMenuItemSize = fileMenuItem.Size; - openMenuItemSize = openMenuItem.Size; - exitMenuItemSize = exitMenuItem.Size; - editMenuItemSize = editMenuItem.Size; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @menuStrip1 = System::Windows::Forms::MenuStrip.new()\r\n" + - " @fileToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @openToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @exitToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @editToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @menuStrip1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " @menuStrip1.Items.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@fileToolStripMenuItem,\r\n" + - " @editToolStripMenuItem]))\r\n" + - " @menuStrip1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @menuStrip1.Name = \"menuStrip1\"\r\n" + - " @menuStrip1.Size = System::Drawing::Size.new(200, 24)\r\n" + - " @menuStrip1.TabIndex = 0\r\n" + - " @menuStrip1.Text = \"menuStrip1\"\r\n" + - " # \r\n" + - " # fileToolStripMenuItem\r\n" + - " # \r\n" + - " @fileToolStripMenuItem.DropDownItems.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@openToolStripMenuItem,\r\n" + - " @exitToolStripMenuItem]))\r\n" + - " @fileToolStripMenuItem.Name = \"fileToolStripMenuItem\"\r\n" + - " @fileToolStripMenuItem.Size = " + SizeToString(fileMenuItemSize) + "\r\n" + - " @fileToolStripMenuItem.Text = \"&File\"\r\n" + - " # \r\n" + - " # openToolStripMenuItem\r\n" + - " # \r\n" + - " @openToolStripMenuItem.Name = \"openToolStripMenuItem\"\r\n" + - " @openToolStripMenuItem.Size = " + SizeToString(openMenuItemSize) + "\r\n" + - " @openToolStripMenuItem.Text = \"&Open\"\r\n" + - " # \r\n" + - " # exitToolStripMenuItem\r\n" + - " # \r\n" + - " @exitToolStripMenuItem.Name = \"exitToolStripMenuItem\"\r\n" + - " @exitToolStripMenuItem.Size = " + SizeToString(exitMenuItemSize) + "\r\n" + - " @exitToolStripMenuItem.Text = \"E&xit\"\r\n" + - " # \r\n" + - " # editToolStripMenuItem\r\n" + - " # \r\n" + - " @editToolStripMenuItem.Name = \"editToolStripMenuItem\"\r\n" + - " @editToolStripMenuItem.Size = " + SizeToString(editMenuItemSize) + "\r\n" + - " @editToolStripMenuItem.Text = \"&Edit\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@menuStrip1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " @menuStrip1.ResumeLayout(false)\r\n" + - " @menuStrip1.PerformLayout()\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - - string SizeToString(Size size) - { - return RubyPropertyValueAssignment.ToString(size); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs deleted file mode 100644 index 9473ca1d3b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMinSizeFormTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that a form's MinimumSize, AutoScrollMinSize and AutoScrollMargin properties are generated - /// in the InitializeComponent method. - /// - [TestFixture] - public class GenerateMinSizeFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("MinimumSize", false); - descriptor.SetValue(form, new Size(100, 200)); - descriptor = descriptors.Find("AutoScrollMinSize", false); - descriptor.SetValue(form, new Size(10, 20)); - descriptor = descriptors.Find("AutoScrollMargin", false); - descriptor.SetValue(form, new Size(11, 22)); - descriptor = descriptors.Find("AutoScroll", false); - descriptor.SetValue(form, false); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AutoScrollMargin = System::Drawing::Size.new(11, 22)\r\n" + - " self.AutoScrollMinSize = System::Drawing::Size.new(10, 20)\r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.MinimumSize = System::Drawing::Size.new(100, 200)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs deleted file mode 100644 index 5c7202275f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateMonthCalendarTestFixture.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateMonthCalendarTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add month calendar. - MonthCalendar calendar = (MonthCalendar)host.CreateComponent(typeof(MonthCalendar), "monthCalendar1"); - calendar.TabIndex = 0; - calendar.Location = new Point(0, 0); - calendar.AddMonthlyBoldedDate(new DateTime(2009, 1, 2)); - calendar.AddMonthlyBoldedDate(new DateTime(0)); - - form.Controls.Add(calendar); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @monthCalendar1 = System::Windows::Forms::MonthCalendar.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # monthCalendar1\r\n" + - " # \r\n" + - " @monthCalendar1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @monthCalendar1.MonthlyBoldedDates = System::Array[System::DateTime].new(\r\n" + - " [System::DateTime.new(2009, 1, 2, 0, 0, 0, 0),\r\n" + - " System::DateTime.new(0)])\r\n" + - " @monthCalendar1.Name = \"monthCalendar1\"\r\n" + - " @monthCalendar1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@monthCalendar1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs deleted file mode 100644 index 93fa5d6092..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateNestedPanelFormTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Ensures that SuspendLayout and ResumeLayout methods are generated for a panel containing controls and sitting on top of - /// another panel. - /// - [TestFixture] - public class GenerateNestedPanelFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Panel panel1 = (Panel)host.CreateComponent(typeof(Panel), "panel1"); - panel1.Location = new Point(0, 0); - panel1.TabIndex = 0; - panel1.Size = new Size(200, 220); - - Panel panel2 = (Panel)host.CreateComponent(typeof(Panel), "panel2"); - panel2.Location = new Point(10, 15); - panel2.TabIndex = 0; - panel2.Size = new Size(100, 120); - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Location = new Point(5, 5); - textBox.TabIndex = 0; - textBox.Size = new Size(110, 20); - panel2.Controls.Add(textBox); - - panel1.Controls.Add(panel2); - form.Controls.Add(panel1); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @panel1 = System::Windows::Forms::Panel.new()\r\n" + - " @panel2 = System::Windows::Forms::Panel.new()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " @panel1.SuspendLayout()\r\n" + - " @panel2.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " @panel1.Controls.Add(@panel2)\r\n" + - " @panel1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @panel1.Name = \"panel1\"\r\n" + - " @panel1.Size = System::Drawing::Size.new(200, 220)\r\n" + - " @panel1.TabIndex = 0\r\n" + - " # \r\n" + - " # panel2\r\n" + - " # \r\n" + - " @panel2.Controls.Add(@textBox1)\r\n" + - " @panel2.Location = System::Drawing::Point.new(10, 15)\r\n" + - " @panel2.Name = \"panel2\"\r\n" + - " @panel2.Size = System::Drawing::Size.new(100, 120)\r\n" + - " @panel2.TabIndex = 0\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Location = System::Drawing::Point.new(5, 5)\r\n" + - " @textBox1.Name = \"textBox1\"\r\n" + - " @textBox1.Size = System::Drawing::Size.new(110, 20)\r\n" + - " @textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@panel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " @panel1.ResumeLayout(false)\r\n" + - " @panel2.ResumeLayout(false)\r\n" + - " @panel2.PerformLayout()\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePanelFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePanelFormTestFixture.cs deleted file mode 100644 index 49be687541..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePanelFormTestFixture.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GeneratePanelFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - host.AddService(typeof(IEventBindingService), eventBindingService); - - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Panel panel = (Panel)host.CreateComponent(typeof(Panel), "panel1"); - panel.Location = new Point(10, 15); - panel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - panel.TabIndex = 0; - panel.Size = new Size(100, 120); - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Location = new Point(5, 5); - textBox.TabIndex = 0; - textBox.Size = new Size(110, 20); - panel.Controls.Add(textBox); - - // Add an event handler to the panel to check that this code is generated - // before the text box is initialized. - EventDescriptorCollection events = TypeDescriptor.GetEvents(panel); - EventDescriptor clickEvent = events.Find("Click", false); - PropertyDescriptor clickEventProperty = eventBindingService.GetEventProperty(clickEvent); - clickEventProperty.SetValue(panel, "Panel1Click"); - - form.Controls.Add(panel); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - " @panel1 = System::Windows::Forms::Panel.new()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " @panel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " @panel1.Anchor = System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom | System::Windows::Forms::AnchorStyles.Left | System::Windows::Forms::AnchorStyles.Right\r\n" + - " @panel1.Controls.Add(@textBox1)\r\n" + - " @panel1.Location = System::Drawing::Point.new(10, 15)\r\n" + - " @panel1.Name = \"panel1\"\r\n" + - " @panel1.Size = System::Drawing::Size.new(100, 120)\r\n" + - " @panel1.TabIndex = 0\r\n" + - " @panel1.Click { |sender, e| self.Panel1Click(sender, e) }\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Location = System::Drawing::Point.new(5, 5)\r\n" + - " @textBox1.Name = \"textBox1\"\r\n" + - " @textBox1.Size = System::Drawing::Size.new(110, 20)\r\n" + - " @textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@panel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " @panel1.ResumeLayout(false)\r\n" + - " @panel1.PerformLayout()\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePictureBoxBeginInitTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePictureBoxBeginInitTestFixture.cs deleted file mode 100644 index 01ec9787b2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratePictureBoxBeginInitTestFixture.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel.Design.Serialization; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GeneratePictureBoxBeginInitTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - using (Form form = new Form()) { - form.Site = new MockSite(); - CodeMemberMethod method = CreateMethod(); - DesignerSerializationManager serializationManager = new DesignerSerializationManager(); - using (serializationManager.CreateSession()) { - generatedRubyCode = serializer.GenerateMethodBody(form, method, serializationManager, String.Empty, 0); - } - } - } - - CodeMemberMethod CreateMethod() - { - CodeMemberMethod method = new CodeMemberMethod(); - - // BeginInit method call. - CodeExpressionStatement statement = new CodeExpressionStatement(); - CodeMethodInvokeExpression methodInvoke = new CodeMethodInvokeExpression(); - statement.Expression = methodInvoke; - - CodeMethodReferenceExpression methodRef = new CodeMethodReferenceExpression(); - methodRef.MethodName = "BeginInit"; - - CodeCastExpression cast = new CodeCastExpression(); - cast.TargetType = new CodeTypeReference(); - cast.TargetType.BaseType = "System.ComponentModel.ISupportInitialize"; - - CodeFieldReferenceExpression fieldRef = new CodeFieldReferenceExpression(); - fieldRef.FieldName = "pictureBox1"; - fieldRef.TargetObject = new CodeThisReferenceExpression(); - cast.Expression = fieldRef; - - methodRef.TargetObject = cast; - methodInvoke.Method = methodRef; - - method.Statements.Add(statement); - return method; - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "@pictureBox1.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs deleted file mode 100644 index f7d3602468..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRichTextBoxTestFixture.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that multiline text is correctly generated for the RichTextBox. - /// - [TestFixture] - public class GenerateRichTextBoxTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - RichTextBox textBox = (RichTextBox)host.CreateComponent(typeof(RichTextBox), "richTextBox1"); - textBox.Size = new Size(110, 20); - textBox.TabIndex = 1; - textBox.Location = new Point(10, 10); - textBox.Text = "abc\r\n" + - "def\r\n" + - "ghi\r\n"; - - form.Controls.Add(textBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @richTextBox1 = System::Windows::Forms::RichTextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # richTextBox1\r\n" + - " # \r\n" + - " @richTextBox1.Location = System::Drawing::Point.new(10, 10)\r\n" + - " @richTextBox1.Name = \"richTextBox1\"\r\n" + - " @richTextBox1.Size = System::Drawing::Size.new(110, 20)\r\n" + - " @richTextBox1.TabIndex = 1\r\n" + - " @richTextBox1.Text = \"\"\"abc\n" + - "def\n" + - "ghi\n" + - "\"\"\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@richTextBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs deleted file mode 100644 index 381074132c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateRightToLeftFormTestFixture.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateRightToLeftFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor doubleBufferedPropertyDescriptor = descriptors.Find("RightToLeft", false); - doubleBufferedPropertyDescriptor.SetValue(form, RightToLeft.Yes); - - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.RightToLeft = System::Windows::Forms::RightToLeft.Yes\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateSimpleFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateSimpleFormTestFixture.cs deleted file mode 100644 index 3297f0b1fa..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateSimpleFormTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateSimpleFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs deleted file mode 100644 index b9ccafd810..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTableLayoutPanelTestFixture.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTableLayoutPanelTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add table layout panel. - TableLayoutPanel tableLayoutPanel1 = (TableLayoutPanel)host.CreateComponent(typeof(TableLayoutPanel), "tableLayoutPanel1"); - tableLayoutPanel1.ColumnCount = 2; - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40F)); - tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F)); - tableLayoutPanel1.Location = new Point(0, 0); - tableLayoutPanel1.RowCount = 2; - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F)); - tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F)); - tableLayoutPanel1.Size = new Size(200, 100); - tableLayoutPanel1.TabIndex = 0; - - form.Controls.Add(tableLayoutPanel1); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @tableLayoutPanel1 = System::Windows::Forms::TableLayoutPanel.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # tableLayoutPanel1\r\n" + - " # \r\n" + - " @tableLayoutPanel1.ColumnCount = 2\r\n" + - " @tableLayoutPanel1.ColumnStyles.Add(System::Windows::Forms::ColumnStyle.new(System::Windows::Forms::SizeType.Percent, 40))\r\n" + - " @tableLayoutPanel1.ColumnStyles.Add(System::Windows::Forms::ColumnStyle.new(System::Windows::Forms::SizeType.Percent, 60))\r\n" + - " @tableLayoutPanel1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @tableLayoutPanel1.Name = \"tableLayoutPanel1\"\r\n" + - " @tableLayoutPanel1.RowCount = 2\r\n" + - " @tableLayoutPanel1.RowStyles.Add(System::Windows::Forms::RowStyle.new(System::Windows::Forms::SizeType.Absolute, 20))\r\n" + - " @tableLayoutPanel1.RowStyles.Add(System::Windows::Forms::RowStyle.new(System::Windows::Forms::SizeType.Absolute, 25))\r\n" + - " @tableLayoutPanel1.Size = System::Drawing::Size.new(200, 100)\r\n" + - " @tableLayoutPanel1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@tableLayoutPanel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs deleted file mode 100644 index 78f5a5c937..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTextBoxFormTestFixture.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTextBoxFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - TextBox textBox = (TextBox)host.CreateComponent(typeof(TextBox), "textBox1"); - textBox.Size = new Size(110, 20); - textBox.TabIndex = 1; - textBox.Location = new Point(10, 10); - - form.Controls.Add(textBox); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Location = System::Drawing::Point.new(10, 10)\r\n" + - " @textBox1.Name = \"textBox1\"\r\n" + - " @textBox1.Size = System::Drawing::Size.new(110, 20)\r\n" + - " @textBox1.TabIndex = 1\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@textBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTimerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTimerTestFixture.cs deleted file mode 100644 index 2865d303ce..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTimerTestFixture.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTimerTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Timer timer = (Timer)host.CreateComponent(typeof(Timer), "timer1"); - descriptors = TypeDescriptor.GetProperties(timer); - namePropertyDescriptor = descriptors.Find("Interval", false); - namePropertyDescriptor.SetValue(timer, 1000); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @components = System::ComponentModel::Container.new()\r\n" + - " @timer1 = System::Windows::Forms::Timer.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # timer1\r\n" + - " # \r\n" + - " @timer1.Interval = 1000\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateToolTipFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateToolTipFormTestFixture.cs deleted file mode 100644 index 46f196342d..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateToolTipFormTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateToolTipFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - ToolTip toolTip = (ToolTip)host.CreateComponent(typeof(ToolTip), "toolTip1"); - toolTip.SetToolTip(form, "test"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @components = System::ComponentModel::Container.new()\r\n" + - " @toolTip1 = System::Windows::Forms::ToolTip.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " @toolTip1.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTreeViewTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTreeViewTestFixture.cs deleted file mode 100644 index f1bca228ab..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateTreeViewTestFixture.cs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class GenerateTreeViewTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add tree view. - TreeView treeView = (TreeView)host.CreateComponent(typeof(TreeView), "treeView1"); - treeView.LineColor = Color.Black; - treeView.Location = new Point(0, 0); - treeView.Size = new Size(100, 100); - - DesignerSerializationManager designerSerializationManager = new DesignerSerializationManager(host); - IDesignerSerializationManager serializationManager = (IDesignerSerializationManager)designerSerializationManager; - using (designerSerializationManager.CreateSession()) { - - // Add first root node. - TreeNode firstRootNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode3", false); - firstRootNode.Name = "RootNode0"; - firstRootNode.Text = "RootNode0.Text"; - treeView.Nodes.Add(firstRootNode); - - // Add first child node. - TreeNode firstChildNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode2", false); - firstChildNode.Name = "ChildNode0"; - firstChildNode.Text = "ChildNode0.Text"; - firstRootNode.Nodes.Add(firstChildNode); - - // Add second child node. - TreeNode secondChildNode = (TreeNode)serializationManager.CreateInstance(typeof(TreeNode), new object[0], "treeNode1", false); - secondChildNode.Name = "ChildNode1"; - secondChildNode.Text = "ChildNode1.Text"; - firstChildNode.Nodes.Add(secondChildNode); - - form.Controls.Add(treeView); - - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, designerSerializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " treeNode1 = System::Windows::Forms::TreeNode.new(\"ChildNode1.Text\")\r\n" + - " treeNode2 = System::Windows::Forms::TreeNode.new(\"ChildNode0.Text\", System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode1]))\r\n" + - " treeNode3 = System::Windows::Forms::TreeNode.new(\"RootNode0.Text\", System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode2]))\r\n" + - " @treeView1 = System::Windows::Forms::TreeView.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " @treeView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @treeView1.Name = \"treeView1\"\r\n" + - " treeNode1.Name = \"ChildNode1\"\r\n" + - " treeNode1.Text = \"ChildNode1.Text\"\r\n" + - " treeNode2.Name = \"ChildNode0\"\r\n" + - " treeNode2.Text = \"ChildNode0.Text\"\r\n" + - " treeNode3.Name = \"RootNode0\"\r\n" + - " treeNode3.Text = \"RootNode0.Text\"\r\n" + - " @treeView1.Nodes.AddRange(System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode3]))\r\n" + - " @treeView1.Size = System::Drawing::Size.new(100, 100)\r\n" + - " @treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@treeView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs deleted file mode 100644 index cce4252bfa..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GenerateUserControlWithNullPropertyValueTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that a null property value does not cause a NullReferenceException. - /// - [TestFixture] - public class GenerateUserControlWithNullPropertyValueTests : GenerateUserControlWithNullPropertyValueTestsBase - { - [Test] - public void GeneratedCode() - { - string expectedCode = - "@userControl1 = ICSharpCode::Scripting::Tests::Utils::NullPropertyUserControl.new()\r\n" + - "self.SuspendLayout()\r\n" + - "# \r\n" + - "# userControl1\r\n" + - "# \r\n" + - "@userControl1.FooBar = nil\r\n" + - "@userControl1.Location = System::Drawing::Point.new(0, 0)\r\n" + - "@userControl1.Name = \"userControl1\"\r\n" + - "@userControl1.Size = System::Drawing::Size.new(10, 10)\r\n" + - "@userControl1.TabIndex = 0\r\n" + - "# \r\n" + - "# MainControl\r\n" + - "# \r\n" + - "self.Controls.Add(@userControl1)\r\n" + - "self.Name = \"MainControl\"\r\n" + - "self.Size = System::Drawing::Size.new(200, 300)\r\n" + - "self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedCode, generatedCode); - } - - protected override IScriptingCodeDomSerializer CreateSerializer() - { - return RubyCodeDomSerializerHelper.CreateSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs deleted file mode 100644 index 391c493baf..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/GeneratedControlOrderingTestFixture.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the controls are initialized in the order they were put on the form. - /// The forms designer has them in reverse order in the Controls collection. - /// - [TestFixture] - public class GeneratedControlOrderingTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(284, 264); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - Button button = (Button)host.CreateComponent(typeof(Button), "button1"); - button.Location = new Point(0, 0); - button.Size = new Size(10, 10); - button.Text = "button1"; - button.TabIndex = 0; - button.UseCompatibleTextRendering = false; - form.Controls.Add(button); - - RadioButton radioButton = (RadioButton)host.CreateComponent(typeof(RadioButton), "radioButton1"); - radioButton.Location = new Point(20, 0); - radioButton.Size = new Size(10, 10); - radioButton.Text = "radioButton1"; - radioButton.TabIndex = 1; - radioButton.UseCompatibleTextRendering = false; - form.Controls.Add(radioButton); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = " @button1 = System::Windows::Forms::Button.new()\r\n" + - " @radioButton1 = System::Windows::Forms::RadioButton.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # radioButton1\r\n" + - " # \r\n" + - " @radioButton1.Location = System::Drawing::Point.new(20, 0)\r\n" + - " @radioButton1.Name = \"radioButton1\"\r\n" + - " @radioButton1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @radioButton1.TabIndex = 1\r\n" + - " @radioButton1.Text = \"radioButton1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@button1)\r\n" + - " self.Controls.Add(@radioButton1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs deleted file mode 100644 index d412f75d38..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IgnoreDesignTimePropertiesTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - /// - /// The Ruby form code generator should ignore any design time properties (e.g. Locked) of the form. - /// These are put in the .resx file not the source code. - /// - [TestFixture] - public class IgnoreDesignTimePropertiesTestFixture - { - string expectedCode = " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - string generatedRubyCode; - - /// - /// After a form is loaded onto a DesignSurface this checks that the RubyForm does not try to - /// add design time properties and does not throw a null reference exception. - /// - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void DesignTimePropertyIsIgnoredInGeneratedCode() - { - Assert.AreEqual(expectedCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs deleted file mode 100644 index 88e3ccea48..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerTestFixtureBase.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Base class that tests the RubyDesignerGenerator.InsertEventComponent method. - /// - public class InsertEventHandlerTestFixtureBase - { - protected string file; - protected int position; - protected bool insertedEventHandler; - protected MockTextEditorViewContent mockViewContent; - protected DerivedFormDesignerViewContent viewContent; - protected string fileName = @"C:\Projects\Ruby\mainform.rb"; - protected DerivedRubyDesignerGenerator generator; - protected MockTextEditorOptions textEditorOptions; - - [TestFixtureSetUp] - public void SetUpFixture() - { - textEditorOptions = new MockTextEditorOptions(); - generator = new DerivedRubyDesignerGenerator(textEditorOptions); - mockViewContent = new MockTextEditorViewContent(); - viewContent = new DerivedFormDesignerViewContent(mockViewContent, new MockOpenedFile(fileName)); - generator.Attach(viewContent); - viewContent.DesignerCodeFileContent = GetTextEditorCode(); - - RubyParser parser = new RubyParser(); - ICompilationUnit parserCompilationUnit = parser.Parse(new DefaultProjectContent(), fileName, GetTextEditorCode()); - ParseInformation parseInfo = new ParseInformation(parserCompilationUnit); - generator.ParseInfoToReturnFromParseFileMethod = parseInfo; - - AfterSetUpFixture(); - } - - /// - /// Called at the end of the SetUpFixture method. - /// - public virtual void AfterSetUpFixture() - { - } - - /// - /// Gets the form's code. - /// - protected virtual string GetTextEditorCode() - { - return String.Empty; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs deleted file mode 100644 index 93b26d6cb8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertEventHandlerWithSpaceIndentTestFixture.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyDesignerGenerator uses the text editor properties for indentation when - /// inserting an event handler into the document. - /// - [TestFixture] - public class InsertEventHandlerWithSpaceIndentTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - textEditorOptions.ConvertTabsToSpaces = true; - textEditorOptions.IndentationSize = 4; - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponents()\r\n" + - " end\r\n" + - " \r\n" + - " def InitializeComponents()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.Controls.Add(@button1)\r\n" + - " end\r\n" + - "\r\n" + - " def button1_click(sender, e)\r\n" + - " \r\n" + - " end\r\n" + - "end"; - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent, viewContent.DesignerCodeFileContent); - } - - /// - /// Note that the text editor code already has the - /// statement: - /// - /// "self._button1.Click += button1_click" - /// - /// This is generated by the form designer framework and not - /// by the designer generator. - /// - protected override string GetTextEditorCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponents()\r\n" + - " end\r\n" + - " \r\n" + - " def InitializeComponents()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.Controls.Add(@button1)\r\n" + - " end\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs deleted file mode 100644 index f4249d2d95..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertNewEventHandlerTestFixture.cs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyDesignerGenerator inserts an event handler - /// into the document correctly. - /// - [TestFixture] - public class InsertNewEventHandlerTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = - "class MainForm < System::Windows::Forms::Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\tself.Controls.Add(@button1)\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef button1_click(sender, e)\r\n" + - "\t\t\r\n" + - "\tend\r\n" + - "end\r\n"; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent, viewContent.DesignerCodeFileContent); - } - - protected override string GetTextEditorCode() - { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\tself.Controls.Add(@button1)\r\n" + - "\tend\r\n" + - "end\r\n"; - } - - /// - /// The generator should call the FormDesignerViewContent's - /// MergeFormChanges method to make sure the latest version of the - /// code is in the text editor. - /// - [Test] - public void MergeFormChangesCalled() - { - Assert.IsTrue(viewContent.MergeFormChangesCalled); - } - - [Test] - public void InsertedEventHandlerReturnedTrue() - { - Assert.IsTrue(insertedEventHandler); - } - - [Test] - public void PositionEventHandlerInserted() - { - // The position is actually a line number. So - // it should be set to line 9. - Assert.AreEqual(9, position); - } - - [Test] - public void FileNameSameAsDocumentFileName() - { - Assert.AreEqual(viewContent.DesignerCodeFile.FileName.ToString(), file); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs deleted file mode 100644 index afee5be210..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/InsertSecondEventHandlerTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyDesignerGenerator adds an extra new line between the previous event handler - /// and the new one inserted. - /// - [TestFixture] - public class InsertSecondEventHandlerTestFixture : InsertEventHandlerTestFixtureBase - { - public override void AfterSetUpFixture() - { - MockEventDescriptor mockEventDescriptor = new MockEventDescriptor("Click"); - generator.InsertComponentEvent(null, mockEventDescriptor, "button1_click", String.Empty, out file, out position); - insertedEventHandler = generator.InsertComponentEvent(null, mockEventDescriptor, "button2_click", String.Empty, out file, out position); - } - - [Test] - public void ExpectedCodeAfterEventHandlerInserted() - { - string expectedCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\tself.Controls.Add(@button1)\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef button1_click(sender, e)\r\n" + - "\t\t\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef button2_click(sender, e)\r\n" + - "\t\t\r\n" + - "\tend\r\n" + - "end"; - - Assert.AreEqual(expectedCode, viewContent.DesignerCodeFileContent); - } - - protected override string GetTextEditorCode() - { - return - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponents()\r\n" + - "\tend\r\n" + - "\t\r\n" + - "\tdef InitializeComponents()\r\n" + - "\t\t@button1 = System::Windows::Forms::Button.new()\r\n" + - "\t\tself.Controls.Add(@button1)\r\n" + - "\tend\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFormDesignableTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFormDesignableTestFixture.cs deleted file mode 100644 index 1454f10216..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFormDesignableTestFixture.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the SecondaryDisplayBinding detects that the form - /// is designable: - /// - /// 1) Has an InitializeComponents method. - /// 2) Has a base class of Form. - /// - [TestFixture] - public class IsFormDesignableTestFixture - { - IMethod initializeComponentsMethod; - protected IClass mainFormClass; - ParseInformation parseInfo; - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyParser parser = new RubyParser(); - MockProjectContent mockProjectContent = new MockProjectContent(); - ICompilationUnit compilationUnit = parser.Parse(mockProjectContent, @"C:\Projects\test\MainForm.py", GetRubyCode()); - - parseInfo = new ParseInformation(compilationUnit); - - if (compilationUnit.Classes.Count > 0) { - mainFormClass = compilationUnit.Classes[0]; - initializeComponentsMethod = FormsDesignerSecondaryDisplayBinding.GetInitializeComponents(mainFormClass); - } - } - - [Test] - public void InitializeComponentsIsNotNull() - { - Assert.IsNotNull(initializeComponentsMethod); - } - - [Test] - public void BaseClassIsForm() - { - Assert.IsTrue(FormsDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(mainFormClass)); - } - - [Test] - public void IsDesignable() - { - Assert.IsTrue(FormsDesignerSecondaryDisplayBinding.IsDesignable(parseInfo)); - } - - protected virtual string GetRubyCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - "\r\n" + - " def InitializeComponent()\r\n" + - " end\r\n" + - "end\r\n" + - "\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs deleted file mode 100644 index 374b4db3f4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/IsFullyQualifiedBaseClassFormDesignableTestFixture.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the SecondaryDisplayBinding detects that the form - /// is designable when the base class is fully qualified. - /// - [TestFixture] - public class IsFullyQualifiedBaseClassFormDesignableTestFixture : IsFormDesignableTestFixture - { - protected override string GetRubyCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < System::Windows::Forms::Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - "\r\n" + - " def InitializeComponent()\r\n" + - " end\r\n" + - "end\r\n" + - "\r\n"; - } - - [Test] - public void MainFormClassBaseTypeIsForm() - { - IReturnType baseType = null; - foreach (IReturnType returnType in mainFormClass.BaseTypes) { - if (returnType.Name == "Form") { - baseType = returnType; - break; - } - } - Assert.IsNotNull(baseType); - } - - [Test] - public void MainFormClassBaseTypeFullNameIsSystemWindowsFormsForm() - { - IReturnType baseType = null; - foreach (IReturnType returnType in mainFormClass.BaseTypes) { - if (returnType.FullyQualifiedName == "System.Windows.Forms.Form") { - baseType = returnType; - break; - } - } - Assert.IsNotNull(baseType); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs deleted file mode 100644 index 5324a01703..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAcceptButtonFormTestFixture.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadAcceptButtonFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = @button1\r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(@button1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormHasAcceptButton() - { - Assert.IsNotNull(Form.AcceptButton); - } - - [Test] - public void AcceptButtonPropertyDescriptorObjectMatchesButton() - { - Button button = Form.Controls[0] as Button; - PropertyDescriptor p = TypeDescriptor.GetProperties(Form).Find("AcceptButton", true); - Assert.AreEqual(button, p.GetValue(Form)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs deleted file mode 100644 index 0d14087452..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAccessibleRoleTestFixture.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the Form's AccessibleRole property can be loaded into the designer. - /// - [TestFixture] - public class LoadAccessibleRoleTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AccessibleRole = System::Windows::Forms::AccessibleRole.None\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void AccessibleRoleIsNone() - { - Assert.AreEqual(AccessibleRole.None, Form.AccessibleRole); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAnchorStylesTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAnchorStylesTestFixture.cs deleted file mode 100644 index c59fa62d69..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadAnchorStylesTestFixture.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadAnchorStylesTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Name = \"textBoxName\"\r\n" + - " @textBox1.Anchor = System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom | System::Windows::Forms::AnchorStyles.Left\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Controls.Add(@textBox1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [TestFixtureSetUp] - public new void SetUpFixture() - { - base.SetUpFixture(); - } - - [Test] - public void TextBoxAnchorStyle() - { - AnchorStyles style = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; - TextBox textBox = Form.Controls[0] as TextBox; - Assert.AreEqual(style, textBox.Anchor); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs deleted file mode 100644 index fb062724e0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadBindingNavigatorTestFixture.cs +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the designer load handles the Binding Navigator having separator toolstrips with the same Name - /// property text "bindingNavigatorSeparator" - /// - [TestFixture] - public class LoadBindingNavigatorTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @components = System::ComponentModel::Container.new()\r\n" + - " resources = System::Resources::ResourceManager.new(\"RubyWinFoo.MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " @bindingNavigator1 = System::Windows::Forms::BindingNavigator.new(@components)\r\n" + - " @bindingNavigatorMoveFirstItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigatorMovePreviousItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigatorSeparator = System::Windows::Forms::ToolStripSeparator.new()\r\n" + - " @bindingNavigatorPositionItem = System::Windows::Forms::ToolStripTextBox.new()\r\n" + - " @bindingNavigatorCountItem = System::Windows::Forms::ToolStripLabel.new()\r\n" + - " @bindingNavigatorSeparator1 = System::Windows::Forms::ToolStripSeparator.new()\r\n" + - " @bindingNavigatorMoveNextItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigatorMoveLastItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigatorSeparator2 = System::Windows::Forms::ToolStripSeparator.new()\r\n" + - " @bindingNavigatorAddNewItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigatorDeleteItem = System::Windows::Forms::ToolStripButton.new()\r\n" + - " @bindingNavigator1.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n" + - " @bindingNavigator1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # bindingNavigator1\r\n" + - " # \r\n" + - " @bindingNavigator1.AddNewItem = @bindingNavigatorAddNewItem\r\n" + - " @bindingNavigator1.CountItem = @bindingNavigatorCountItem\r\n" + - " @bindingNavigator1.DeleteItem = @bindingNavigatorDeleteItem\r\n" + - " @bindingNavigator1.Items.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@bindingNavigatorMoveFirstItem,\r\n" + - " @bindingNavigatorMovePreviousItem,\r\n" + - " @bindingNavigatorSeparator,\r\n" + - " @bindingNavigatorPositionItem,\r\n" + - " @bindingNavigatorCountItem,\r\n" + - " @bindingNavigatorSeparator1,\r\n" + - " @bindingNavigatorMoveNextItem,\r\n" + - " @bindingNavigatorMoveLastItem,\r\n" + - " @bindingNavigatorSeparator2,\r\n" + - " @bindingNavigatorAddNewItem,\r\n" + - " @bindingNavigatorDeleteItem]))\r\n" + - " @bindingNavigator1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @bindingNavigator1.MoveFirstItem = @bindingNavigatorMoveFirstItem\r\n" + - " @bindingNavigator1.MoveLastItem = @bindingNavigatorMoveLastItem\r\n" + - " @bindingNavigator1.MoveNextItem = @bindingNavigatorMoveNextItem\r\n" + - " @bindingNavigator1.MovePreviousItem = @bindingNavigatorMovePreviousItem\r\n" + - " @bindingNavigator1.Name = \"bindingNavigator1\"\r\n" + - " @bindingNavigator1.PositionItem = @bindingNavigatorPositionItem\r\n" + - " @bindingNavigator1.Size = System::Drawing::Size.new(343, 25)\r\n" + - " @bindingNavigator1.TabIndex = 0\r\n" + - " @bindingNavigator1.Text = \"bindingNavigator1\"\r\n" + - " # \r\n" + - " # bindingNavigatorMoveFirstItem\r\n" + - " # \r\n" + - " @bindingNavigatorMoveFirstItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorMoveFirstItem.Image = resources.GetObject(\"bindingNavigatorMoveFirstItem.Image\")\r\n" + - " @bindingNavigatorMoveFirstItem.Name = \"bindingNavigatorMoveFirstItem\"\r\n" + - " @bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorMoveFirstItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorMoveFirstItem.Text = \"Move first\"\r\n" + - " # \r\n" + - " # bindingNavigatorMovePreviousItem\r\n" + - " # \r\n" + - " @bindingNavigatorMovePreviousItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorMovePreviousItem.Image = resources.GetObject(\"bindingNavigatorMovePreviousItem.Image\")\r\n" + - " @bindingNavigatorMovePreviousItem.Name = \"bindingNavigatorMovePreviousItem\"\r\n" + - " @bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorMovePreviousItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorMovePreviousItem.Text = \"Move previous\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator\r\n" + - " # \r\n" + - " @bindingNavigatorSeparator.Name = \"bindingNavigatorSeparator\"\r\n" + - " @bindingNavigatorSeparator.Size = System::Drawing::Size.new(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorPositionItem\r\n" + - " # \r\n" + - " @bindingNavigatorPositionItem.AccessibleName = \"Position\"\r\n" + - " @bindingNavigatorPositionItem.AutoSize = false\r\n" + - " @bindingNavigatorPositionItem.Name = \"bindingNavigatorPositionItem\"\r\n" + - " @bindingNavigatorPositionItem.Size = System::Drawing::Size.new(50, 23)\r\n" + - " @bindingNavigatorPositionItem.Text = \"0\"\r\n" + - " @bindingNavigatorPositionItem.ToolTipText = \"Current position\"\r\n" + - " # \r\n" + - " # bindingNavigatorCountItem\r\n" + - " # \r\n" + - " @bindingNavigatorCountItem.Name = \"bindingNavigatorCountItem\"\r\n" + - " @bindingNavigatorCountItem.Size = System::Drawing::Size.new(35, 22)\r\n" + - " @bindingNavigatorCountItem.Text = \"of {0}\"\r\n" + - " @bindingNavigatorCountItem.ToolTipText = \"Total number of items\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator1\r\n" + - " # \r\n" + - " @bindingNavigatorSeparator1.Name = \"bindingNavigatorSeparator\"\r\n" + - " @bindingNavigatorSeparator1.Size = System::Drawing::Size.new(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorMoveNextItem\r\n" + - " # \r\n" + - " @bindingNavigatorMoveNextItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorMoveNextItem.Image = resources.GetObject(\"bindingNavigatorMoveNextItem.Image\")\r\n" + - " @bindingNavigatorMoveNextItem.Name = \"bindingNavigatorMoveNextItem\"\r\n" + - " @bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorMoveNextItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorMoveNextItem.Text = \"Move next\"\r\n" + - " # \r\n" + - " # bindingNavigatorMoveLastItem\r\n" + - " # \r\n" + - " @bindingNavigatorMoveLastItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorMoveLastItem.Image = resources.GetObject(\"bindingNavigatorMoveLastItem.Image\")\r\n" + - " @bindingNavigatorMoveLastItem.Name = \"bindingNavigatorMoveLastItem\"\r\n" + - " @bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorMoveLastItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorMoveLastItem.Text = \"Move last\"\r\n" + - " # \r\n" + - " # bindingNavigatorSeparator2\r\n" + - " # \r\n" + - " @bindingNavigatorSeparator2.Name = \"bindingNavigatorSeparator\"\r\n" + - " @bindingNavigatorSeparator2.Size = System::Drawing::Size.new(6, 25)\r\n" + - " # \r\n" + - " # bindingNavigatorAddNewItem\r\n" + - " # \r\n" + - " @bindingNavigatorAddNewItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorAddNewItem.Image = resources.GetObject(\"bindingNavigatorAddNewItem.Image\")\r\n" + - " @bindingNavigatorAddNewItem.Name = \"bindingNavigatorAddNewItem\"\r\n" + - " @bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorAddNewItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorAddNewItem.Text = \"Add new\"\r\n" + - " # \r\n" + - " # bindingNavigatorDeleteItem\r\n" + - " # \r\n" + - " @bindingNavigatorDeleteItem.DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle.Image\r\n" + - " @bindingNavigatorDeleteItem.Image = resources.GetObject(\"bindingNavigatorDeleteItem.Image\")\r\n" + - " @bindingNavigatorDeleteItem.Name = \"bindingNavigatorDeleteItem\"\r\n" + - " @bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = true\r\n" + - " @bindingNavigatorDeleteItem.Size = System::Drawing::Size.new(23, 22)\r\n" + - " @bindingNavigatorDeleteItem.Text = \"Delete\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(343, 297)\r\n" + - " self.Controls.Add(@bindingNavigator1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Text = \"RubyWinFoo\"\r\n" + - " @bindingNavigator1.clr_member(System::ComponentModel::ISupportInitialize, :EndInit).call()\r\n" + - " @bindingNavigator1.ResumeLayout(false)\r\n" + - " @bindingNavigator1.PerformLayout()\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public CreatedInstance BindingNavigatorSeparator1Instance { - get { return ComponentCreator.CreatedInstances[8]; } - } - - [Test] - public void BindingNavigatorSeparator1ComponentNameIsBindingNavigatorSeparator1() - { - Assert.AreEqual("bindingNavigatorSeparator1", BindingNavigatorSeparator1Instance.Name); - } - - [Test] - public void BindingNavigatorSeparator1ComponentTypeIsToolStripSeparator() - { - Assert.AreEqual("System.Windows.Forms.ToolStripSeparator", BindingNavigatorSeparator1Instance.InstanceType.FullName); - } - - [Test] - public void BindingNavigatorSeparator1SiteNameNameIsBindingNavigatorSeparator1() - { - ToolStripSeparator separator = BindingNavigatorSeparator1Instance.Object as ToolStripSeparator; - Assert.AreEqual("bindingNavigatorSeparator1", separator.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs deleted file mode 100644 index 59b8caf7c7..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadButtonFlatAppearanceTestFixture.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadButtonFlatAppearanceTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.FlatAppearance.BorderColor = System::Drawing::Color.Red\r\n" + - " @button1.FlatAppearance.BorderSize = 2\r\n" + - " @button1.FlatAppearance.MouseDownBackColor = System::Drawing::Color.Blue\r\n" + - " @button1.FlatAppearance.MouseOverBackColor = System::Drawing::Color.Yellow\r\n" + - " @button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = @button1\r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(@button1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public Button Button - { - get { return Form.Controls[0] as Button; } - } - - [Test] - public void ButtonFlatAppearanceBorderSize() - { - Assert.AreEqual(2, Button.FlatAppearance.BorderSize); - } - - [Test] - public void ButtonFlatAppearanceBorderColor() - { - Assert.AreEqual(Color.Red, Button.FlatAppearance.BorderColor); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadColorFromArgbTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadColorFromArgbTestFixture.cs deleted file mode 100644 index c969572501..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadColorFromArgbTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadColorFromArgbTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.BackColor = System::Drawing::Color.FromArgb(10, 190, 0)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormBackColor() - { - Assert.AreEqual(Color.FromArgb(10, 190, 0), Form.BackColor); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs deleted file mode 100644 index f3c1cd3122..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadControlEventHandlerTestFixture.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadControlEventHandlerTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @button2 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button2\r\n" + - " # \r\n" + - " @button2.Location = System::Drawing::Point.new(75, 39)\r\n" + - " @button2.Name = \"button2\"\r\n" + - " @button2.Size = System::Drawing::Size.new(75, 23)\r\n" + - " @button2.TabIndex = 1\r\n" + - " @button2.Text = \"button2\"\r\n" + - " @button2.KeyDown { |sender, e| self.Button2KeyDown(sender, e) }\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Controls.Add(@button2)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public override void BeforeSetUpFixture() - { - base.ComponentCreator.SetEventPropertyDescriptor(new MockPropertyDescriptor("abc", "Button2KeyDown", true)); - } - - public Button GetButton() - { - return Form.Controls[0] as Button; - } - - public EventDescriptor GetButtonKeyDownEventDescriptor() - { - Button button = GetButton(); - return TypeDescriptor.GetEvents(button).Find("KeyDown", true); - } - - public MockPropertyDescriptor GetButtonKeyDownEventPropertyDescriptor() - { - EventDescriptor eventDescriptor = GetButtonKeyDownEventDescriptor(); - return base.ComponentCreator.GetEventProperty(eventDescriptor) as MockPropertyDescriptor; - } - - [Test] - public void PropertyDescriptorSetValueComponentIsForm() - { - Assert.AreEqual(GetButton(), GetButtonKeyDownEventPropertyDescriptor().GetSetValueComponent()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadCursorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadCursorTestFixture.cs deleted file mode 100644 index d139f8ec29..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadCursorTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadCursorTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Cursor = System::Windows::Forms::Cursors.Hand\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormCursorIsHand() - { - Assert.AreEqual(Cursors.Hand, Form.Cursor); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadEventHandlerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadEventHandlerTestFixture.cs deleted file mode 100644 index fde5c55461..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadEventHandlerTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadEventHandlerTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.Load { |sender, e| self.TestFormLoad(sender, e) }\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public override void BeforeSetUpFixture() - { - base.ComponentCreator.SetEventPropertyDescriptor(new MockPropertyDescriptor("abc", "TestFormLoad", true)); - } - - public EventDescriptor GetLoadEventDescriptor() - { - return TypeDescriptor.GetEvents(Form).Find("Load", true); - } - - public MockPropertyDescriptor GetLoadEventPropertyDescriptor() - { - EventDescriptor loadEventDescriptor = GetLoadEventDescriptor(); - return base.ComponentCreator.GetEventProperty(loadEventDescriptor) as MockPropertyDescriptor; - } - - [Test] - public void EventPropertyDescriptorValueSetToEventHandlerMethodName() - { - Assert.AreEqual("TestFormLoad", GetLoadEventPropertyDescriptor().GetValue(Form) as String); - } - - [Test] - public void PropertyDescriptorSetValueComponentIsForm() - { - Assert.AreEqual(Form, GetLoadEventPropertyDescriptor().GetSetValueComponent()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFontTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFontTestFixture.cs deleted file mode 100644 index 1422f1f1be..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFontTestFixture.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadFontTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.Font = System::Drawing::Font.new(\"Times New Roman\", 8.25, System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point, 1)\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormBackColor() - { - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 1); - Assert.AreEqual(font, Form.Font); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormTestFixtureBase.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormTestFixtureBase.cs deleted file mode 100644 index 1ba44d0b58..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormTestFixtureBase.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Reflection; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Designer; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Base class for all LoadFormTestFixture classes. - /// - public class LoadFormTestFixtureBase : LoadFormTestsBase - { - protected override IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return RubyComponentWalkerHelper.CreateComponentWalker(componentCreator); - } - - /// - /// Gets the Ruby code that will be loaded. - /// - public virtual string RubyCode { - get { return String.Empty; } - } - - public override string Code { - get { return RubyCode; } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs deleted file mode 100644 index eaceb57d93..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithBooleanPropertiesSetTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadFormWithBooleanPropertiesSetTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # TestForm\r\n" + - " # \r\n" + - " self.AllowDrop = false\r\n" + - " self.Enabled = false\r\n" + - " self.Name = \"TestForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormEnabledIsFalse() - { - Assert.IsFalse(Form.Enabled); - } - - [Test] - public void FormAllowDropIsFalse() - { - Assert.IsFalse(Form.AllowDrop); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithStatementsBeforeFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithStatementsBeforeFormTestFixture.cs deleted file mode 100644 index 0697e6ec9f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadFormWithStatementsBeforeFormTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Statements before the main form class are parsed by the RubyComponentWalker when - /// they should be ignored. This test fixture checks that only when the InitializeComponent method - /// is found the statements are parsed. - /// - [TestFixture] - public class LoadFormWithStatementsBeforeFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "a = System::Windows::Forms::TextBox.new()\r\n" + - "b = 10\r\n" + - "\r\n" + - "class Foo\r\n" + - " def run()\r\n" + - " @a = System::Windows::Forms::ListViewItem.new()\r\n" + - " end\r\n" + - "end\r\n" + - "\r\n" + - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public CreatedComponent FormComponent { - get { return ComponentCreator.CreatedComponents[0]; } - } - - [Test] - public void MainFormCreated() - { - Assert.IsNotNull(Form); - } - - [Test] - public void NoInstancesCreated() - { - Assert.AreEqual(0, ComponentCreator.CreatedInstances.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs deleted file mode 100644 index 3eb2786820..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedProtectedPanelFormTestFixture.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadInheritedProtectedPanelFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - base.ComponentCreator.AddType("RubyBinding.Tests.Designer.ProtectedPanelDerivedForm", typeof(ProtectedPanelDerivedForm)); - - return - "class MainForm < RubyBinding::Tests::Designer::ProtectedPanelDerivedForm\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System::Drawing::Point.new(10, 15)\r\n" + - " self.panel1.Size = System::Drawing::Size.new(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System::Drawing::Point.new(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(@textBox1)\r\n" + - " self.ResumeLayout(False)\r\n" + - " end\r\n" + - "end"; - } - } - - ProtectedPanelDerivedForm DerivedForm { - get { return Form as ProtectedPanelDerivedForm; } - } - - [Test] - public void PanelLocation() - { - Assert.AreEqual(new Point(10, 15), DerivedForm.PanelLocation); - } - - [Test] - public void PanelSize() - { - Assert.AreEqual(new Size(108, 120), DerivedForm.PanelSize); - } - - [Test] - public void GetProtectedPanelObject() - { - Assert.AreEqual(DerivedForm.GetPanel(), RubyControlFieldExpression.GetInheritedObject("panel1", DerivedForm)); - } - - [Test] - public void GetProtectedPanelObjectIncorrectCase() - { - Assert.AreEqual(DerivedForm.GetPanel(), RubyControlFieldExpression.GetInheritedObject("PANEL1", DerivedForm)); - } - - [Test] - public void GetInheritedObjectPassedNull() - { - Assert.IsNull(RubyControlFieldExpression.GetInheritedObject("panel1", null)); - } - - [Test] - public void GetInheritedPanelObjectFromFieldExpression() - { - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression("self.panel1.Name = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(assignment.Left as AttributeAccess); - - Assert.AreEqual(DerivedForm.GetPanel(), field.GetObject(ComponentCreator)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs deleted file mode 100644 index 290faebf23..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedPublicPanelFormTestFixture.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - class PublicPanelBaseForm : Form - { - public Panel panel1 = new Panel(); - Button button1 = new Button(); - - public PublicPanelBaseForm() - { - button1.Name = "button1"; - - panel1.Name = "panel1"; - panel1.Location = new Point(5, 10); - panel1.Size = new Size(200, 100); - panel1.Controls.Add(button1); - - Controls.Add(panel1); - } - } - - class PublicPanelDerivedForm : PublicPanelBaseForm - { - } - - [TestFixture] - public class LoadInheritedPublicPanelFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - base.ComponentCreator.AddType("RubyBinding.Tests.Designer.PublicPanelDerivedForm", typeof(PublicPanelDerivedForm)); - - return - "class MainForm < RubyBinding::Tests::Designer::PublicPanelDerivedForm\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " self.panel1.Location = System::Drawing::Point.new(10, 15)\r\n" + - " self.panel1.Size = System::Drawing::Size.new(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System::Drawing::Point.new(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(@textBox1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - PublicPanelDerivedForm DerivedForm { - get { return Form as PublicPanelDerivedForm; } - } - - [Test] - public void PanelLocation() - { - Assert.AreEqual(new Point(10, 15), DerivedForm.panel1.Location); - } - - [Test] - public void PanelSize() - { - Assert.AreEqual(new Size(108, 120), DerivedForm.panel1.Size); - } - - [Test] - public void GetPublicPanelObject() - { - Assert.AreEqual(DerivedForm.panel1, RubyControlFieldExpression.GetInheritedObject("panel1", DerivedForm)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs deleted file mode 100644 index c13e443dc3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadInheritedToolTipTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadInheritedToolTipTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - ComponentCreator.AddType("RubyBinding.Tests.Designer.PublicToolTipDerivedForm", typeof(RubyBinding.Tests.Designer.PublicToolTipDerivedForm)); - - return - "class TestForm < RubyBinding::Tests::Designer::PublicToolTipDerivedForm\r\n" + - " def InitializeComponent()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " self.toolTip.SetToolTip(@button1, \"buttonTest\")\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@button1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.toolTip.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormHasToolTip() - { - PublicToolTipDerivedForm form = Form as PublicToolTipDerivedForm; - Assert.AreEqual("test", form.toolTip.GetToolTip(form)); - } - - [Test] - public void ButtonHasToolTip() - { - PublicToolTipDerivedForm form = Form as PublicToolTipDerivedForm; - Assert.AreEqual("buttonTest", form.toolTip.GetToolTip(form.Controls[0])); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadListViewFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadListViewFormTestFixture.cs deleted file mode 100644 index d06ce9996c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadListViewFormTestFixture.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadListViewFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @listView1 = System::Windows::Forms::ListView.new()\r\n" + - " listViewItem1 = System::Windows::Forms::ListViewItem.new()\r\n" + - " listViewItem2 = System::Windows::Forms::ListViewItem.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # listView1\r\n" + - " # \r\n" + - " @listView1.Items.AddRange(System::Array[System::Windows::Forms::ListViewItem].new(\r\n" + - " [listViewItem1,\r\n" + - " listViewItem2]))\r\n" + - " @listView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @listView1.Name = \"listView1\"\r\n" + - " @listView1.Size = System::Drawing::Size.new(204, 104)\r\n" + - " @listView1.TabIndex = 0\r\n" + - " listViewItem1.ToolTipText = \"tooltip1\"\r\n" + - " listViewItem2.ToolTipText = \"tooltip2\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@listView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public ListView ListView { - get { return Form.Controls[0] as ListView; } - } - - public ListViewItem ListViewItem1 { - get { return ListView.Items[0]; } - } - - public ListViewItem ListViewItem2 { - get { return ListView.Items[1]; } - } - - [Test] - public void ListViewAddedToForm() - { - Assert.IsNotNull(ListView); - } - - [Test] - public void ListViewHasTwoItems() - { - Assert.AreEqual(2, ListView.Items.Count); - } - - [Test] - public void ListViewItem1TooltipText() - { - Assert.AreEqual("tooltip1", ListViewItem1.ToolTipText); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs deleted file mode 100644 index 27539a8d01..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalImageResourceTestFixture.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadLocalImageResourceTestFixture : LoadFormTestFixtureBase - { - MockResourceReader reader; - Bitmap bitmap; - - public override string RubyCode { - get { - bitmap = new Bitmap(10, 20); - reader = new MockResourceReader(); - reader.AddResource("pictureBox1.Image", bitmap); - ComponentCreator.SetResourceReader(reader); - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " resources = System::Resources::ResourceManager.new(\"RootNamespace.MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " @pictureBox1 = System::Windows::Forms::PictureBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " @pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " @pictureBox1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @pictureBox1.Name = \"button1\"\r\n" + - " @pictureBox1.Size = System::Drawing::Size.new(10, 10)\r\n" + - " @pictureBox1.TabIndex = 0\r\n" + - " @pictureBox1.Text = \"button1\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(@pictureBox1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n " + - "end"; - } - } - - public PictureBox PictureBox1 { - get { return base.Form.Controls[0] as PictureBox; } - } - - [Test] - public void ResourceReaderRetrievedFromComponentCreator() - { - Assert.IsTrue(ComponentCreator.GetResourceReaderCalled); - } - - [Test] - public void CultureInfoInvariantCulturePassedToGetResourceReader() - { - Assert.AreEqual(CultureInfo.InvariantCulture, ComponentCreator.CultureInfoPassedToGetResourceReader); - } - - [Test] - public void ResourceReaderIsDisposed() - { - Assert.IsTrue(reader.IsDisposed); - } - - [Test] - public void ComponentResourceManagerCreated() - { - CreatedInstance expectedInstance = new CreatedInstance(typeof(ResourceManager), new object[0], "resources", false); - CreatedInstance instance = base.ComponentCreator.CreatedInstances[0]; - Assert.AreEqual(expectedInstance, instance); - } - - [Test] - public void BitmapAssignedToPictureBoxRetrievedFromResourceReader() - { - Assert.IsTrue(Object.Equals(bitmap, PictureBox1.Image)); - } - - [Test] - public void PictureBoxImageIsNotNull() - { - Assert.IsNotNull(PictureBox1.Image); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs deleted file mode 100644 index 72e9a223ab..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadLocalVariablePropertyAssignmentTestFixture.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadLocalVariablePropertyAssignmentTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " button1 = System::Windows::Forms::Button.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.AcceptButton = button1\r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void OneComponentCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedComponents.Count); - } - - [Test] - public void TwoObjectsCreated() - { - Assert.AreEqual(2, ComponentCreator.CreatedInstances.Count); - } - - [Test] - public void ButtonInstance() - { - CreatedInstance expectedInstance = new CreatedInstance(typeof(Button), new object[0], "button1", false); - Assert.AreEqual(expectedInstance, ComponentCreator.CreatedInstances[0]); - } - - [Test] - public void AcceptButtonPropertyIsNotNull() - { - Assert.IsNotNull(Form.AcceptButton); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMenuStripFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMenuStripFormTestFixture.cs deleted file mode 100644 index ce2407480c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMenuStripFormTestFixture.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadMenuStripFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @menuStrip1 = System::Windows::Forms::MenuStrip.new()\r\n" + - " @fileToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @openToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @exitToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @editToolStripMenuItem = System::Windows::Forms::ToolStripMenuItem.new()\r\n" + - " @menuStrip1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # menuStrip1\r\n" + - " # \r\n" + - " @menuStrip1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @menuStrip1.Name = \"menuStrip1\"\r\n" + - " @menuStrip1.Size = System::Drawing::Size.new(200, 24)\r\n" + - " @menuStrip1.TabIndex = 0\r\n" + - " @menuStrip1.Text = \"menuStrip1\"\r\n" + - " @menuStrip1.Items.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@fileToolStripMenuItem,\r\n" + - " @editToolStripMenuItem]))\r\n" + - " # \r\n" + - " # fileToolStripMenuItem\r\n" + - " # \r\n" + - " @fileToolStripMenuItem.Name = \"fileToolStripMenuItem\"\r\n" + - " @fileToolStripMenuItem.Size = System::Drawing::Size.new(37, 20)\r\n" + - " @fileToolStripMenuItem.Text = \"&File\"\r\n" + - " @fileToolStripMenuItem.DropDownItems.AddRange(System.Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@openToolStripMenuItem,\r\n" + - " @exitToolStripMenuItem]))\r\n" + - " # \r\n" + - " # openToolStripMenuItem\r\n" + - " # \r\n" + - " @openToolStripMenuItem.Name = \"openToolStripMenuItem\"\r\n" + - " @openToolStripMenuItem.Size = System::Drawing::Size.new(37, 20)\r\n" + - " @openToolStripMenuItem.Text = \"&Open\"\r\n" + - " # \r\n" + - " # exitToolStripMenuItem\r\n" + - " # \r\n" + - " @exitToolStripMenuItem.Name = \"exitToolStripMenuItem\"\r\n" + - " @exitToolStripMenuItem.Size = System::Drawing::Size.new(37, 20)\r\n" + - " @exitToolStripMenuItem.Text = \"E&xit\"\r\n" + - " # \r\n" + - " # editToolStripMenuItem\r\n" + - " # \r\n" + - " @editToolStripMenuItem.Name = \"editToolStripMenuItem\"\r\n" + - " @editToolStripMenuItem.Size = System::Drawing::Size.new(39, 20)\r\n" + - " @editToolStripMenuItem.Text = \"&Edit\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(@menuStrip1)\r\n" + - " @menuStrip1.ResumeLayout(false)\r\n" + - " @menuStrip1.PerformLayout()\r\n" + - " self.ResumeLayout(False)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public MenuStrip MenuStrip { - get { return Form.Controls[0] as MenuStrip; } - } - - public ToolStripMenuItem FileMenuItem { - get { return MenuStrip.Items[0] as ToolStripMenuItem; } - } - - [Test] - public void MenuStripAddedToForm() - { - Assert.IsNotNull(MenuStrip); - } - - [Test] - public void MenuStripHasTwoItems() - { - Assert.AreEqual(2, MenuStrip.Items.Count); - } - - [Test] - public void MenuStripFirstItemIsFileMenuItem() - { - Assert.AreEqual("fileToolStripMenuItem", FileMenuItem.Name); - } - - [Test] - public void FileMenuItemText() - { - Assert.AreEqual("&File", FileMenuItem.Text); - } - - [Test] - public void MenuStripSecondItemIsEditMenuItem() - { - Assert.AreEqual("editToolStripMenuItem", MenuStrip.Items[1].Name); - } - - [Test] - public void FileMenuItemHasDropDownItems() - { - Assert.AreEqual(2, FileMenuItem.DropDownItems.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMonthCalendarTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMonthCalendarTestFixture.cs deleted file mode 100644 index 0f52ff1c68..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadMonthCalendarTestFixture.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadMonthCalendarTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @monthCalendar1 = System::Windows::Forms::MonthCalendar.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # monthCalendar1\r\n" + - " # \r\n" + - " @monthCalendar1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @monthCalendar1.MonthlyBoldedDates = System::Array[System::DateTime].new(\r\n" + - " [System::DateTime.new(2009, 1, 2, 0, 0, 0, 0),\r\n" + - " System::DateTime.new(0)])\r\n" + - " @monthCalendar1.Name = \"monthCalendar1\"\r\n" + - " @monthCalendar1.SelectionRange = System::Windows::Forms::SelectionRange.new(System::DateTime.new(2009, 8, 4, 0, 0, 0, 0), System::DateTime.new(2009, 8, 5, 0, 0, 0, 0))\r\n" + - " @monthCalendar1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@monthCalendar1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public MonthCalendar Calendar { - get { return Form.Controls[0] as MonthCalendar; } - } - - [Test] - public void MonthlyBoldedDates() - { - DateTime[] expectedDates = new DateTime[] { new DateTime(2009, 1, 2), new DateTime(0) }; - Assert.AreEqual(expectedDates, Calendar.MonthlyBoldedDates); - } - - [Test] - public void SelectionRange() - { - SelectionRange expectedRange = new SelectionRange(new DateTime(2009, 8, 4, 0, 0, 0, 0), new DateTime(2009, 8, 5, 0, 0, 0, 0)); - Assert.AreEqual(expectedRange.ToString(), Calendar.SelectionRange.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadRichTextBoxWithEmptyTextTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadRichTextBoxWithEmptyTextTestFixture.cs deleted file mode 100644 index 1e580b9a0a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadRichTextBoxWithEmptyTextTestFixture.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadRichTextBoxWithEmptyTextTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - "\r\n" + - " def InitializeComponent()\r\n" + - " @richTextBox1 = System::Windows::Forms::RichTextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # richTextBox1\r\n" + - " # \r\n" + - " @richTextBox1.Anchor = System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom | System::Windows::Forms::AnchorStyles.Left | System::Windows::Forms::AnchorStyles.Right\r\n" + - " @richTextBox1.Location = System::Drawing::Point.new(39, 31)\r\n" + - " @richTextBox1.Name = \"richTextBox1\"\r\n" + - " @richTextBox1.Size = System::Drawing::Size.new(297, 208)\r\n" + - " @richTextBox1.TabIndex = 0\r\n" + - " @richTextBox1.Text = \"\"\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(380, 301)\r\n" + - " self.Controls.Add(@richTextBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public RichTextBox RichTextBox { - get { return Form.Controls[0] as RichTextBox; } - } - - [Test] - public void RichTextBoxName() - { - Assert.AreEqual("richTextBox1", RichTextBox.Name); - } - - [Test] - public void RichTextBoxTextIsEmpty() - { - Assert.AreEqual(String.Empty, RichTextBox.Text); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleFormTestFixture.cs deleted file mode 100644 index a3b28a75c3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleFormTestFixture.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadSimpleFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public CreatedComponent FormComponent { - get { return ComponentCreator.CreatedComponents[0]; } - } - - [Test] - public void MainFormCreated() - { - Assert.IsNotNull(Form); - } - - [Test] - public void MainFormName() - { - Assert.AreEqual("MainForm", Form.Name); - } - - [Test] - public void OneComponentCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedComponents.Count); - } - - [Test] - public void ComponentName() - { - Assert.AreEqual("MainForm", FormComponent.Name); - } - - [Test] - public void ComponentType() - { - Assert.AreEqual("System.Windows.Forms.Form", FormComponent.TypeName); - } - - [Test] - public void FormClientSize() - { - Size size = new Size(300, 400); - Assert.AreEqual(size, Form.ClientSize); - } - - [Test] - public void BaseClassTypeNameLookedUp() - { - Assert.AreEqual("System.Windows.Forms.Form", ComponentCreator.TypeNames[0]); - } - - /// - /// The System.Drawing.Size type name should have been looked up by the RubyFormWalker when - /// parsing the InitializeComponent method. Note that this is the second type that is looked up. - /// The first lookup is the base class type. - /// - [Test] - public void TypeNameLookedUp() - { - Assert.AreEqual("System.Drawing.Size", ComponentCreator.TypeNames[1]); - } - - [Test] - public void OneObjectCreated() - { - Assert.AreEqual(1, ComponentCreator.CreatedInstances.Count); - } - - [Test] - public void InstanceType() - { - List args = new List(); - int width = 300; - int height = 400; - args.Add(width); - args.Add(height); - - CreatedInstance expectedInstance = new CreatedInstance(typeof(Size), args, null, false); - Assert.AreEqual(expectedInstance, ComponentCreator.CreatedInstances[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs deleted file mode 100644 index 90510814aa..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSimpleUserControlTestFixture.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadSimpleUserControlTestFixture - { - MockComponentCreator componentCreator = new MockComponentCreator(); - UserControl userControl; - - public string RubyCode { - get { - return "class MainForm < System::Windows::Forms::UserControl\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"userControl1\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyComponentWalker walker = new RubyComponentWalker(componentCreator); - userControl = walker.CreateComponent(RubyCode) as UserControl; - } - - [TestFixtureTearDown] - public void TearDownFixture() - { - userControl.Dispose(); - } - - [Test] - public void UserControlCreated() - { - Assert.IsNotNull(userControl); - } - - [Test] - public void UserControlName() - { - Assert.AreEqual("userControl1", userControl.Name); - } - - [Test] - public void UserControlClientSize() - { - Size size = new Size(300, 400); - Assert.AreEqual(size, userControl.ClientSize); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSplitContainerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSplitContainerTestFixture.cs deleted file mode 100644 index 21973a53d1..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadSplitContainerTestFixture.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadSplitContainerTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @splitContainer1 = System::Windows::Forms::SplitContainer.new()\r\n" + - " @treeView1 = System::Windows::Forms::TreeView.new()\r\n" + - " @propertyGrid1 = System::Windows::Forms::PropertyGrid.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # splitContainer1\r\n" + - " # \r\n" + - " @splitContainer1.Dock = System::Windows::Forms::DockStyle.Fill\r\n" + - " @splitContainer1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @splitContainer1.Name = \"splitContainer1\"\r\n" + - " @splitContainer1.Panel1.Controls.Add(@treeView1)\r\n" + - " @splitContainer1.Panel2.Controls.Add(@propertyGrid1)\r\n" + - " @splitContainer1.Size = System::Drawing::Size.new(284, 264)\r\n" + - " @splitContainer1.SplitterDistance = 94\r\n" + - " @splitContainer1.TabIndex = 0\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " @treeView1.Dock = System::Windows::Forms::DockStyle.Fill\r\n" + - " @treeView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @treeView1.Name = \"treeView1\"\r\n" + - " @treeView1.Size = System::Drawing::Size.new(94, 264)\r\n" + - " @treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # propertyGrid1\r\n" + - " # \r\n" + - " @propertyGrid1.Dock = System::Windows::Forms::DockStyle.Fill\r\n" + - " @propertyGrid1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @propertyGrid1.Name = \"propertyGrid1\"\r\n" + - " @propertyGrid1.Size = System::Drawing::Size.new(186, 264)\r\n" + - " @propertyGrid1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@splitContainer1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - SplitContainer SplitContainer { - get { return Form.Controls[0] as SplitContainer; } - } - - [Test] - public void TreeViewAddedToSplitContainer() - { - Assert.IsInstanceOf(typeof(TreeView), SplitContainer.Panel1.Controls[0]); - } - - [Test] - public void PropertyGridAddedToSplitContainer() - { - Assert.IsInstanceOf(typeof(PropertyGrid), SplitContainer.Panel2.Controls[0]); - } - - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs deleted file mode 100644 index 1617685536..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTableLayoutPanelTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadTableLayoutPanelTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @button1 = System::Windows::Forms::Button.new()\r\n" + - " @checkBox1 = System::Windows::Forms::CheckBox.new()\r\n" + - " @tableLayoutPanel1 = System::Windows::Forms::TableLayoutPanel.new()\r\n" + - " @tableLayoutPanel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # button1\r\n" + - " # \r\n" + - " @button1.Location = System::Drawing::Point.new(3, 3)\r\n" + - " @button1.Name = \"button1\"\r\n" + - " @button1.Size = System::Drawing::Size.new(75, 23)\r\n" + - " @button1.TabIndex = 0\r\n" + - " @button1.Text = \"button1\"\r\n" + - " @button1.UseVisualStyleBackColor = true\r\n" + - " # \r\n" + - " # checkBox1\r\n" + - " # \r\n" + - " @checkBox1.Location = System::Drawing::Point.new(103, 3)\r\n" + - " @checkBox1.Name = \"checkBox1\"\r\n" + - " @checkBox1.Size = System::Drawing::Size.new(94, 24)\r\n" + - " @checkBox1.TabIndex = 1\r\n" + - " @checkBox1.Text = \"checkBox1\"\r\n" + - " @checkBox1.UseVisualStyleBackColor = true\r\n" + - " # \r\n" + - " # tableLayoutPanel1\r\n" + - " # \r\n" + - " @tableLayoutPanel1.ColumnCount = 2\r\n" + - " @tableLayoutPanel1.Controls.Add(@button1)\r\n" + - " @tableLayoutPanel1.Controls.Add(@checkBox1)\r\n" + - " @tableLayoutPanel1.Location = System::Drawing::Point.new(89, 36)\r\n" + - " @tableLayoutPanel1.Name = \"tableLayoutPanel1\"\r\n" + - " @tableLayoutPanel1.RowCount = 2\r\n" + - " @tableLayoutPanel1.Size = System::Drawing::Size.new(200, 100)\r\n" + - " @tableLayoutPanel1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Controls.Add(@tableLayoutPanel1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - TableLayoutPanel TableLayoutPanel { - get { return Form.Controls[0] as TableLayoutPanel; } - } - - [Test] - public void ButtonAddedToTableLayout() - { - Assert.IsInstanceOf(typeof(Button), TableLayoutPanel.Controls[0]); - } - - [Test] - public void CheckBoxAddedToTableLayout() - { - Assert.IsInstanceOf(typeof(CheckBox), TableLayoutPanel.Controls[1]); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs deleted file mode 100644 index 4292408449..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxOnPanelTestFixture.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadTextBoxOnPanelTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @panel1 = System::Windows::Forms::Panel.new()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " @panel1.SuspendLayout()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # panel1\r\n" + - " # \r\n" + - " @panel1.Location = System::Drawing::Point.new(10, 15)\r\n" + - " @panel1.Name = \"panel1\"\r\n" + - " @panel1.Size = System::Drawing::Size.new(100, 120)\r\n" + - " @panel1.TabIndex = 0\r\n" + - " @panel1.Controls.Add(@textBox1)\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Location = System::Drawing::Point.new(5, 5)\r\n" + - " @textBox1.Name = \"textBox1\"\r\n" + - " @textBox1.Size = System::Drawing::Size.new(110, 20)\r\n" + - " @textBox1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.Controls.Add(@panel1)\r\n" + - " @panel1.ResumeLayout(false)\r\n" + - " @panel1.PerformLayout()\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public Panel Panel { - get { return Form.Controls[0] as Panel; } - } - - public TextBox TextBox { - get { return Panel.Controls[0] as TextBox; } - } - - [Test] - public void TextBoxAddedToPanel() - { - Assert.IsNotNull(TextBox); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxTestFixture.cs deleted file mode 100644 index 0fe9be710b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTextBoxTestFixture.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadTextBoxTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Name = \"textBoxName\"\r\n" + - " @textBox1.Location = System::Drawing::Point.new(108, 120)\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.Location = System::Drawing::Point.new(10, 20)\r\n" + - " self.Name = \"form1\"\r\n" + - " self.Controls.Add(@textBox1)\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public TextBox TextBox { - get { return Form.Controls[0] as TextBox; } - } - - [Test] - public void AddedComponentsContainsTextBox() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - - AddedComponent component = new AddedComponent(instance.Object as IComponent, "textBox1"); - Assert.Contains(component, ComponentCreator.AddedComponents); - } - - [Test] - public void TextBoxAddedToForm() - { - Assert.IsNotNull(TextBox); - } - - [Test] - public void TextBoxObjectMatchesObjectAddedToComponentCreator() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - Assert.AreSame(TextBox, instance.Object as TextBox); - } - - [Test] - public void TextBoxName() - { - Assert.AreEqual("textBoxName", TextBox.Name); - } - - [Test] - public void TextBoxLocation() - { - Assert.AreEqual(new Point(108, 120), TextBox.Location); - } - - [Test] - public void CreatedInstancesDoesNotIncludeLocation() - { - Assert.IsNull(ComponentCreator.GetCreatedInstance("Location")); - } - - [Test] - public void FormLocation() - { - Assert.AreEqual(new Point(10, 20), Form.Location); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTimerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTimerTestFixture.cs deleted file mode 100644 index 246690a2f2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTimerTestFixture.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadTimerTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @components = System::ComponentModel::Container.new()\r\n" + - " @timer1 = System::Windows::Forms::Timer.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # timer1\r\n" + - " # \r\n" + - " @timer1.Interval = 1000\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - public CreatedInstance TimerInstance { - get { return ComponentCreator.CreatedInstances[1]; } - } - - [Test] - public void ThreeInstancesCreated() - { - Assert.AreEqual(3, ComponentCreator.CreatedInstances.Count); - } - - - [Test] - public void ComponentName() - { - Assert.AreEqual("timer1", TimerInstance.Name); - } - - [Test] - public void ComponentType() - { - Assert.AreEqual("System.Windows.Forms.Timer", TimerInstance.InstanceType.FullName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadToolTipTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadToolTipTestFixture.cs deleted file mode 100644 index 73d10c0d9e..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadToolTipTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadToolTipTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class TestForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @components = System::ComponentModel::Container.new()\r\n" + - " @toolTip1 = System::Windows::Forms::ToolTip.new(@components)\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(284, 264)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " @toolTip1.SetToolTip(self, \"test\")\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void FormHasToolTip() - { - ToolTip toolTip = (ToolTip)base.ComponentCreator.GetComponent("toolTip1"); - Assert.AreEqual("test",toolTip.GetToolTip(Form)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTreeViewTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTreeViewTestFixture.cs deleted file mode 100644 index 741354841c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadTreeViewTestFixture.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadTreeViewTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " treeNode1 = System::Windows::Forms::TreeNode.new()\r\n" + - " treeNode2 = System::Windows::Forms::TreeNode.new()\r\n" + - " treeNode3 = System::Windows::Forms::TreeNode.new()\r\n" + - " @treeView1 = System::Windows::Forms::TreeView.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # treeView1\r\n" + - " # \r\n" + - " treeNode1.BackColor = System::Drawing::Color.Yellow\r\n" + - " treeNode1.Checked = true\r\n" + - " treeNode1.ForeColor = System::Drawing::Color.FromArgb(0, 64, 64)\r\n" + - " treeNode1.Name = \"RootNode0\"\r\n" + - " treeNode1.NodeFont = System::Drawing::Font.new(\"Times New Roman\", 8.25, System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point, 1)\r\n" + - " treeNode1.Text = \"RootNode0.Text\"\r\n" + - " treeNode1.Nodes.AddRange(System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode2]))\r\n" + - " treeNode2.Name = \"ChildNode0\"\r\n" + - " treeNode2.Text = \"ChildNode0.Text\"\r\n" + - " treeNode2.NodeFont = System::Drawing::Font.new(\"Garamond\", 8.25, System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point, 0)\r\n" + - " treeNode2.Nodes.AddRange(System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode3]))\r\n" + - " treeNode3.Name = \"ChildNode1\"\r\n" + - " treeNode3.Text = \"ChildNode1.Text\"\r\n" + - " @treeView1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @treeView1.Name = \"treeView1\"\r\n" + - " @treeView1.Nodes.AddRange(System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode1]))\r\n" + - " @treeView1.Size = System::Drawing::Size.new(100, 100)\r\n" + - " @treeView1.TabIndex = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@treeView1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " self.PerformLayout()\r\n" + - " end\r\n" + - "end"; - } - } - - public TreeView TreeView { - get { return Form.Controls[0] as TreeView; } - } - - public TreeNode RootTreeNode { - get { return TreeView.Nodes[0]; } - } - - public TreeNode FirstChildTreeNode { - get { return RootTreeNode.Nodes[0]; } - } - - [Test] - public void OneRootNode() - { - Assert.AreEqual(1, TreeView.Nodes.Count); - } - - [Test] - public void RootNodeHasOneChildNode() - { - Assert.AreEqual(1, RootTreeNode.Nodes.Count); - } - - [Test] - public void ChildNodeHasOneChildNode() - { - Assert.AreEqual(1, RootTreeNode.Nodes[0].Nodes.Count); - } - - [Test] - public void RootTreeNodeBackColor() - { - Assert.AreEqual(Color.Yellow, RootTreeNode.BackColor); - } - - [Test] - public void RootTreeNodeForeColor() - { - Assert.AreEqual(Color.FromArgb(0, 64, 64), RootTreeNode.ForeColor); - } - - [Test] - public void RootTreeNodeFontProperty() - { - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 1); - Assert.AreEqual(font, RootTreeNode.NodeFont); - } - - [Test] - public void RootTreeNodeCheckedProperty() - { - Assert.IsTrue(RootTreeNode.Checked); - } - - [Test] - public void ChildTreeNodeFontProperty() - { - Font font = new Font("Garamond", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0); - Assert.AreEqual(font, FirstChildTreeNode.NodeFont); - } - - /// - /// Ensures that we are not creating an instance with a name of NodeFont. - /// - [Test] - public void InstancesCreated() - { - foreach (CreatedInstance instance in ComponentCreator.CreatedInstances) { - if (instance.InstanceType == typeof(Font)) { - Assert.IsNull(instance.Name); - } - } - Assert.IsTrue(ComponentCreator.CreatedInstances.Count > 0); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs deleted file mode 100644 index e81689fb4b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/LoadUserControlWithDoublePropertyTestFixture.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class LoadUserControlWithDoublePropertyTestFixture - { - MockComponentCreator componentCreator = new MockComponentCreator(); - DoublePropertyUserControl userControl; - Form form; - - public string RubyCode { - get { - Type type = typeof(DoublePropertyUserControl); - componentCreator.AddType(type.FullName, type); - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @userControl = ICSharpCode::Scripting::Tests::Utils::DoublePropertyUserControl.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # userControl1\r\n" + - " # \r\n" + - " @userControl.DoubleValue = 0\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Controls.Add(@userControl)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyComponentWalker walker = new RubyComponentWalker(componentCreator); - form = walker.CreateComponent(RubyCode) as Form; - userControl = form.Controls[0] as DoublePropertyUserControl; - } - - [TestFixtureTearDown] - public void TearDownFixture() - { - form.Dispose(); - } - - [Test] - public void UserControlDoubleProperty() - { - Assert.AreEqual(0, userControl.DoubleValue); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MergeFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MergeFormTestFixture.cs deleted file mode 100644 index 4cbc2d1ff3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MergeFormTestFixture.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the GeneratedInitializeComponentMethod class - /// can merge the changes into the text editor. - /// - [TestFixture] - public class MergeFormTestFixture - { - TextDocument document; - MockResourceService resourceService; - MockResourceWriter resourceWriter; - - [TestFixtureSetUp] - public void SetUpFixture() - { - resourceWriter = new MockResourceWriter(); - resourceService = new MockResourceService(); - resourceService.SetResourceWriter(resourceWriter); - - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - RubyParser parser = new RubyParser(); - ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.rb", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(499, 309); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions()); - generator.Merge(host, new AvalonEditDocumentAdapter(document, null), compilationUnit, serializationManager); - } - } - } - - [Test] - public void MergedDocumentText() - { - string expectedText = GetTextEditorCode().Replace(GetTextEditorInitializeComponentMethod(), GetGeneratedInitializeComponentMethod()); - Assert.AreEqual(expectedText, document.Text); - } - - string GetGeneratedCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < System::Windows::Forms::Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\tend\r\n" + - "\t\r\n" + - GetGeneratedInitializeComponentMethod() + - "end\r\n"; - } - - string GetGeneratedInitializeComponentMethod() - { - return "\tdef InitializeComponent()\r\n" + - "\t\tself.SuspendLayout()\r\n" + - "\t\t# \r\n" + - "\t\t# MainForm\r\n" + - "\t\t# \r\n" + - "\t\tself.ClientSize = System::Drawing::Size.new(499, 309)\r\n" + - "\t\tself.Name = \"MainForm\"\r\n" + - "\t\tself.ResumeLayout(false)\r\n" + - "\tend\r\n"; - } - - string GetTextEditorCode() - { - return "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\tend\r\n" + - "\t\r\n" + - GetTextEditorInitializeComponentMethod() + - "end\r\n"; - } - - string GetTextEditorInitializeComponentMethod() - { - return - "\tdef InitializeComponent()\r\n" + - "\t\t\r\n" + - "\tend\r\n"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs deleted file mode 100644 index ff0cd6d043..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/MissingInitializeComponentMethodTestFixture.cs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Globalization; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; -using IronRuby.Compiler.Ast; -using Microsoft.Scripting; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the RubyFormVisitor throws an exception if no InitializeComponent or - /// InitializeComponent method can be found. - /// - [TestFixture] - public class MissingInitializeComponentMethodTestFixture : IComponentCreator - { - string RubyCode = "class MainForm < System::Windows::Forms.Form\r\n" + - " def initialize()\r\n" + - " self.MissingMethod()\r\n" + - " end\r\n" + - "\r\n" + - " def MissingMethod()\r\n" + - " end\r\n" + - "end\r\n"; - [Test] - [ExpectedException(typeof(RubyComponentWalkerException))] - public void RubyFormWalkerExceptionThrown() - { - RubyComponentWalker walker = new RubyComponentWalker(this); - walker.CreateComponent(RubyCode); - Assert.Fail("Exception should have been thrown before this."); - } - - public IComponent CreateComponent(Type componentClass, string name) - { - throw new NotImplementedException(); - } - - public void Add(IComponent component, string name) - { - throw new NotImplementedException(); - } - - public IComponent GetComponent(string name) - { - return null; - } - - public IComponent RootComponent { - get { return null; } - } - - public object CreateInstance(Type type, ICollection arguments, string name, bool addToContainer) - { - throw new NotImplementedException(); - } - - public Type GetType(string typeName) - { - throw new NotImplementedException(); - } - - public PropertyDescriptor GetEventProperty(EventDescriptor e) - { - return null; - } - - public object GetInstance(string name) - { - return null; - } - - public IResourceReader GetResourceReader(CultureInfo info) - { - return null; - } - - public IResourceWriter GetResourceWriter(CultureInfo info) - { - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/NoNewLineAfterInitializeComponentMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/NoNewLineAfterInitializeComponentMethodTestFixture.cs deleted file mode 100644 index 51ab9fd148..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/NoNewLineAfterInitializeComponentMethodTestFixture.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the code can be generated if there is no new line after the InitializeComponent method. - /// - [TestFixture] - public class NoNewLineAfterInitializeComponentMethodTestFixture - { - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - RubyParser parser = new RubyParser(); - ICompilationUnit compilationUnit = parser.Parse(new DefaultProjectContent(), @"test.py", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(UserControl))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - UserControl userControl = (UserControl)host.RootComponent; - userControl.ClientSize = new Size(489, 389); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(userControl); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(userControl, "userControl1"); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null); - RubyDesignerGenerator generator = new RubyDesignerGenerator(new MockTextEditorOptions()); - generator.Merge(host, docAdapter, compilationUnit, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MyUserControl < UserControl\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef InitializeComponent()\r\n" + - "\t\tself.SuspendLayout()\r\n" + - "\t\t# \r\n" + - "\t\t# userControl1\r\n" + - "\t\t# \r\n" + - "\t\tself.Name = \"userControl1\"\r\n" + - "\t\tself.Size = System::Drawing::Size.new(489, 389)\r\n" + - "\t\tself.ResumeLayout(false)\r\n" + - "\tend\r\n" + - "end"; - - Assert.AreEqual(expectedCode, document.Text); - } - - /// - /// No new line after the pass statement for InitializeComponent method. - /// - string GetTextEditorCode() - { - return - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MyUserControl < UserControl\r\n" + - "\tdef initialize()\r\n" + - "\t\tself.InitializeComponent()\r\n" + - "\tend\r\n" + - "\r\n" + - "\tdef InitializeComponent()\r\n" + - "\tend\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs deleted file mode 100644 index 5414fb731a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/ProjectRootNamespacePassedToMergeTestFixture.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using ICSharpCode.SharpDevelop.Refactoring; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using AvalonEdit = ICSharpCode.AvalonEdit; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the the project's root namespace is passed to the RubyDesigner - /// - [TestFixture] - public class ProjectRootNamespacePassedToMergeTestFixture - { - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - AvalonEdit.TextEditor textEditor = new AvalonEdit.TextEditor(); - document = textEditor.Document; - textEditor.Text = GetTextEditorCode(); - - RubyParser parser = new RubyParser(); - MockProjectContent projectContent = new MockProjectContent(); - MockProject project = new MockProject(); - project.RootNamespace = "RootNamespace"; - projectContent.Project = project; - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"test.py", document.Text); - - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor namePropertyDescriptor = descriptors.Find("Name", false); - namePropertyDescriptor.SetValue(form, "MainForm"); - - // Add picture box - PictureBox pictureBox = (PictureBox)host.CreateComponent(typeof(PictureBox), "pictureBox1"); - pictureBox.Location = new Point(0, 0); - pictureBox.Image = new Bitmap(10, 10); - pictureBox.Size = new Size(100, 120); - pictureBox.TabIndex = 0; - form.Controls.Add(pictureBox); - - MockTextEditorOptions options = new MockTextEditorOptions(); - options.ConvertTabsToSpaces = true; - options.IndentationSize = 4; - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - AvalonEditDocumentAdapter docAdapter = new AvalonEditDocumentAdapter(document, null); - RubyDesignerGenerator generator = new RubyDesignerGenerator(options); - generator.Merge(host, docAdapter, compilationUnit, serializationManager); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - " \r\n" + - " def InitializeComponent()\r\n" + - " resources = System::Resources::ResourceManager.new(\"RootNamespace.MainForm\", System::Reflection::Assembly.GetEntryAssembly())\r\n" + - " @pictureBox1 = System::Windows::Forms::PictureBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # pictureBox1\r\n" + - " # \r\n" + - " @pictureBox1.Image = resources.GetObject(\"pictureBox1.Image\")\r\n" + - " @pictureBox1.Location = System::Drawing::Point.new(0, 0)\r\n" + - " @pictureBox1.Name = \"pictureBox1\"\r\n" + - " @pictureBox1.Size = System::Drawing::Size.new(100, 120)\r\n" + - " @pictureBox1.TabIndex = 0\r\n" + - " @pictureBox1.TabStop = false\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Controls.Add(@pictureBox1)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - - Assert.AreEqual(expectedCode, document.Text, document.Text); - } - - string GetTextEditorCode() - { - return - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - " \r\n" + - " def InitializeComponent()\r\n" + - " end\r\n" + - "end"; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs deleted file mode 100644 index 4f31c1c830..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RemoveMainMenuStripFromFormTestFixture.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.ComponentModel.Design; -using System.ComponentModel.Design.Serialization; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// When a MenuStrip is added to a form and then removed the Ruby designer generates code - /// for the form's MainMenuStrip property even though the MenuStrip has been removed. - /// - [TestFixture] - public class RemoveMainMenuStripFromFormTestFixture - { - string generatedRubyCode; - - [TestFixtureSetUp] - public void SetUpFixture() - { - using (DesignSurface designSurface = new DesignSurface(typeof(Form))) { - IDesignerHost host = (IDesignerHost)designSurface.GetService(typeof(IDesignerHost)); - IEventBindingService eventBindingService = new MockEventBindingService(host); - Form form = (Form)host.RootComponent; - form.ClientSize = new Size(200, 300); - - PropertyDescriptorCollection descriptors = TypeDescriptor.GetProperties(form); - PropertyDescriptor descriptor = descriptors.Find("Name", false); - descriptor.SetValue(form, "MainForm"); - - // Add menu strip. - MenuStrip menuStrip = (MenuStrip)host.CreateComponent(typeof(MenuStrip), "menuStrip1"); - menuStrip.Text = "menuStrip1"; - menuStrip.TabIndex = 0; - menuStrip.Location = new Point(0, 0); - form.Controls.Add(menuStrip); - - descriptor = descriptors.Find("MainMenuStrip", false); - descriptor.SetValue(form, menuStrip); - - form.Controls.Remove(menuStrip); - host.Container.Remove(menuStrip); - - DesignerSerializationManager serializationManager = new DesignerSerializationManager(host); - using (serializationManager.CreateSession()) { - RubyCodeDomSerializer serializer = new RubyCodeDomSerializer(" "); - generatedRubyCode = serializer.GenerateInitializeComponentMethodBody(host, serializationManager, String.Empty, 1); - } - } - } - - [Test] - public void GeneratedCode() - { - string expectedCode = - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(200, 300)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n"; - - Assert.AreEqual(expectedCode, generatedRubyCode, generatedRubyCode); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyBaseClassTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyBaseClassTests.cs deleted file mode 100644 index 388630d62b..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyBaseClassTests.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class RubyBaseClassTests - { - [Test] - public void FormBaseClass() - { - string code = "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual("System.Windows.Forms.Form", RubyComponentWalker.GetBaseClassName(classDef)); - } - - [Test] - public void NoBaseClass() - { - string code = "class MainForm\r\n" + - " def InitializeComponent()\r\n" + - " end\r\n" + - "end"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual(String.Empty, RubyComponentWalker.GetBaseClassName(classDef)); - } - - [Test] - public void UnqualifiedBaseClass() - { - string code = "class MainForm < Form\r\n" + - " def InitializeComponent()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # MainForm\r\n" + - " # \r\n" + - " self.ClientSize = System::Drawing::Size.new(300, 400)\r\n" + - " self.Name = \"MainForm\"\r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - - ClassDefinition classDef = GetClassDefinition(code); - - Assert.AreEqual("Form", RubyComponentWalker.GetBaseClassName(classDef)); - } - - ClassDefinition GetClassDefinition(string code) - { - RubyParser parser = new RubyParser(); - SourceUnitTree unit = parser.CreateAst(@"test.rb", new StringTextBuffer(code)); - return unit.Statements.First as ClassDefinition; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeBuilderTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeBuilderTests.cs deleted file mode 100644 index 0d02c3aa30..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeBuilderTests.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class RubyCodeBuilderTests - { - RubyCodeBuilder codeBuilder; - - [SetUp] - public void Init() - { - codeBuilder = new RubyCodeBuilder(); - codeBuilder.IndentString = "\t"; - } - - [Test] - public void TrimEnd() - { - codeBuilder.Append("abc"); - codeBuilder.AppendLine(); - codeBuilder.Append("def"); - codeBuilder.AppendLine(); - codeBuilder.TrimEnd(); - Assert.AreEqual("abc\r\ndef", codeBuilder.ToString()); - } - - [Test] - public void AppendLineIfPreviousLineIsEndStatementAppendsNewLineIfPreviousLineIsEndStatement() - { - codeBuilder.AppendIndentedLine("end"); - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - - Assert.AreEqual("end\r\n\r\n", codeBuilder.ToString()); - } - - [Test] - public void AppendLineIfPreviousLineIsEndStatementeIgnoresCaseOfEndStatement() - { - codeBuilder.AppendIndentedLine("END"); - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - - Assert.AreEqual("END\r\n\r\n", codeBuilder.ToString()); - } - - [Test] - public void AppendLineIfPreviousLineIsEndStatementIgnoresWhitespaceWhenCheckingForEndStatement() - { - string line = " \t end \t "; - codeBuilder.AppendIndentedLine(line); - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - - Assert.AreEqual(line + "\r\n\r\n", codeBuilder.ToString()); - } - - [Test] - public void AppendLineIfPreviousLineIsEndStatementDoesNotAppendNewLineIfPreviousLineDoesNotContainEndStatement() - { - codeBuilder.AppendIndentedLine("abc"); - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - - Assert.AreEqual("abc\r\n", codeBuilder.ToString()); - } - - [Test] - public void AppendLineIfPreviousLineIsEndStatementAppendsDoesNotAppendNewLineIfNoPreviousLine() - { - codeBuilder.AppendLineIfPreviousLineIsEndStatement(); - Assert.AreEqual(String.Empty, codeBuilder.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeDeserializerTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeDeserializerTests.cs deleted file mode 100644 index f7d8ea4967..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyCodeDeserializerTests.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class RubyCodeDeserializerTests - { - RubyCodeDeserializer deserializer; - MockComponentCreator componentCreator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - componentCreator = new MockComponentCreator(); - deserializer = new RubyCodeDeserializer(componentCreator); - } - - [Test] - [ExpectedException(typeof(ArgumentNullException))] - public void NullIronRubyAstNode() - { - Expression expression = null; - deserializer.Deserialize(expression); - } - - [Test] - public void UnknownTypeName() - { - string rubyCode = "self.Cursors = System::Windows::Forms::UnknownType.AppStarting"; - Assert.IsNull(DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void UnknownPropertyName() - { - string rubyCode = "self.Cursors = System::Windows::Forms::Cursors.UnknownCursorsProperty"; - Assert.IsNull(DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void UnknownTypeNameInCallExpression() - { - string rubyCode = "self.Cursors = System::Windows::Forms::UnknownType.CreateDefaultCursor()"; - Assert.IsNull(DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void DeserializeColor() - { - string rubyCode = "@button1.FlatAppearance.BorderColor = System::Drawing::Color.Red"; - Assert.AreEqual(Color.Red, DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void EnumReturnedInArgumentsPassedToConstructor() - { - string rubyCode = "self.Font = System::Drawing::Font.new(\"Times New Roman\", System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point)"; - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(rubyCode); - - List expectedArgs = new List(); - expectedArgs.Add("Times New Roman"); - expectedArgs.Add(FontStyle.Regular); - expectedArgs.Add(GraphicsUnit.Point); - - List args = deserializer.GetArguments(assignment.Right as MethodCall); - - Assert.AreEqual(expectedArgs, args); - } - - [Test] - public void EnumBitwiseOr() - { - string rubyCode = "self.textBox1.Anchor = System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom"; - - AnchorStyles expectedStyles = AnchorStyles.Top | AnchorStyles.Bottom; - Assert.AreEqual(expectedStyles, DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void MultipleEnumBitwiseOr() - { - string rubyCode = "self.textBox1.Anchor = System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom | System::Windows::Forms::AnchorStyles.Left"; - - AnchorStyles expectedStyles = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; - Assert.AreEqual(expectedStyles, DeserializeRhsAssignment(rubyCode)); - } - - [Test] - public void DeserializeNameExpression() - { - string rubyCode = "self.Items = self"; - Assert.IsNull(DeserializeRhsAssignment(rubyCode)); - } - - /// - /// Deserializes the right hand side of the assignment. - /// - object DeserializeRhsAssignment(string rubyCode) - { - return deserializer.Deserialize(RubyParserHelper.GetSimpleAssignmentExpression(rubyCode).Right); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyControlFieldExpressionTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyControlFieldExpressionTests.cs deleted file mode 100644 index 58ce64f065..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyControlFieldExpressionTests.cs +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class RubyControlFieldExpressionTests - { - [Test] - public void HasPrefixTest() - { - Assert.AreEqual("a", RubyControlFieldExpression.GetPrefix("a.b")); - } - - [Test] - public void NoDotHasPrefixTest() - { - Assert.AreEqual("a", RubyControlFieldExpression.GetPrefix("a")); - } - - [Test] - public void GetVariableName() - { - Assert.AreEqual("abc", RubyControlFieldExpression.GetVariableName("@abc")); - } - - [Test] - public void VariableNameHasOnlyAtSymbol() - { - Assert.AreEqual(String.Empty, RubyControlFieldExpression.GetVariableName("@")); - } - - [Test] - public void VariableNameIsEmpty() - { - Assert.AreEqual(String.Empty, RubyControlFieldExpression.GetVariableName(String.Empty)); - } - - [Test] - public void FullMemberExpression() - { - MethodCall call = RubyParserHelper.GetMethodCall("self.a.b.Add()"); - Assert.AreEqual("self.a.b.Add", RubyControlFieldExpression.GetMemberName(call)); - } - - [Test] - public void NullMemberExpression() - { - Assert.AreEqual(String.Empty, RubyControlFieldExpression.GetMemberName(null)); - } - - [Test] - public void RubyControlFieldExpressionEquals() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.textBox1.Name = \"abc\""); - RubyControlFieldExpression field1 = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - expression = RubyParserHelper.GetSimpleAssignmentExpression("self.textBox1.Name = \"def\""); - RubyControlFieldExpression field2 = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.AreEqual(field1, field2); - } - - [Test] - public void NullPassedToRubyControlFieldExpressionEquals() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.textBox1.Name = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - Assert.IsFalse(field.Equals(null)); - } - - [Test] - public void MethodName() - { - string code = "self.menuItem.Items.Add(@fileMenuItem)"; - MethodCall expression = RubyParserHelper.GetMethodCall(code); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression); - AssertAreEqual(field, "menuItem", "Items", "Add", "self.menuItem.Items"); - } - - [Test] - public void MethodNameWithNoVariableName() - { - string code = "self.Items.Add(@fileMenuItem)"; - MethodCall methodCall = RubyParserHelper.GetMethodCall(code); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(methodCall); - AssertAreEqual(field, String.Empty, "Items", "Add", "self.Items"); - } - - [Test] - public void SetToolTipMethodCall() - { - string code = "@toolTip1.SetToolTip(self, \"Test\")"; - MethodCall expression = RubyParserHelper.GetMethodCall(code); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression); - AssertAreEqual(field, "toolTip1", String.Empty, "SetToolTip", "@toolTip1"); - } - - [Test] - public void GetMemberNames() - { - string[] expected = new string[] { "a", "b" }; - string code = "a.b = 0"; - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(code); - Assert.AreEqual(expected, RubyControlFieldExpression.GetMemberNames(assignment.Left as AttributeAccess)); - } - - [Test] - public void GetMemberNamesForButtonPropertyReference() - { - string[] expected = new string[] { "@button1", "Location" }; - string code = "@button1.Location = System::Drawing::Point.new(0, 0)"; - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(code); - Assert.AreEqual(expected, RubyControlFieldExpression.GetMemberNames(assignment.Left as AttributeAccess)); - } - - [Test] - public void GetMemberNamesForFormClientSizePropertyReference() - { - string[] expected = new string[] { "self", "ClientSize" }; - string code = "self.ClientSize = System::Drawing::Size.new(300, 400)"; - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(code); - Assert.AreEqual(expected, RubyControlFieldExpression.GetMemberNames(assignment.Left as AttributeAccess)); - } - - [Test] - public void GetMemberNamesForColorReference() - { - string[] expected = new string[] { "System", "Drawing", "Color", "Red" }; - string code = "self.BackColor = System::Drawing::Color.Red"; - SimpleAssignmentExpression assignment = RubyParserHelper.GetSimpleAssignmentExpression(code); - Assert.AreEqual(expected, RubyControlFieldExpression.GetMemberNames(assignment.Right as MethodCall)); - } - - [Test] - public void GetObjectInMethodCall() - { - string RubyCode = "@menuStrip1.Items.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@fileToolStripMenuItem,\r\n" + - " @editToolStripMenuItem]))"; - - MethodCall call = RubyParserHelper.GetMethodCall(RubyCode); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(call); - - using (MenuStrip menuStrip = new MenuStrip()) { - MockComponentCreator creator = new MockComponentCreator(); - creator.Add(menuStrip, "menuStrip1"); - Assert.AreSame(menuStrip.Items, field.GetMember(creator)); - } - } - - [Test] - public void GetObjectForUnknownComponent() - { - string RubyCode = "@menuStrip1.SuspendLayout()"; - - MethodCall call = RubyParserHelper.GetMethodCall(RubyCode); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(call); - - using (MenuStrip menuStrip = new MenuStrip()) { - MockComponentCreator creator = new MockComponentCreator(); - creator.Add(menuStrip, "unknown"); - Assert.IsNull(field.GetMember(creator)); - } - } - - [Test] - public void GetInstanceObjectInMethodCall() - { - string RubyCode = "treeNode1.Nodes.AddRange(System::Array[System::Windows::Forms::TreeNode].new(\r\n" + - " [treeNode2]))"; - - MethodCall callExpression = RubyParserHelper.GetMethodCall(RubyCode); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(callExpression); - - TreeNode treeNode1 = new TreeNode(); - TreeNode treeNode2 = new TreeNode(); - MockComponentCreator creator = new MockComponentCreator(); - creator.AddInstance(treeNode1, "treeNode1"); - creator.AddInstance(treeNode2, "treeNode2"); - object member = field.GetMember(creator); - Assert.AreSame(treeNode1.Nodes, member); - } - - [Test] - public void GetObjectInMethodCallFromSpecifiedObject() - { - string RubyCode = "self.Controls.AddRange(System::Array[System::Windows::Forms::ToolStripItem].new(\r\n" + - " [@fileToolStripMenuItem,\r\n" + - " @editToolStripMenuItem]))"; - - MethodCall callExpression = RubyParserHelper.GetMethodCall(RubyCode); - - using (Form form = new Form()) { - Assert.AreSame(form.Controls, RubyControlFieldExpression.GetMember(form, callExpression)); - } - } - - [Test] - public void LocalVariableInAssignment() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("listViewItem1.TooltipText = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - RubyControlFieldExpression expectedField = new RubyControlFieldExpression("TooltipText", "listViewItem1", String.Empty, "listViewItem1.TooltipText"); - Assert.AreEqual(expectedField, field); - } - - [Test] - public void LocalVariableCreatingNewInstance() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("listViewItem1 = System::Windows::Forms.ListViewItem.new()"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as LocalVariable); - - RubyControlFieldExpression expectedField = new RubyControlFieldExpression(String.Empty, "listViewItem1", String.Empty, "listViewItem1"); - Assert.AreEqual(expectedField, field); - } - - [Test] - public void LocalVariableMethodCall() - { - string code = - "listViewItem1 = System::Windows::Forms::ListViewItem.new()\r\n" + - "listViewItem1.CallMethod()\r\n"; - - MethodCall expression = RubyParserHelper.GetLastExpression(code) as MethodCall; - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression); - - RubyControlFieldExpression expectedField = new RubyControlFieldExpression(String.Empty, String.Empty, "CallMethod", "listViewItem1"); - Assert.AreEqual(expectedField, field); - } - - [Test] - public void LocalVariableIsNotSelfReference() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("listViewItem1.TooltipText = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - Assert.IsFalse(field.IsSelfReference); - } - - [Test] - public void FieldIsSelfReference() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.listView1.TooltipText = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - Assert.IsTrue(field.IsSelfReference); - } - - [Test] - public void PrivateClassVariableIsSelfReference() - { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("@listView1.TooltipText = \"abc\""); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - Assert.IsTrue(field.IsSelfReference); - } - - [Test] - public void GetButtonObjectForSelfReference() - { - using (Button button = new Button()) { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.button1.Size = System::Drawing::Size.new(10, 10)"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.AreEqual(button, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonObject() - { - using (Button button = new Button()) { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("@button1.Size = System::Drawing::Size.new(10, 10)"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.AreEqual(button, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonFlatAppearanceObjectForSelfReference() - { - using (Button button = new Button()) { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.button1.FlatAppearance.BorderSize = 3"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.AreEqual(button.FlatAppearance, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetButtonFlatAppearanceObject() - { - using (Button button = new Button()) { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("@button1.FlatAppearance.BorderSize = 3"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.AreEqual(button.FlatAppearance, field.GetObjectForMemberName(button)); - } - } - - [Test] - public void GetInvalidTwoLevelDeepButtonPropertyDescriptorForSelfReference() - { - using (Button button = new Button()) { - SimpleAssignmentExpression expression = RubyParserHelper.GetSimpleAssignmentExpression("self.button1.InvalidProperty.BorderSize = 3"); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression.Left as AttributeAccess); - - Assert.IsNull(field.GetObjectForMemberName(button)); - } - } - - [Test] - public void NullPropertyValueConversion() - { - using (Form form = new Form()) { - PropertyDescriptor descriptor = TypeDescriptor.GetProperties(form).Find("Text", true); - Assert.IsNull(RubyControlFieldExpression.ConvertPropertyValue(descriptor, null)); - } - } - - [Test] - public void ClrMemberMethodCallIsConvertedToActualMemberNames() - { - string code = - "@pictureBox1.clr_member(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n"; - - MethodCall expression = RubyParserHelper.GetMethodCall(code); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression); - - RubyControlFieldExpression expectedField = new RubyControlFieldExpression(String.Empty, "pictureBox1", "BeginInit", "@pictureBox1"); - Assert.AreEqual(expectedField, field); - } - - [Test] - public void UpperCaseClrMemberMethodCallIsConvertedToActualMemberNames() - { - string code = - "@pictureBox1.CLR_MEMBER(System::ComponentModel::ISupportInitialize, :BeginInit).call()\r\n"; - - MethodCall expression = RubyParserHelper.GetMethodCall(code); - RubyControlFieldExpression field = RubyControlFieldExpression.Create(expression); - - RubyControlFieldExpression expectedField = new RubyControlFieldExpression(String.Empty, "pictureBox1", "BeginInit", "@pictureBox1"); - Assert.AreEqual(expectedField, field); - } - - - void AssertAreEqual(RubyControlFieldExpression field, string variableName, string memberName, string methodName, string fullMemberName) - { - string expected = "Variable: " + variableName + " Member: " + memberName + " Method: " + methodName + " FullMemberName: " + fullMemberName; - string actual = "Variable: " + field.VariableName + " Member: " + field.MemberName + " Method: " + field.MethodName + " FullMemberName: " + field.FullMemberName; - Assert.AreEqual(expected, actual, actual); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerGeneratorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerGeneratorTestFixture.cs deleted file mode 100644 index dc67ce947c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerGeneratorTestFixture.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using System.ComponentModel; -using System.IO; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - [TestFixture] - public class RubyDesignerGeneratorTestFixture - { - RubyDesignerGenerator generator; - - [SetUp] - public void Init() - { - MockTextEditorOptions options = new MockTextEditorOptions(); - generator = new RubyDesignerGenerator(options); - } - - [Test] - public void GetMethodReplaceRegion() - { - MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes(); - DomRegion bodyRegion = new DomRegion(0, 4, 1, 4); - method.BodyRegion = bodyRegion; - DomRegion expectedRegion = new DomRegion(bodyRegion.BeginLine + 1, 1, bodyRegion.EndLine, 1); - DomRegion region = generator.GetBodyRegionInDocument(method); - - Assert.AreEqual(expectedRegion, region); - } - - [Test] - public void GenerateEventHandlerWithEmptyMethodBody() - { - string eventHandler = generator.CreateEventHandler("button1_click", String.Empty, "\t"); - string expectedEventHandler = - "\tdef button1_click(sender, e)\r\n" + - "\t\t\r\n" + - "\tend"; - Assert.AreEqual(expectedEventHandler, eventHandler); - } - - [Test] - public void GenerateEventHandlerWithNullMethodBody() - { - string eventHandler = generator.CreateEventHandler("button2_click", null, String.Empty); - string expectedEventHandler = - "def button2_click(sender, e)\r\n" + - "\t\r\n" + - "end"; - Assert.AreEqual(expectedEventHandler, eventHandler); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerLoaderProviderTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerLoaderProviderTestFixture.cs deleted file mode 100644 index a4093e45dc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyDesignerLoaderProviderTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.ComponentModel.Design.Serialization; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyDesignerLoaderProvider class. - /// - [TestFixture] - public class RubyDesignerLoaderProviderTestFixture - { - RubyDesignerLoaderProvider provider; - RubyDesignerGenerator generator; - - [TestFixtureSetUp] - public void SetUpFixture() - { - provider = new RubyDesignerLoaderProvider(); - generator = new RubyDesignerGenerator(null); - } - - [Test] - public void RubyDesignerLoaderCreated() - { - DesignerLoader loader = provider.CreateLoader(generator); - using (IDisposable disposable = loader as IDisposable) { - Assert.IsInstanceOf(typeof(RubyDesignerLoader), loader); - } - } - - [Test] - public void CodeDomProviderIsNull() - { - Assert.IsNull(generator.CodeDomProvider); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyPropertyAssignmentToStringTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyPropertyAssignmentToStringTests.cs deleted file mode 100644 index bdf621f603..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/RubyPropertyAssignmentToStringTests.cs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Drawing; -using System.Globalization; -using System.Windows.Forms; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests the RubyPropertyValueAssignment class which generates the Ruby code for - /// the rhs of a property value assignment. - /// - [TestFixture] - public class RubyPropertyAssignmentToStringTests - { - [Test] - public void ConvertCustomColorToString() - { - Color customColor = Color.FromArgb(0, 192, 10); - Assert.AreEqual("System::Drawing::Color.FromArgb(0, 192, 10)", RubyPropertyValueAssignment.ToString(customColor)); - } - - [Test] - public void FontToString() - { - CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; - try { - System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("de-DE"); - Font font = new Font("Times New Roman", 8.25F, FontStyle.Regular, GraphicsUnit.Point, 0); - Assert.AreEqual("System::Drawing::Font.new(\"Times New Roman\", 8.25, System::Drawing::FontStyle.Regular, System::Drawing::GraphicsUnit.Point, 0)", - RubyPropertyValueAssignment.ToString(font)); - } finally { - System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; - } - } - - [Test] - public void SizeFToString() - { - SizeF sizeF = new SizeF(4, 10); - Assert.AreEqual("System::Drawing::SizeF.new(4, 10)", RubyPropertyValueAssignment.ToString(sizeF)); - } - - [Test] - public void AnchorStyleToString() - { - AnchorStyles anchorStyle = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - string expectedText = "System::Windows::Forms::AnchorStyles.Top | System::Windows::Forms::AnchorStyles.Bottom | System::Windows::Forms::AnchorStyles.Left | System::Windows::Forms::AnchorStyles.Right"; - Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(anchorStyle)); - } - - [Test] - public void AnchorStyleNoneToString() - { - AnchorStyles anchorStyle = AnchorStyles.None; - string expectedText = "System::Windows::Forms::AnchorStyles.None"; - Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(anchorStyle)); - } - - /// - /// Nested type will have a full name including a "+", for example, SpecialFolder type has a full name of: - /// - /// System.Environment+SpecialFolder - /// - /// So the RubyPropertyValueAssignment needs to replace the "+" with a ".". - /// - [Test] - public void SystemEnvironmentSpecialFolderNestedTypeToString() - { - Environment.SpecialFolder folder = Environment.SpecialFolder.ProgramFiles; - string expectedText = "System::Environment::SpecialFolder.ProgramFiles"; - Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(folder)); - } - - /// - /// Ensures that when the user types in "\t" the code for a string property in the forms designer - /// the actual string is generated is "\\t". - /// - [Test] - public void BackslashCharactersEncodedInStrings() - { - string text = @"c:\temp"; - string expectedText = "\"c:\\\\temp\""; - Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(text)); - } - - [Test] - public void DoubleQuoteCharactersEncodedInStrings() - { - string text = "c:\\te\"mp"; - string expectedText = "\"c:\\\\te\\\"mp\""; - Assert.AreEqual(expectedText, RubyPropertyValueAssignment.ToString(text)); - } - - [Test] - public void DefaultCursorToString() - { - Assert.AreEqual("System::Windows::Forms::Cursors.Default", RubyPropertyValueAssignment.ToString(Cursors.Default)); - } - - [Test] - public void NullConversion() - { - Assert.AreEqual("nil", RubyPropertyValueAssignment.ToString(null)); - } - - [Test] - public void CharConversion() - { - Assert.AreEqual("\"*\"", RubyPropertyValueAssignment.ToString('*')); - } - - [Test] - public void BoolConversion() - { - Assert.AreEqual("true", RubyPropertyValueAssignment.ToString(true)); - } - - [Test] - public void StringConversion() - { - string s = "abc"; - Assert.AreEqual("\"abc\"", RubyPropertyValueAssignment.ToString(s)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs deleted file mode 100644 index 098a7d97e8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/TextBoxNotAddedToFormTestFixture.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.IO; -using System.Windows.Forms; - -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// When a text box is not added to the form's Control collection in InitializeComponent then: - /// - /// 1) Text box should not be added to the form's Control collection when the form is created. - /// 2) Text box should be registered with the designer via the IComponentCreator.Add method. - /// 3) Text box should be created via the IComponentCreator.CreateInstance method. - /// - [TestFixture] - public class TextBoxNotAddedToFormTestFixture : LoadFormTestFixtureBase - { - public override string RubyCode { - get { - return - "class MainForm < System::Windows::Forms::Form\r\n" + - " def InitializeComponent()\r\n" + - " @textBox1 = System::Windows::Forms::TextBox.new()\r\n" + - " self.SuspendLayout()\r\n" + - " # \r\n" + - " # textBox1\r\n" + - " # \r\n" + - " @textBox1.Name = \"textBox1\"\r\n" + - " # \r\n" + - " # form1\r\n" + - " # \r\n" + - " self.ResumeLayout(false)\r\n" + - " end\r\n" + - "end"; - } - } - - [Test] - public void AddedComponentsContainsTextBox() - { - CreatedInstance instance = ComponentCreator.GetCreatedInstance(typeof(TextBox)); - - AddedComponent c = new AddedComponent(instance.Object as IComponent, "textBox1"); - Assert.Contains(c, ComponentCreator.AddedComponents); - } - - [Test] - public void TextBoxIsNotAddedToForm() - { - Assert.AreEqual(0, Form.Controls.Count); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/UnknownTypeTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/UnknownTypeTestFixture.cs deleted file mode 100644 index 6b0e7dbf08..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Designer/UnknownTypeTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Drawing; -using System.IO; -using System.Resources; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using IronRuby.Compiler.Ast; -using Microsoft.Scripting; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Designer -{ - /// - /// Tests that the RubyFormWalker throws a RubyFormWalkerException if a unknown type is used in the - /// form. - /// - [TestFixture] - public class UnknownTypeTestFixture - { - [TestFixtureSetUp] - public void SetUpFixture() - { - ResourceManager rm = new ResourceManager("RubyBinding.Tests.Strings", GetType().Assembly); - ResourceService.RegisterNeutralStrings(rm); - } - - [Test] - public void SelfAssignmentWithUnknownTypeRhs() - { - string RubyCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < System::Windows::Forms::Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n "+ - "\r\n" + - " def InitializeComponent()\r\n" + - " self.ClientSize = Unknown::Type(10)\r\n" + - " end\r\n" + - "end"; - - try { - RubyComponentWalker walker = new RubyComponentWalker(new MockComponentCreator()); - walker.CreateComponent(RubyCode); - Assert.Fail("Exception should have been thrown before this."); - } catch (RubyComponentWalkerException ex) { - string expectedMessage = String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), "Unknown.Type"); - Assert.AreEqual(expectedMessage, ex.Message); - } - } - - [Test] - public void LocalVariableAssignmentWithUnknownTypeRhs() - { - string RubyCode = - "require \"System.Windows.Forms\"\r\n" + - "\r\n" + - "class MainForm < System::Windows::Forms::Form\r\n" + - " def initialize()\r\n" + - " self.InitializeComponent()\r\n" + - " end\r\n" + - "\r\n" + - " def InitializeComponent()\r\n" + - " abc = Unknown::Type(10)\r\n" + - " end\r\n" + - "end"; - - try { - RubyComponentWalker walker = new RubyComponentWalker(new MockComponentCreator()); - walker.CreateComponent(RubyCode); - Assert.Fail("Exception should have been thrown before this."); - } catch (RubyComponentWalkerException ex) { - string expectedMessage = String.Format(StringParser.Parse("${res:ICSharpCode.PythonBinding.UnknownTypeName}"), "Unknown.Type"); - Assert.AreEqual(expectedMessage, ex.Message); - } - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTests.cs deleted file mode 100644 index cee54fb679..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/DebugRunRubyCommandTests.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Debugging; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Gui -{ - [TestFixture] - public class DebugRubyCommandTests - { - MockDebugger debugger; - RunDebugRubyCommand command; - - [SetUp] - public void Init() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.rb"); - - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - options.RubyFileName = @"C:\IronRuby\ir.exe"; - - debugger = new MockDebugger(); - command = new RunDebugRubyCommand(workbench, options, debugger); - command.Run(); - } - - [Test] - public void Run_RubyFileOpen_DebuggerStartMethodCalled() - { - bool startMethodCalled = debugger.StartMethodCalled; - Assert.IsTrue(startMethodCalled); - } - - [Test] - public void Run_RubyFileOpen_ProcessInfoFileNameContainsPathToIronRubyConsole() - { - string fileName = debugger.ProcessStartInfo.FileName; - string expectedFileName = @"C:\IronRuby\ir.exe"; - - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void Run_RubyFileOpen_ProcessInfoArgsHasDebugArgument() - { - string arguments = debugger.ProcessStartInfo.Arguments; - string expectedArguments = "--disable-gems -D \"test.rb\""; - - Assert.AreEqual(expectedArguments, arguments); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyFormattingStrategyTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyFormattingStrategyTests.cs deleted file mode 100644 index 85e07163db..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyFormattingStrategyTests.cs +++ /dev/null @@ -1,700 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.AvalonEdit; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Editor.AvalonEdit; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Gui -{ - [TestFixture] - public class RubyFormattingStrategyTests - { - TextEditor textEditor; - RubyFormattingStrategy formattingStrategy; - AvalonEditTextEditorAdapter textEditorAdapter; - - void CreateFormattingStrategy() - { - MockTextEditorOptions textEditorOptions = new MockTextEditorOptions(); - textEditorOptions.IndentationSize = 4; - textEditor = new TextEditor(); - textEditor.Options = textEditorOptions; - - textEditorAdapter = new AvalonEditTextEditorAdapter(textEditor); - - formattingStrategy = new RubyFormattingStrategy(); - } - - [Test] - public void IndentLine_NewMethodDefinitionOnPreviousLine_NextLineIsIndented() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def newMethod\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def newMethod\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_NewMethodDefinitionWithBracketsOnPreviousLine_NextLineIsIndented() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def newMethod()\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def newMethod()\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_NewClassDefinitionOnPreviousLine_NextLineIsIndented() - { - CreateFormattingStrategy(); - - textEditor.Text = - "class MyClass\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "class MyClass\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_PrintStatementOnPreviousLineSoNoExtraIndentationRequired_NextLineIndentedToSameLevelAsPreviousLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "\tprint 'abc'\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "\tprint 'abc'\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ReturnValueStatementOnPreviousLine_DecreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\treturn 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\treturn 0\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ReturnStatementOnPreviousLine_DecreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\treturn\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\treturn\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ReturnStatementOnPreviousLineWithNoIndentOnPreviousLine_NextLineIsNotIndented() - { - CreateFormattingStrategy(); - - textEditor.Text = - "return\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "return\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotReturnOnPreviousLine_NextLineIndentedToSameLevelAsPreviousLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "\treturnValue\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "\treturnValue\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RaiseStatementWithObjectOnPreviousLine_DecreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\traise 'a'\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\traise 'a'\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RaiseStatementOnPreviousLine_DecreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\traise\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\traise\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotRaiseStatementOnPreviousLine_NextLineIsIndentedToSameLevelAsPreviousLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\traiseThis\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\traiseThis\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_BreakStatementOnPreviousLine_DecreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\tbreak\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\tbreak\r\n" + - ""; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_StatementIsNotBreakStatementOnPreviousLine_LineIsIndentedToSameLevelAsPreviousLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "def method1\r\n" + - "\tbreakThis\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "def method1\r\n" + - "\tbreakThis\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_IfThenStatementOnPreviousLine_IndentIncreasedOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "if i > 0 then\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "if i > 0 then\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_IfStatementOnPreviousLine_IndentIncreasedOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "if i > 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "if i > 0\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ElseStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "else\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "else\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ElseIfStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "elsif i > 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "elsif i > 0\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_LoopStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "loop do\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "loop do\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_UnlessStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "unless i > 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "unless i > 0\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_UntilStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "until i > 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "until i > 0\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ForStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "for i in 1..5\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "for i in 1..5\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_DoStatementAtEndOfPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "expr do\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "expr do\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_OpenCurlyBraceAtEndOfPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "expr {\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "expr {\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_BeginStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "begin\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "begin\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RescueStatementWithExceptionOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "rescue Exception => ex\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "rescue Exception => ex\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_RescueStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "rescue\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "rescue\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_EnsureStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "ensure\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "ensure\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_ModuleStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "module Foo\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "module Foo\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_CaseWhenStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "case num\r\n" + - "\twhen 0\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(3); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "case num\r\n" + - "\twhen 0\r\n" + - "\t\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_CaseStatementOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "case num\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "case num\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void IndentLine_CaseStatementInMiddleOnPreviousLine_IncreasesIndentOnNextLine() - { - CreateFormattingStrategy(); - - textEditor.Text = - "value = case num\r\n" + - ""; - - IDocumentLine line = textEditorAdapter.Document.GetLine(2); - formattingStrategy.IndentLine(textEditorAdapter, line); - string text = textEditor.Text; - - string expectedText = - "value = case num\r\n" + - "\t"; - - Assert.AreEqual(expectedText, text); - } - - [Test] - public void SurroundSelectionWithComment_CursorOnFirstLineNothingSelected_CommentsFirstLine() - { - CreateFormattingStrategy(); - - textEditor.Text = "print 'hello'"; - formattingStrategy.SurroundSelectionWithComment(textEditorAdapter); - string text = textEditor.Text; - - string expectedText = "#print 'hello'"; - - Assert.AreEqual(expectedText, text); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyOptionsPanelTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyOptionsPanelTestFixture.cs deleted file mode 100644 index 862cd61b42..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RubyOptionsPanelTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Windows.Forms; -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Gui.OptionPanels; -using NUnit.Framework; - -namespace RubyBinding.Tests.Gui -{ - /// - /// Tests the RubyOptionsPanel. - /// - [TestFixture] - public class RubyOptionsPanelTestFixture - { - RubyOptionsPanel optionsPanel; - Properties properties; - RubyAddInOptions options; - TextBox fileNameTextBox; - TextBox rubyLibraryPathTextBox; - - [SetUp] - public void SetUp() - { - properties = new Properties(); - options = new RubyAddInOptions(properties); - options.RubyFileName = @"C:\Ruby\ir.exe"; - options.RubyLibraryPath = @"C:\Ruby\lib"; - optionsPanel = new RubyOptionsPanel(options); - optionsPanel.LoadPanelContents(); - fileNameTextBox = (TextBox)optionsPanel.ControlDictionary["rubyFileNameTextBox"]; - rubyLibraryPathTextBox = (TextBox)optionsPanel.ControlDictionary["rubyLibraryPathTextBox"]; - } - - [TearDown] - public void TearDown() - { - optionsPanel.Dispose(); - } - - [Test] - public void RubyFileNameDisplayed() - { - Assert.AreEqual(options.RubyFileName, fileNameTextBox.Text); - } - - [Test] - public void RubyLibraryPathDisplayed() - { - Assert.AreEqual(options.RubyLibraryPath, rubyLibraryPathTextBox.Text); - } - - [Test] - public void PanelIsOptionsPanel() - { - Assert.IsNotNull(optionsPanel as XmlFormsOptionPanel); - } - - [Test] - public void SavingOptionsUpdatesRubyFileName() - { - string fileName = @"C:\Program Files\IronRuby\ir.exe"; - fileNameTextBox.Text = fileName; - optionsPanel.StorePanelContents(); - Assert.AreEqual(fileName, options.RubyFileName); - } - - [Test] - public void SavingOptionsUpdatesRubyLibraryPath() - { - string path = @"c:\Program Files\Python\lib"; - rubyLibraryPathTextBox.Text = path; - optionsPanel.StorePanelContents(); - Assert.AreEqual(path, options.RubyLibraryPath); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RunRubyCommandTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RunRubyCommandTests.cs deleted file mode 100644 index e473a80127..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Gui/RunRubyCommandTests.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Gui -{ - /// - /// Tests that the RunRubyCommand class runs the Ruby console - /// passing the filename of the Ruby script active in SharpDevelop. - /// - [TestFixture] - public class RunRubyCommandTests - { - MockDebugger debugger; - RunRubyCommand command; - - [SetUp] - public void Init() - { - MockWorkbench workbench = MockWorkbench.CreateWorkbenchWithOneViewContent(@"C:\Projects\test.rb"); - - Properties p = new Properties(); - RubyAddInOptions options = new RubyAddInOptions(p); - options.RubyFileName = @"C:\IronRuby\ir.exe"; - - debugger = new MockDebugger(); - command = new RunRubyCommand(workbench, options, debugger); - command.Run(); - } - - [Test] - public void Run_RubyFileOpen_RubyCommandIsAbstractCommand() - { - AbstractCommand abstractCommand = command as AbstractCommand; - Assert.IsNotNull(abstractCommand); - } - - [Test] - public void Run_RubyFileOpen_DebuggerStartWithoutDebuggingMethodCalled() - { - bool startCalled = debugger.StartWithoutDebuggingMethodCalled; - Assert.IsTrue(startCalled); - } - - [Test] - public void Run_RubyFileOpen_ProcessInfoFileNameIsIronRubyConsole() - { - string fileName = debugger.ProcessStartInfo.FileName; - string expectedFileName = "cmd.exe"; - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void Run_RubyFileOpen_ProcessInfoArgsContainsFileNameActiveInTextEditor() - { - string arguments = debugger.ProcessStartInfo.Arguments; - string expectedArguments = "/c \"\"C:\\IronRuby\\ir.exe\" --disable-gems \"test.rb\"\" & pause"; - - Assert.AreEqual(expectedArguments, arguments); - } - - [Test] - public void Run_RubyFileOpen_WorkingDirectoryIsSameDirectoryAsFileBeingRun() - { - string directory = debugger.ProcessStartInfo.WorkingDirectory; - string expectedDirectory = @"C:\Projects"; - Assert.AreEqual(expectedDirectory, directory); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassMethodWithBodyTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassMethodWithBodyTestFixture.cs deleted file mode 100644 index fc45e581b3..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassMethodWithBodyTestFixture.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassMethodWithBodyTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "class Test\r\n" + - "\tdef foo\r\n" + - "\t\tputs 'test'\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - // Get folds. - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 1) { - methodFold = folds[1]; - } - } - } - - [Test] - public void MethodName() - { - Assert.AreEqual("foo", method.Name); - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 11; - int endLine = 4; - int endColumn = 5; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - /// - /// The method region does not include the body. - /// - [Test] - public void MethodRegion() - { - int startLine = 2; - int startColumn = 2; - int endLine = 2; - int endColumn = 11; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.Region.ToString()); - } - - [Test] - public void MethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\t\tputs 'test'\r\n\tend", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithBaseClassTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithBaseClassTestFixture.cs deleted file mode 100644 index f385384d92..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithBaseClassTestFixture.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Tests that a base class is added to the class. - /// - [TestFixture] - public class ParseClassWithBaseClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string Ruby = "class Test < Base\r\n" + - "\tdef foo(i)\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", Ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void HasBaseClass() - { - IReturnType matchedBaseType = null; - foreach (IReturnType baseType in c.BaseTypes) { - if (baseType.Name == "Base") { - matchedBaseType = baseType; - break; - } - } - Assert.IsNotNull(matchedBaseType); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs deleted file mode 100644 index a5cf7ae0fc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithCtorTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassWithCtorTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold; - FoldingSection classFold; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "class Test\r\n" + - "\tdef initialize\r\n" + - "\t\tputs 'test'\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - // Get folds. - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 1) { - classFold = folds[0]; - methodFold = folds[1]; - } - } - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 18; - int endLine = 4; - int endColumn = 5; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - [Test] - public void MethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\t\tputs 'test'\r\n\tend", textInsideFold); - } - - [Test] - public void MethodIsConstructor() - { - Assert.IsTrue(method.IsConstructor); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithNewLineBeforeMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithNewLineBeforeMethodTestFixture.cs deleted file mode 100644 index f4f8c7670f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithNewLineBeforeMethodTestFixture.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassWithNewLineBeforeMethodTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold = null; - FoldingSection classFold = null; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "class Test\r\n" + - "\r\n" + - "\tdef foo\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - // Get folds. - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 0) { - classFold = folds[0]; - } - if (folds.Count > 1) { - methodFold = folds[1]; - } - } - } - - [Test] - public void ClassBodyRegion() - { - int startLine = 1; - int startColumn = 11; - int endLine = 5; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - /// - /// The class declaration region needs to extend up to and - /// including the colon. - /// - [Test] - public void ClassRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 5; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 3; - int startColumn = 11; // IronRuby parser includes the as part of the method parameters. - int endLine = 4; - int endColumn = 5; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - /// - /// The method region does not include the body. - /// - [Test] - public void MethodRegion() - { - int startLine = 3; - int startColumn = 2; - int endLine = 3; - int endColumn = 11; // IronRuby parser includes the as part of the method parameters - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.Region.ToString()); - } - - [Test] - public void MethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\tend", textInsideFold); - } - - [Test] - public void ClassFoldMarkerInnerText() - { - string textInsideFold = document.GetText(classFold.StartOffset, classFold.Length); - Assert.AreEqual("\r\n\r\n\tdef foo\r\n\tend\r\nend", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithSingleMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithSingleMethodTestFixture.cs deleted file mode 100644 index f47dc57336..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseClassWithSingleMethodTestFixture.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseClassWithMethodTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold; - FoldingSection classFold; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "class Test\r\n" + - "\tdef foo\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - // Get folds. - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 0) { - classFold = folds[0]; - } - if (folds.Count > 1) { - methodFold = folds[1]; - } - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void ClassName() - { - Assert.AreEqual("Test", c.Name); - } - - [Test] - public void ClassBodyRegion() - { - int startLine = 1; - int startColumn = 11; - int endLine = 4; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - /// - /// The class declaration region needs to extend up to and - /// including the colon. - /// - [Test] - public void ClassRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 4; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - - [Test] - public void MethodName() - { - Assert.AreEqual("foo", method.Name); - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 11; // IronRuby parser includes the "()" part of the method parameters even if it does not exist. - int endLine = 3; - int endColumn = 5; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - /// - /// The method region does not include the body. - /// - [Test] - public void MethodRegion() - { - int startLine = 2; - int startColumn = 2; - int endLine = 2; - int endColumn = 11; // IronRuby parser includes the "()" part of the method parameters even if it does not exist. - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.Region.ToString()); - } - - [Test] - public void MethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(methodFold.StartOffset, methodFold.Length); - Assert.AreEqual("\r\n\tend", textInsideFold); - } - - [Test] - public void MethodIsNotConstructor() - { - Assert.IsFalse(method.IsConstructor); - } - - [Test] - public void MethodIsPublic() - { - ModifierEnum modifiers = ModifierEnum.Public; - Assert.AreEqual(modifiers, method.Modifiers); - } - - [Test] - public void ClassFoldMarkerInnerText() - { - string textInsideFold = document.GetText(classFold.StartOffset, classFold.Length); - Assert.AreEqual("\r\n\tdef foo\r\n\tend\r\nend", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseInvalidRubyCodeTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseInvalidRubyCodeTestFixture.cs deleted file mode 100644 index ebaf3036b0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseInvalidRubyCodeTestFixture.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Tests that the rubyparser does not throw an exception - /// when the ruby code is invalid. - /// - [TestFixture] - public class ParseInvalidRubyCodeTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "class Class1\r\n" + - " @\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - } - - [Test] - public void CompilationUnitIsNotNull() - { - Assert.IsNotNull(compilationUnit); - } - - [Test] - public void FileNameSet() - { - Assert.AreEqual(@"C:\test.rb", compilationUnit.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithOptionalParametersTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithOptionalParametersTestFixture.cs deleted file mode 100644 index 843ee27d08..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithOptionalParametersTestFixture.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseMethodWithOptionalParametersTestFixture - { - IMethod method; - IParameter parameterA; - IParameter parameterB; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string Ruby = "class Test\r\n" + - "\tdef foo(a = 1, b = 'test')\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"C:\test.rb", Ruby); - if (compilationUnit.Classes.Count > 0) { - IClass c = compilationUnit.Classes[0]; - method = c.Methods[0]; - if (method.Parameters.Count > 1) { - parameterA = method.Parameters[0]; - parameterB = method.Parameters[1]; - } - } - } - - [Test] - public void MethodHasTwoParameters() - { - Assert.AreEqual(2, method.Parameters.Count); - } - - [Test] - public void FirstParameterIsSender() - { - Assert.AreEqual("a", parameterA.Name); - } - - [Test] - public void SecondParameterIsEventArgs() - { - Assert.AreEqual("b", parameterB.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithParametersTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithParametersTestFixture.cs deleted file mode 100644 index 34e58ad57f..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodWithParametersTestFixture.cs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseMethodWithParametersTestFixture - { - IMethod method; - IParameter senderParameter; - IParameter eventArgsParameter; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string Ruby = "class Test\r\n" + - "\tdef foo(sender, e)\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - ICompilationUnit compilationUnit = parser.Parse(projectContent, @"C:\test.rb", Ruby); - if (compilationUnit.Classes.Count > 0) { - IClass c = compilationUnit.Classes[0]; - method = c.Methods[0]; - if (method.Parameters.Count > 1) { - senderParameter = method.Parameters[0]; - eventArgsParameter = method.Parameters[1]; - } - } - } - - [Test] - public void MethodHasTwoParameters() - { - Assert.AreEqual(2, method.Parameters.Count); - } - - [Test] - public void FirstParameterIsSender() - { - Assert.AreEqual("sender", senderParameter.Name); - } - - [Test] - public void SecondParameterIsEventArgs() - { - Assert.AreEqual("e", eventArgsParameter.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs deleted file mode 100644 index 4be1d82623..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseMethodsWithNoClassTestFixture.cs +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Support folding when no classes are defined. - /// - [TestFixture] - public class ParseMethodsWithNoClassTestFixture - { - ICompilationUnit compilationUnit; - FoldingSection fooMethodFold; - FoldingSection barMethodFold; - IClass globalClass; - IMethod fooMethod; - IMethod barMethod; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = - "def foo\r\n" + - "end\r\n" + - "\r\n" + - "def bar(i)\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - - if (compilationUnit.Classes.Count > 0) { - globalClass = compilationUnit.Classes[0]; - if (globalClass.Methods.Count > 1) { - fooMethod = globalClass.Methods[0]; - barMethod = globalClass.Methods[1]; - } - } - - // Get folds. - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 1) { - fooMethodFold = folds[0]; - barMethodFold = folds[1]; - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void GlobalClassName() - { - Assert.AreEqual("test", globalClass.Name); - } - - [Test] - public void GlobalClassHasTwoMethods() - { - Assert.AreEqual(2, globalClass.Methods.Count); - } - - [Test] - public void FooMethodName() - { - Assert.AreEqual("foo", fooMethod.Name); - } - - [Test] - public void BarMethodName() - { - Assert.AreEqual("bar", barMethod.Name); - } - - [Test] - public void FooMethodDefaultReturnType() - { - Assert.AreEqual(globalClass, fooMethod.ReturnType.GetUnderlyingClass()); - } - - [Test] - public void BarMethodDefaultReturnType() - { - Assert.AreEqual(globalClass, barMethod.ReturnType.GetUnderlyingClass()); - } - - [Test] - public void FooMethodDeclaringType() - { - Assert.AreEqual(globalClass, fooMethod.DeclaringType); - } - - [Test] - public void FooMethodBodyRegion() - { - int startLine = 1; - int startColumn = 10; - int endLine = 2; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), fooMethod.BodyRegion.ToString()); - } - - [Test] - public void FooMethodRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 1; - int endColumn = 10; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), fooMethod.Region.ToString()); - } - - [Test] - public void BarMethodBodyRegion() - { - int startLine = 4; - int startColumn = 11; - int endLine = 5; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), barMethod.BodyRegion.ToString()); - } - - [Test] - public void BarMethodRegion() - { - int startLine = 4; - int startColumn = 1; - int endLine = 4; - int endColumn = 11; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), barMethod.Region.ToString()); - } - - [Test] - public void BarMethodHasOneParameter() - { - Assert.AreEqual(1, barMethod.Parameters.Count); - } - - [Test] - public void FooMethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(fooMethodFold.StartOffset, fooMethodFold.Length); - Assert.AreEqual("\r\nend", textInsideFold); - } - - [Test] - public void BarMethodFoldMarkerInnerText() - { - string textInsideFold = document.GetText(barMethodFold.StartOffset, barMethodFold.Length); - Assert.AreEqual("\r\nend", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseModuleTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseModuleTestFixture.cs deleted file mode 100644 index e20ec0bae2..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseModuleTestFixture.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using ICSharpCode.AvalonEdit.AddIn; -using ICSharpCode.AvalonEdit.Document; -using ICSharpCode.AvalonEdit.Editing; -using ICSharpCode.AvalonEdit.Folding; -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - [TestFixture] - public class ParseModuleTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - IMethod method; - FoldingSection methodFold; - FoldingSection moduleFold; - TextDocument document; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string ruby = "module Test\r\n" + - "\tdef foo\r\n" + - "\tend\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - if (c.Methods.Count > 0) { - method = c.Methods[0]; - } - - TextArea textArea = new TextArea(); - document = new TextDocument(); - textArea.Document = document; - textArea.Document.Text = ruby; - - ParserFoldingStrategy foldingStrategy = new ParserFoldingStrategy(textArea); - - ParseInformation parseInfo = new ParseInformation(compilationUnit); - foldingStrategy.UpdateFoldings(parseInfo); - List folds = new List(foldingStrategy.FoldingManager.AllFoldings); - - if (folds.Count > 0) { - moduleFold = folds[0]; - } - if (folds.Count > 1) { - methodFold = folds[1]; - } - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - /// - /// Module is mapped to a class. - /// - [Test] - public void ModuleName() - { - Assert.AreEqual("Test", c.Name); - } - - [Test] - public void ModuleBodyRegion() - { - int startLine = 1; - int startColumn = 12; - int endLine = 4; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - /// - /// The module declaration region needs to extend up to and - /// including the colon. - /// - [Test] - public void ModuleRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 4; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - - [Test] - public void MethodName() - { - Assert.AreEqual("foo", method.Name); - } - - [Test] - public void MethodBodyRegion() - { - int startLine = 2; - int startColumn = 11; // IronRuby parser includes the "()" part of the method parameters even if it does not exist. - int endLine = 3; - int endColumn = 5; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.BodyRegion.ToString()); - } - - /// - /// The method region does not include the body. - /// - [Test] - public void MethodRegion() - { - int startLine = 2; - int startColumn = 2; - int endLine = 2; - int endColumn = 11; // IronRuby parser includes the "()" part of the method parameters even if it does not exist. - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), method.Region.ToString()); - } - - [Test] - public void ModuleFoldMarkerInnerText() - { - string textInsideFold = document.GetText(moduleFold.StartOffset, moduleFold.Length); - Assert.AreEqual("\r\n\tdef foo\r\n\tend\r\nend", textInsideFold); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireFollowedByCommentTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireFollowedByCommentTestFixture.cs deleted file mode 100644 index d207909946..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireFollowedByCommentTestFixture.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// A string of the form "require #" would cause a null reference exception since the ruby ast walker tries - /// to use the MethodCall's Argument which is null. - /// - [TestFixture] - public class ParseRequireFollowedByCommentTestFixture - { - [Test] - public void ParseDoesNotThrowNullReferenceException() - { - string ruby = "require #"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - ICompilationUnit unit = null; - - Assert.DoesNotThrow(delegate { unit = parser.Parse(projectContent, @"C:\test.rb", ruby); }); - Assert.IsNotNull(unit); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireTestFixture.cs deleted file mode 100644 index 6888ae5cb6..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseRequireTestFixture.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Tests that import statements are added to the compilation - /// unit's Using property. - /// - [TestFixture] - public class ParseRequireTestFixture - { - ICompilationUnit compilationUnit; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string Ruby = "require \"System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\""; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\test.rb", Ruby); - } - - [Test] - public void OneUsing() - { - Assert.AreEqual(1, compilationUnit.UsingScope.Usings.Count); - } - - [Test] - public void UsingSystem() - { - Assert.AreEqual("System.Windows.Forms", compilationUnit.UsingScope.Usings[0].Usings[0]); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseSingleClassTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseSingleClassTestFixture.cs deleted file mode 100644 index f63766faef..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/ParseSingleClassTestFixture.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Tests that the RubyParser class has a class in the returned - /// CompilationUnit. - /// - [TestFixture] - public class ParseSingleClassTestFixture - { - ICompilationUnit compilationUnit; - IClass c; - - [TestFixtureSetUp] - public void SetUpFixture() - { - string Ruby = "class Test\r\n" + - "end"; - - DefaultProjectContent projectContent = new DefaultProjectContent(); - RubyParser parser = new RubyParser(); - compilationUnit = parser.Parse(projectContent, @"C:\Projects\Test\test.rb", Ruby); - if (compilationUnit.Classes.Count > 0) { - c = compilationUnit.Classes[0]; - } - } - - [Test] - public void OneClass() - { - Assert.AreEqual(1, compilationUnit.Classes.Count); - } - - [Test] - public void ClassName() - { - Assert.AreEqual("Test", c.Name); - } - - [Test] - public void FullyQualifiedClassName() - { - Assert.AreEqual("Test", c.FullyQualifiedName); - } - - [Test] - public void CompilationUnitFileName() - { - Assert.AreEqual(@"C:\Projects\Test\test.rb", compilationUnit.FileName); - } - - [Test] - public void ClassBodyRegion() - { - int startLine = 1; - int startColumn = 11; - int endLine = 2; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.BodyRegion.ToString()); - } - - [Test] - public void ClassRegion() - { - int startLine = 1; - int startColumn = 1; - int endLine = 2; - int endColumn = 4; - DomRegion region = new DomRegion(startLine, startColumn, endLine, endColumn); - Assert.AreEqual(region.ToString(), c.Region.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/RubyParserTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/RubyParserTestFixture.cs deleted file mode 100644 index a8e0507c3c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Parsing/RubyParserTestFixture.cs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using RubyBinding.Tests; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Parsing -{ - /// - /// Tests the RubyParser. - /// - [TestFixture] - public class ParserTestFixture - { - RubyParser parser; - - [TestFixtureSetUp] - public void SetUpFixture() - { - parser = new RubyParser(); - } - - [Test] - public void CanParseRubyFileName() - { - Assert.IsTrue(parser.CanParse("test.rb")); - } - - [Test] - public void CannotParseTextFileName() - { - Assert.IsFalse(parser.CanParse("test.txt")); - } - - [Test] - public void CannotParseNullFileName() - { - string fileName = null; - Assert.IsFalse(parser.CanParse(fileName)); - } - - [Test] - public void CanParseUpperCaseRubyFileName() - { - Assert.IsTrue(parser.CanParse("TEST.RB")); - } - - [Test] - public void NoLexerTags() - { - Assert.AreEqual(0, parser.LexerTags.Length); - } - - [Test] - public void SetLexerTags() - { - RubyParser parser = new RubyParser(); - string[] tags = new string[] {"Test"}; - parser.LexerTags = tags; - - Assert.AreEqual(tags, parser.LexerTags); - } - - [Test] - public void LanguageProperties() - { - Assert.IsNotNull(parser.Language); - } - - [Test] - public void CannotParseNullProject() - { - IProject project = null; - Assert.IsFalse(parser.CanParse(project)); - } - - [Test] - public void CanParseRubyProject() - { - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - createInfo.OutputProjectFileName = @"C:\projects\test.rbproj"; - RubyProject project = new RubyProject(createInfo); - Assert.IsTrue(parser.CanParse(project)); - } - - [Test] - public void CannotParseNonRubyLanguageProject() - { - MockProject project = new MockProject(); - project.Language = "Test"; - Assert.IsFalse(parser.CanParse(project)); - } - - [Test] - public void ParseWithNullTextBuffer() - { - DefaultProjectContent projectContent = new DefaultProjectContent(); - ITextBuffer textBuffer = null; - ICompilationUnit unit = parser.Parse(projectContent, null, textBuffer); - Assert.IsInstanceOf(typeof(DefaultCompilationUnit), unit); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj deleted file mode 100644 index a246d6a630..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj +++ /dev/null @@ -1,387 +0,0 @@ - - - - {01DF0475-0CB2-4E81-971B-BADC60CDE3A5} - Debug - AnyCPU - Library - RubyBinding.Tests - RubyBinding.Tests - v4.0 - Properties - C:\Users\matt\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis - False - False - 4 - false - - - ..\..\..\..\..\..\bin\UnitTests\RubyBinding\ - true - Full - False - True - DEBUG;TRACE - - - ..\..\..\..\..\..\bin\UnitTests\RubyBinding - false - None - True - False - TRACE - - - False - Auto - 4194304 - x86 - 4096 - - - - - ..\..\IronRuby\bin\IronRuby.dll - - - ..\..\IronRuby\bin\IronRuby.Libraries.dll - - - - - ..\..\IronRuby\bin\Microsoft.Dynamic.dll - True - - - ..\..\IronRuby\bin\Microsoft.Scripting.dll - True - - - ..\..\..\..\..\Tools\NUnit\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RubyBinding.addin - - - - - - - - {6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} - ICSharpCode.AvalonEdit - - - {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} - NRefactory - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - - - {924EE450-603D-49C1-A8E5-4AFAA31CE6F3} - ICSharpCode.SharpDevelop.Dom - - - {8035765F-D51F-4A0C-A746-2FD100E19419} - ICSharpCode.SharpDevelop.Widgets - - - {44A8DE09-CAB9-49D8-9CFC-5EB0A552F181} - UnitTesting.Tests - - - {1F261725-6318-4434-A1B1-6C70CE4CD324} - UnitTesting - - - {0162E499-42D0-409B-AA25-EED21F75336B} - AvalonEdit.AddIn - - - {7D7E92DF-ACEB-4B69-92C8-8AC7A703CD57} - FormsDesigner - - - {7048AE18-EB93-4A84-82D0-DD60EB58ADBD} - ICSharpCode.Scripting - - - {85C09AD8-183B-403A-869A-7226646218A9} - ICSharpCode.Scripting.Tests - - - {C896FFFF-5B6C-4B0E-B6DF-049865F501B4} - RubyBinding - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/CreateNewRubyProjectTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/CreateNewRubyProjectTestFixture.cs deleted file mode 100644 index 030adbd228..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/CreateNewRubyProjectTestFixture.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; - -using ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using Microsoft.Build.Construction; -using NUnit.Framework; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.RubyLanguage -{ - /// - /// Tests the initial properties set in a newly created RubyProject. - /// - [TestFixture] - public class CreateNewRubyProjectTestFixture - { - ProjectCreateInformation info; - RubyProject project; - - [TestFixtureSetUp] - public void SetUpFixture() - { - info = new ProjectCreateInformation(); - info.Solution = new Solution(new MockProjectChangeWatcher()); - info.ProjectName = "Test"; - info.OutputProjectFileName = @"C:\Projects\Test\Test.rbproj"; - info.RootNamespace = "Test"; - - project = new RubyProject(info); - } - - [Test] - public void Language() - { - Assert.AreEqual(RubyProjectBinding.LanguageName, project.Language); - } - - [Test] - public void Name() - { - Assert.AreEqual(info.ProjectName, project.Name); - } - - [Test] - public void BuildTargetAdded() - { - foreach (ProjectTargetElement target in project.MSBuildProjectFile.Targets) { - if (target.Name == "Build") { - return; - } - } - Assert.Fail("Build target does not exist."); - } - - [Test] - public void ProjectLanguageProperties() - { - Assert.AreEqual(RubyLanguageProperties.Default, project.LanguageProperties); - } - - [Test] - public void DefaultItemTypeForRubyFileNameIsCompile() - { - Assert.AreEqual(ItemType.Compile, project.GetDefaultItemType(".rb")); - } - - [Test] - public void DefaultItemTypeForUpperCaseRubyFileNameIsCompile() - { - Assert.AreEqual(ItemType.Compile, project.GetDefaultItemType(".RB")); - } - - [Test] - public void DefaultItemTypeForNullRubyFileNameIsCompile() - { - Assert.AreEqual(ItemType.None, project.GetDefaultItemType(null)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/ProjectBindingTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/ProjectBindingTestFixture.cs deleted file mode 100644 index abc234a160..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/ProjectBindingTestFixture.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.RubyLanguage -{ - /// - /// Tests the RubyProjectBinding class. - /// - [TestFixture] - public class ProjetBindingTestFixture - { - RubyProjectBinding projectBinding; - RubyProject project; - - [TestFixtureSetUp] - public void SetUpFixture() - { - projectBinding = new RubyProjectBinding(); - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.ProjectName = "Ruby"; - createInfo.OutputProjectFileName = @"C:\Projects\Ruby.rbproj"; - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - project = projectBinding.CreateProject(createInfo) as RubyProject; - } - - [Test] - public void Language() - { - Assert.AreEqual("Ruby", projectBinding.Language); - } - - [Test] - public void IsRubyProject() - { - Assert.IsNotNull(project); - } - - [Test] - public void ProjectName() - { - Assert.AreEqual("Ruby", project.Name); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguageBindingTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguageBindingTestFixture.cs deleted file mode 100644 index cb6f41e217..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguageBindingTestFixture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop; -using NUnit.Framework; - -namespace RubyBinding.Tests.RubyLanguage -{ - [TestFixture] - public class RubyLanguageBindingTestFixture - { - RubyLanguageBinding languageBinding; - - [SetUp] - public void Init() - { - languageBinding = new RubyLanguageBinding(); - } - - [Test] - public void FormattingStrategyIsRubyFormattingStrategy() - { - Assert.IsInstanceOf(typeof(RubyFormattingStrategy), languageBinding.FormattingStrategy); - } - - [Test] - public void ImplementsILanguageBinding() - { - Assert.IsNotNull(languageBinding as ILanguageBinding); - } - - [Test] - public void LanguagePropertiesIsRubyLanguageProperties() - { - Assert.IsInstanceOf(typeof(RubyLanguageProperties), languageBinding.Properties); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguagePropertiesTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguagePropertiesTests.cs deleted file mode 100644 index 1302566c61..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyLanguage/RubyLanguagePropertiesTests.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; - -namespace RubyBinding.Tests.RubyLanguage -{ - [TestFixture] - public class RubyLanguagePropertiesTests - { - [Test] - public void HasCodeDomProvider() - { - Assert.IsNotNull(RubyLanguageProperties.Default.CodeDomProvider); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Strings.resx b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Strings.resx deleted file mode 100644 index 0a28739c88..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Strings.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Could not find type '{0}'. Are you missing an assembly reference? - - \ No newline at end of file diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/CreateRubyTestRunnerTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/CreateRubyTestRunnerTestFixture.cs deleted file mode 100644 index 53702a05bf..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/CreateRubyTestRunnerTestFixture.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using NUnit.Framework; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class CreateRubyTestRunnerTestFixture - { - RubyTestFramework testFramework; - - [TestFixtureSetUp] - public void SetUpFixture() - { - if (!PropertyService.Initialized) { - PropertyService.InitializeService(String.Empty, String.Empty, String.Empty); - } - } - - [SetUp] - public void Init() - { - testFramework = new RubyTestFramework(); - } - - [Test] - public void RubyTestFrameworkCreateTestRunnerReturnsRubyTestRunner() - { - Assert.IsInstanceOf(typeof(RubyTestRunner), testFramework.CreateTestRunner()); - } - - [Test] - public void RubyTestFrameworkCreateTestDebuggerReturnsRubyTestDebugger() - { - Assert.IsInstanceOf(typeof(RubyTestDebugger), testFramework.CreateTestDebugger()); - } - - [Test] - public void RubyTestFrameworkIsBuildNeededBeforeTestRunReturnsFalse() - { - Assert.IsFalse(testFramework.IsBuildNeededBeforeTestRun); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyConsoleApplicationTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyConsoleApplicationTests.cs deleted file mode 100644 index b033a88cb8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyConsoleApplicationTests.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyConsoleApplicationTests - { - RubyConsoleApplication app; - RubyAddInOptions options; - - [SetUp] - public void Init() - { - options = new RubyAddInOptions(new Properties()); - options.RubyFileName = @"C:\IronRuby\ir.exe"; - app = new RubyConsoleApplication(options); - } - - [Test] - public void FileName_NewInstance_FileNameIsRubyFileNameFromAddInOptions() - { - string fileName = app.FileName; - string expectedFileName = @"C:\IronRuby\ir.exe"; - Assert.AreEqual(expectedFileName, fileName); - } - - [Test] - public void GetArguments_DebugIsTrue_ReturnsDisableGemsAndDebugOption() - { - app.Debug = true; - string args = app.GetArguments(); - string expectedCommandLine = "--disable-gems -D"; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetArguments_ScriptFileNameIsSet_ReturnsQuotedRubyScriptFileName() - { - app.ScriptFileName = @"d:\projects\my ruby\test.rb"; - string args = app.GetArguments(); - string expectedCommandLine = "--disable-gems \"d:\\projects\\my ruby\\test.rb\""; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetArguments_ScriptFileNameAndScriptCommandLineArgumentsSet_ReturnsQuotedRubyScriptFileNameAndItsCommandLineArguments() - { - app.Debug = true; - app.ScriptFileName = @"d:\projects\my ruby\test.rb"; - app.ScriptCommandLineArguments = "-- responseFile.txt"; - string args = app.GetArguments(); - - string expectedCommandLine = - "--disable-gems -D \"d:\\projects\\my ruby\\test.rb\" -- responseFile.txt"; - - Assert.AreEqual(expectedCommandLine, args); - } - - [Test] - public void GetProcessStartInfo_NewInstance_HasFileNameThatEqualsIronRubyConsoleApplicationExeFileName() - { - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedFileName = @"C:\IronRuby\ir.exe"; - - Assert.AreEqual(expectedFileName, startInfo.FileName); - } - - [Test] - public void GetProcessStartInfo_DebugIsTrue_HasDebugFlagSetInArguments() - { - app.Debug = true; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - string expectedCommandLine = "--disable-gems -D"; - - Assert.AreEqual(expectedCommandLine, startInfo.Arguments); - } - - [Test] - public void GetProcessStartInfo_WorkingDirectorySet_ProcessStartInfoHasMatchingWorkingDirectory() - { - app.WorkingDirectory = @"d:\temp"; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - Assert.AreEqual(@"d:\temp", startInfo.WorkingDirectory); - } - - [Test] - public void GetProcessStartInfo_ChangingOptionsRubyFileName_ChangesProcessStartInfoFileName() - { - options.RubyFileName = @"d:\temp\test\ir.exe"; - ProcessStartInfo startInfo = app.GetProcessStartInfo(); - - Assert.AreEqual(@"d:\temp\test\ir.exe", startInfo.FileName); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs deleted file mode 100644 index 7d9d85f2a9..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; - -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestDebuggerRunsSelectedTestMethodTestFixture - { - MockDebuggerService debuggerService; - UnitTesting.Tests.Utils.MockDebugger debugger; - MockMessageService messageService; - MockCSharpProject project; - RubyTestDebugger testDebugger; - MockTestResultsMonitor testResultsMonitor; - SelectedTests selectedTests; - MockMethod methodToTest; - RubyAddInOptions options; - MockScriptingFileService fileService; - StringBuilder responseFileText; - StringWriter responseFileStringWriter; - - [SetUp] - public void Init() - { - CreateTestDebugger(); - CreateTestMethod(); - } - - void CreateTestDebugger() - { - debuggerService = new MockDebuggerService(); - debugger = debuggerService.MockDebugger; - messageService = new MockMessageService(); - testResultsMonitor = new MockTestResultsMonitor(); - testResultsMonitor.InitialFilePosition = 3; - options = new RubyAddInOptions(new Properties()); - options.RubyFileName = @"c:\ironruby\ir.exe"; - fileService = new MockScriptingFileService(); - testDebugger = new RubyTestDebugger(debuggerService, messageService, testResultsMonitor, options, fileService); - } - - void CreateTestMethod() - { - project = new MockCSharpProject(); - MockClass c = new MockClass("MyNamespace.MyTestClass"); - methodToTest = new MockMethod(c, "MyTestMethod"); - } - - void RunTestsOnSelectedTestMethod() - { - fileService.SetTempFileName(@"d:\temp\tmp66.tmp"); - CreateTemporaryResponseFileWriter(); - - selectedTests = new SelectedTests(project, null, null, methodToTest); - testDebugger.Start(selectedTests); - } - - void CreateTemporaryResponseFileWriter() - { - responseFileText = new StringBuilder(); - responseFileStringWriter = new StringWriter(responseFileText); - fileService.SetTextWriter(responseFileStringWriter); - } - - [Test] - public void TestDebuggerProcessFileNameIsIronRubyConsoleExeTakenFromAddInOptions() - { - RunTestsOnSelectedTestMethod(); - - string expectedFileName = @"c:\ironruby\ir.exe"; - Assert.AreEqual(expectedFileName, debugger.ProcessStartInfo.FileName); - } - - [Test] - public void DisposingTestRunnerDeletesTemporaryResponseFile() - { - fileService.FileNameDeleted = null; - RunTestsOnSelectedTestMethod(); - testDebugger.Dispose(); - - string expectedFileName = @"d:\temp\tmp66.tmp"; - Assert.AreEqual(expectedFileName, fileService.FileNameDeleted); - } - - [Test] - public void DisposingTestRunnerDisposesTestResultsMonitor() - { - RunTestsOnSelectedTestMethod(); - testDebugger.Dispose(); - Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled); - } - - [Test] - public void CommandLineArgumentHasSharpDevelopTestRubyScriptFileNameAndTestResultsFileNameResponseFileName() - { - AddInPathHelper helper = new AddInPathHelper("RubyBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\sharpdevelop\addins\rubybinding\rubybinding.addin"; - - testResultsMonitor.FileName = @"d:\testresults.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedCommandLine = - "--disable-gems " + - "-D " + - "\"-Ic:\\sharpdevelop\\addins\\rubybinding\\TestRunner\" " + - "\"c:\\sharpdevelop\\addins\\rubybinding\\TestRunner\\sdtest.rb\" " + - "--name=MyTestMethod " + - "-- " + - "\"d:\\testresults.txt\" " + - "\"d:\\temp\\tmp66.tmp\""; - - Assert.AreEqual(expectedCommandLine, debugger.ProcessStartInfo.Arguments); - } - - [Test] - public void RubyTestResultReturnedFromTestFinishedEvent() - { - TestResult testResult = null; - testDebugger.TestFinished += delegate(object source, TestFinishedEventArgs e) { - testResult = e.Result; - }; - TestResult testResultToFire = new TestResult("test"); - testResultsMonitor.FireTestFinishedEvent(testResultToFire); - - Assert.IsInstanceOf(typeof(RubyTestResult), testResult); - } - - [Test] - public void TestResultsMonitorInitialFilePositionIsZero() - { - Assert.AreEqual(0, testResultsMonitor.InitialFilePosition); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestClassTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestClassTests.cs deleted file mode 100644 index 1142de0be8..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestClassTests.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestFrameworkIsTestClassTests - { - RubyTestFramework testFramework; - - [SetUp] - public void Init() - { - testFramework = new RubyTestFramework(); - } - - [Test] - public void CreateClassWithTestUnitTestCaseBaseTypeReturnsClassWithFirstBaseTypeEqualToTestCase() - { - IClass c = MockClass.CreateClassWithBaseType("Test.Unit.TestCase"); - string name = c.BaseTypes[0].FullyQualifiedName; - string expectedName = "Test.Unit.TestCase"; - Assert.AreEqual(expectedName, name); - } - - [Test] - public void IsTestClassReturnsTrueWhenClassFirstBaseTypeIsUnitTestTestCase() - { - MockClass c = MockClass.CreateClassWithBaseType("Test.Unit.TestCase"); - Assert.IsTrue(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsFalseWhenClassHasNoBaseTypes() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - Assert.IsFalse(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsFalseForNull() - { - Assert.IsFalse(testFramework.IsTestClass(null)); - } - - [Test] - public void IsTestClassReturnsFalseWhenFirstBaseTypeIsSystemWindowsFormsForm() - { - MockClass c = MockClass.CreateClassWithBaseType("System.Windows.Forms.Form"); - Assert.IsFalse(testFramework.IsTestClass(c)); - } - - [Test] - public void IsTestClassReturnsTrueWhenDerivedClassHasBaseClassDerivedFromTestCase() - { - MockClass baseClass = MockClass.CreateClassWithBaseType("Test.Unit.TestCase"); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - DefaultReturnType returnType = new DefaultReturnType(baseClass); - c.BaseTypes.Add(returnType); - - Assert.IsTrue(testFramework.IsTestClass(c)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestMemberTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestMemberTests.cs deleted file mode 100644 index 4da9a112b5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestMemberTests.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Dom; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestFrameworkIsTestMemberTests - { - RubyTestFramework testFramework; - - void CreateTestFramework() - { - testFramework = new RubyTestFramework(); - } - - [Test] - public void IsTestMember_MethodThatStartsWithTest_ReturnsTrue() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - var method = new MockMethod(c, "testRunThis"); - - bool result = testFramework.IsTestMember(method); - - Assert.IsTrue(result); - } - - [Test] - public void IsTestMember_NullPassed_ReturnsFalse() - { - CreateTestFramework(); - bool result = testFramework.IsTestMember(null); - - Assert.IsFalse(result); - } - - [Test] - public void IsTestMember_MethodThatDoesNotStartWithTest_ReturnsFalse() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - var method = new MockMethod(c, "RunThis"); - - bool result = testFramework.IsTestMember(method); - - Assert.IsFalse(result); - } - - [Test] - public void IsTestMember_FieldThatStartsWithTest_ReturnsFalse() - { - CreateTestFramework(); - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - var field = new DefaultField(c, "testField"); - - bool result = testFramework.IsTestMember(field); - - Assert.IsFalse(result); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs deleted file mode 100644 index 7a2b0e0eeb..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestFrameworkIsTestProjectTests.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Internal.Templates; -using ICSharpCode.SharpDevelop.Project; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestFrameworkIsTestProjectTests - { - RubyTestFramework testFramework; - - [TestFixtureSetUp] - public void SetUpFixture() - { - RubyMSBuildEngineHelper.InitMSBuildEngine(); - } - - [SetUp] - public void Init() - { - testFramework = new RubyTestFramework(); - } - - [Test] - public void IsTestProjectWhenPassedNullProjectReturnsFalse() - { - Assert.IsFalse(testFramework.IsTestProject(null)); - } - - [Test] - public void IsTestProjectWhenPassedRubyPythonProjectReturnsTrue() - { - ProjectCreateInformation createInfo = new ProjectCreateInformation(); - createInfo.Solution = new Solution(new MockProjectChangeWatcher()); - createInfo.OutputProjectFileName = @"C:\projects\test.rbproj"; - RubyProject project = new RubyProject(createInfo); - - Assert.IsTrue(testFramework.IsTestProject(project)); - } - - [Test] - public void IsTestProjectWhenPassedNonPythonProjectReturnsFalse() - { - MockProject project = new MockProject(); - Assert.IsFalse(testFramework.IsTestProject(project)); - } - - [Test] - public void IsTestProjectWhenPassedNullRubyProjectReturnsFalse() - { - RubyProject project = null; - Assert.IsFalse(testFramework.IsTestProject(project)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestResultFailureTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestResultFailureTestFixture.cs deleted file mode 100644 index 8ccb668be4..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestResultFailureTestFixture.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.RubyBinding; -using ICSharpCode.UnitTesting; -using NUnit.Framework; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestResultFailureTestFixture - { - RubyTestResult RubyTestResult; - string stackTraceText; - - [SetUp] - public void Init() - { - TestResult testResult = new TestResult("MyTest"); - testResult.ResultType = TestResultType.Failure; - testResult.Message = "test failed"; - - stackTraceText = - "Failure:\r\n" + - "test_fail(SecondTests)\r\n" + - " [d:\\projects\\rubytests\\SecondTests.rb:6:in `test_fail'\r\n" + - " d:\\test\\rubytests/sdtestrunner.rb:73:in `start_mediator'\r\n" + - " d:\\test\\rubytests/sdtestrunner.rb:47:in `start']:\r\n" + - "Assertion was false.\r\n" + - " is not true.\r\n" + - ""; - - testResult.StackTrace = stackTraceText; - RubyTestResult = new RubyTestResult(testResult); - } - - [Test] - public void TestResultNameIsMyTest() - { - Assert.AreEqual("MyTest", RubyTestResult.Name); - } - - [Test] - public void TestResultTypeIsFailure() - { - Assert.AreEqual(TestResultType.Failure, RubyTestResult.ResultType); - } - - [Test] - public void TestResultMessageIsTestFailed() - { - Assert.AreEqual("test failed", RubyTestResult.Message); - } - - [Test] - public void RubyTestResultHasStackTraceFromOriginalTestResult() - { - Assert.AreEqual(stackTraceText, RubyTestResult.StackTrace); - } - - [Test] - public void StackTraceFilePositionHasExpectedFileName() - { - string expectedFileName = @"d:\projects\rubytests\SecondTests.rb"; - Assert.AreEqual(expectedFileName, RubyTestResult.StackTraceFilePosition.FileName); - } - - [Test] - public void StackTraceFilePositionLineIs6() - { - Assert.AreEqual(6, RubyTestResult.StackTraceFilePosition.Line); - } - - [Test] - public void StackTraceFilePositionColumnIsOne() - { - Assert.AreEqual(1, RubyTestResult.StackTraceFilePosition.Column); - } - - [Test] - public void ChangingStackTraceToEmptyStringSetsStackTraceFilePositionToEmpty() - { - RubyTestResult.StackTraceFilePosition = new FilePosition("test.rb", 10, 2); - RubyTestResult.StackTrace = String.Empty; - Assert.IsTrue(RubyTestResult.StackTraceFilePosition.IsEmpty); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs deleted file mode 100644 index c37063568a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using RubyBinding.Tests.Testing; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestRunnerApplicationTests - { - RubyTestRunnerApplication testRunner; - RubyAddInOptions options; - - [SetUp] - public void Init() - { - string tempFileName = "temp.tmp"; - MockScriptingFileService fileService = new MockScriptingFileService(); - fileService.SetTempFileName(tempFileName); - fileService.SetTextWriter(new StringWriter()); - - Properties properties = new Properties(); - options = new RubyAddInOptions(properties); - - AddInPathHelper helper = new AddInPathHelper("RubyBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\rubybinding\rubybinding.addin"; - - string testResultsFileName = "results.txt"; - testRunner = new RubyTestRunnerApplication(testResultsFileName, options, fileService); - } - - [Test] - public void CreateProcessInfoReturnsCommandLineWithTestClassOption() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - c.FullyQualifiedName = "MyTests"; - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(c); - ProcessStartInfo processStartInfo = GetProcessStartInfoFromTestRunnerApp(selectedTests); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\rubybinding\\TestRunner\" " + - "\"c:\\rubybinding\\TestRunner\\sdtest.rb\" " + - "--testcase=MyTests " + - "-- " + - "\"results.txt\" " + - "\"temp.tmp\""; - - Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); - } - - ProcessStartInfo GetProcessStartInfoFromTestRunnerApp(SelectedTests selectedTests) - { - testRunner.CreateResponseFile(selectedTests); - return testRunner.CreateProcessStartInfo(selectedTests); - } - - [Test] - public void CreateProcessInfoReturnsCommandLineWithTestMethodOption() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - MockMethod method = new MockMethod(c, "MyMethod"); - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(method); - ProcessStartInfo processStartInfo = GetProcessStartInfoFromTestRunnerApp(selectedTests); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\rubybinding\\TestRunner\" " + - "\"c:\\rubybinding\\TestRunner\\sdtest.rb\" " + - "--name=MyMethod " + - "-- " + - "\"results.txt\" " + - "\"temp.tmp\""; - - Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); - } - - [Test] - public void CreateProcessInfoReturnsFixedTestRunnerFilePath() - { - AddInPathHelper helper = new AddInPathHelper("RubyBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\rubybinding\bin\..\AddIns\rubybinding.addin"; - - MockCSharpProject project = new MockCSharpProject(); - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(project); - ProcessStartInfo processStartInfo = GetProcessStartInfoFromTestRunnerApp(selectedTests); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\rubybinding\\AddIns\\TestRunner\" " + - "\"c:\\rubybinding\\AddIns\\TestRunner\\sdtest.rb\" " + - "-- " + - "\"results.txt\" " + - "\"temp.tmp\""; - - Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); - } - - [Test] - public void CreateProcessInfoReturnsCommandLineWithLoadPathSpecifiedInRubyAddInOptions() - { - MockCSharpProject project = new MockCSharpProject(); - options.RubyLibraryPath = @"c:\ruby\lib"; - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(project); - ProcessStartInfo processStartInfo = GetProcessStartInfoFromTestRunnerApp(selectedTests); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\ruby\\lib\" " + - "\"-Ic:\\rubybinding\\TestRunner\" " + - "\"c:\\rubybinding\\TestRunner\\sdtest.rb\" " + - "-- " + - "\"results.txt\" " + - "\"temp.tmp\""; - - Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); - } - - [Test] - public void CreateProcessInfoReturnsCommandLineWithDirectoriesForReferencedProjects() - { - MockCSharpProject referencedProject = new MockCSharpProject(); - referencedProject.FileName = @"c:\projects\rbproject\rbproject.rbproj"; - - MockCSharpProject unitTestProject = new MockCSharpProject(); - ProjectReferenceProjectItem projectRef = new ProjectReferenceProjectItem(unitTestProject, referencedProject); - projectRef.FileName = @"c:\projects\rbproject\pyproject.rbproj"; - ProjectService.AddProjectItem(unitTestProject, projectRef); - - MockMethod method = MockMethod.CreateMockMethodWithoutAnyAttributes(); - method.CompilationUnit.FileName = @"d:\mytest.rb"; - FileProjectItem fileItem = new FileProjectItem(unitTestProject, ItemType.Compile); - fileItem.FileName = @"d:\mytest.rb"; - ProjectService.AddProjectItem(unitTestProject, fileItem); - - SelectedTests tests = RubySelectedTestsHelper.CreateSelectedTests(unitTestProject); - ProcessStartInfo processStartInfo = GetProcessStartInfoFromTestRunnerApp(tests); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\rubybinding\\TestRunner\" " + - "\"-Ic:\\projects\\rbproject\" " + - "\"c:\\rubybinding\\TestRunner\\sdtest.rb\" " + - "-- " + - "\"results.txt\" " + - "\"temp.tmp\""; - - Assert.AreEqual(expectedCommandLine, processStartInfo.Arguments); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerResponseFileTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerResponseFileTestFixture.cs deleted file mode 100644 index d1582f214a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerResponseFileTestFixture.cs +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Text; -using ICSharpCode.Core.Services; -using ICSharpCode.RubyBinding; -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestRunnerResponseFileTestFixture - { - RubyTestRunnerResponseFile responseFile; - StringBuilder responseFileText; - StringWriter writer; - - [SetUp] - public void Init() - { - responseFileText = new StringBuilder(); - writer = new StringWriter(responseFileText); - responseFile = new RubyTestRunnerResponseFile(writer); - } - - [Test] - public void DisposeMethodDisposesTextWriterPassedInConstructor() - { - responseFile.Dispose(); - Assert.Throws(delegate { writer.WriteLine("test"); }); - } - - [Test] - public void WriteTestsAddsTestClassFileNameToResponseFile() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - c.CompilationUnit.FileName = @"d:\mytest.rb"; - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(c); - responseFile.WriteTests(selectedTests); - - string expectedText = "d:\\mytest.rb\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsAddsTestMethodFileNameToResponseFile() - { - MockClass c = MockClass.CreateMockClassWithoutAnyAttributes(); - MockMethod method = new MockMethod(c, "MyTest"); - method.CompilationUnit.FileName = @"d:\mytest.rb"; - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(method); - responseFile.WriteTests(selectedTests); - - string expectedText = "d:\\mytest.rb\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsAddsFileNamesForFileInProject() - { - MockCSharpProject project = new MockCSharpProject(new Solution(new MockProjectChangeWatcher()), "mytests"); - - FileProjectItem item = new FileProjectItem(project, ItemType.Compile); - item.FileName = @"c:\projects\mytests\myTests.rb"; - ProjectService.AddProjectItem(project, item); - - SelectedTests selectedTests = RubySelectedTestsHelper.CreateSelectedTests(project); - responseFile.WriteTests(selectedTests); - - string expectedText = "c:\\projects\\mytests\\myTests.rb\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsDoesNotThrowNullReferenceExceptionWhenNonFileProjectItemInProject() - { - MockCSharpProject project = new MockCSharpProject(new Solution(new MockProjectChangeWatcher()), "mytests"); - WebReferenceUrl webRef = new WebReferenceUrl(project); - webRef.Include = "test"; - ProjectService.AddProjectItem(project, webRef); - - FileProjectItem item = new FileProjectItem(project, ItemType.Compile); - item.FileName = @"c:\projects\mytests\myTests.rb"; - ProjectService.AddProjectItem(project, item); - - SelectedTests tests = new SelectedTests(project); - responseFile.WriteTests(tests); - - string expectedText = "c:\\projects\\mytests\\myTests.rb\r\n"; - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void WriteTestsDoesNotThrowNullReferenceExceptionWhenProjectIsNull() - { - SelectedTests tests = new SelectedTests(null); - responseFile.WriteTests(tests); - - Assert.AreEqual(String.Empty, responseFileText.ToString()); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs deleted file mode 100644 index 77e01fc3bd..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Text; - -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.UnitTesting; -using NUnit.Framework; -using RubyBinding.Tests.Utils; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Testing -{ - [TestFixture] - public class RubyTestRunnerRunsSelectedTestMethodTestFixture - { - MockCSharpProject project; - RubyTestRunner testRunner; - MockProcessRunner processRunner; - MockTestResultsMonitor testResultsMonitor; - SelectedTests selectedTests; - MockMethod methodToTest; - RubyAddInOptions options; - MockScriptingFileService fileService; - StringBuilder responseFileText; - StringWriter responseFileStringWriter; - - [SetUp] - public void Init() - { - CreateTestRunner(); - CreateTestMethod(); - } - - void CreateTestRunner() - { - processRunner = new MockProcessRunner(); - testResultsMonitor = new MockTestResultsMonitor(); - testResultsMonitor.InitialFilePosition = 3; - options = new RubyAddInOptions(new Properties()); - options.RubyFileName = @"c:\ironruby\ir.exe"; - fileService = new MockScriptingFileService(); - MockMessageService messageService = new MockMessageService(); - - RubyTestRunnerContext context = new RubyTestRunnerContext(processRunner, testResultsMonitor, options, fileService, messageService); - testRunner = new RubyTestRunner(context); - } - - void CreateTestMethod() - { - project = new MockCSharpProject(); - MockClass c = new MockClass("MyNamespace.MyTestClass"); - methodToTest = new MockMethod(c, "MyTestMethod"); - } - - void RunTestsOnSelectedTestMethod() - { - fileService.SetTempFileName(@"d:\temp\tmp66.tmp"); - CreateTemporaryResponseFileWriter(); - - selectedTests = new SelectedTests(project, null, null, methodToTest); - testRunner.Start(selectedTests); - } - - void CreateTemporaryResponseFileWriter() - { - responseFileText = new StringBuilder(); - responseFileStringWriter = new StringWriter(responseFileText); - fileService.SetTextWriter(responseFileStringWriter); - } - - [Test] - public void TestRunnerProcessFileNameIsIronRubyConsoleExeTakenFromAddInOptions() - { - RunTestsOnSelectedTestMethod(); - - string expectedFileName = @"c:\ironruby\ir.exe"; - Assert.AreEqual(expectedFileName, processRunner.CommandPassedToStartMethod); - } - - [Test] - public void CommandLineArgumentHasSharpDevelopTestRubyScriptFileNameAndTestResultsFileNameAndResponseFileName() - { - AddInPathHelper helper = new AddInPathHelper("RubyBinding"); - AddIn addin = helper.CreateDummyAddInInsideAddInTree(); - addin.FileName = @"c:\sharpdevelop\addins\rubybinding\rubybinding.addin"; - - testResultsMonitor.FileName = @"d:\testresults.txt"; - RunTestsOnSelectedTestMethod(); - - string expectedCommandLine = - "--disable-gems " + - "\"-Ic:\\sharpdevelop\\addins\\rubybinding\\TestRunner\" " + - "\"c:\\sharpdevelop\\addins\\rubybinding\\TestRunner\\sdtest.rb\" " + - "--name=MyTestMethod " + - "-- " + - "\"d:\\testresults.txt\" " + - "\"d:\\temp\\tmp66.tmp\""; - - Assert.AreEqual(expectedCommandLine, processRunner.CommandArgumentsPassedToStartMethod); - } - - [Test] - public void ResponseFileCreatedUsingTempFileName() - { - RunTestsOnSelectedTestMethod(); - - Assert.AreEqual(@"d:\temp\tmp66.tmp", fileService.CreateTextWriterInfoPassedToCreateTextWriter.FileName); - } - - [Test] - public void ResponseFileCreatedWithAsciiEncoding() - { - RunTestsOnSelectedTestMethod(); - - Assert.AreEqual(Encoding.ASCII, fileService.CreateTextWriterInfoPassedToCreateTextWriter.Encoding); - } - - [Test] - public void ResponseFileCreatedWithAppendSetToFalse() - { - RunTestsOnSelectedTestMethod(); - - Assert.IsFalse(fileService.CreateTextWriterInfoPassedToCreateTextWriter.Append); - } - - [Test] - public void DisposingTestRunnerDeletesTemporaryResponseFile() - { - fileService.FileNameDeleted = null; - RunTestsOnSelectedTestMethod(); - testRunner.Dispose(); - - string expectedFileName = @"d:\temp\tmp66.tmp"; - Assert.AreEqual(expectedFileName, fileService.FileNameDeleted); - } - - [Test] - public void DisposingTestRunnerDisposesTestResultsMonitor() - { - RunTestsOnSelectedTestMethod(); - testRunner.Dispose(); - Assert.IsTrue(testResultsMonitor.IsDisposeMethodCalled); - } - - [Test] - public void ResponseFileTextContainsTestMethodFileName() - { - methodToTest.CompilationUnit.FileName = @"d:\projects\ruby\test.rb"; - RunTestsOnSelectedTestMethod(); - - string expectedText = - "d:\\projects\\ruby\\test.rb\r\n"; - - Assert.AreEqual(expectedText, responseFileText.ToString()); - } - - [Test] - public void ResponseFileTextWriterDisposedAfterTestsRun() - { - RunTestsOnSelectedTestMethod(); - Assert.Throws(delegate { responseFileStringWriter.Write("test"); }); - } - - [Test] - public void ProcessRunnerWorkingDirectoryIsDirectoryContainingProject() - { - RunTestsOnSelectedTestMethod(); - - string expectedDirectory = @"c:\projects\MyTests"; - string actualDirectory = processRunner.WorkingDirectory; - - Assert.AreEqual(expectedDirectory, actualDirectory); - } - - [Test] - public void RubyTestResultReturnedFromTestFinishedEvent() - { - TestResult testResult = null; - testRunner.TestFinished += delegate(object source, TestFinishedEventArgs e) { - testResult = e.Result; - }; - TestResult testResultToFire = new TestResult("test"); - testResultsMonitor.FireTestFinishedEvent(testResultToFire); - - Assert.IsInstanceOf(typeof(RubyTestResult), testResult); - } - - [Test] - public void TestResultsMonitorInitialFilePositionIsZero() - { - Assert.AreEqual(0, testResultsMonitor.InitialFilePosition); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedConvertProjectToRubyProjectCommand.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedConvertProjectToRubyProjectCommand.cs deleted file mode 100644 index 1eec047f17..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedConvertProjectToRubyProjectCommand.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.Collections.Generic; -using System.Text; - -using ICSharpCode.Core; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Project; - -namespace RubyBinding.Tests.Utils -{ - public struct SourceAndTargetFile - { - public FileProjectItem Source; - public FileProjectItem Target; - - public SourceAndTargetFile(FileProjectItem source, FileProjectItem target) - { - this.Source = source; - this.Target = target; - } - } - - /// - /// Used to test the ConvertProjectToRubyProjectCommand class. - /// - public class DerivedConvertProjectToRubyProjectCommand : ConvertProjectToRubyProjectCommand - { - List sourceAndTargetFilesPassedToBaseClass = new List(); - List savedFiles = new List(); - List parseableFileContent = new List(); - IProjectContent projectContent; - ParseInformation parseInfo; - List filesPassedToGetParseInfo = new List(); - Encoding fileServiceDefaultEncoding = Encoding.ASCII; - - public List SourceAndTargetFilesPassedToBaseClass { - get { return sourceAndTargetFilesPassedToBaseClass; } - } - - /// - /// Gets the files converted and saved. - /// - public List SavedFiles { - get { return savedFiles; } - } - - /// - /// Sets the project content to be returned from the GetProjectContent method. - /// - public IProjectContent ProjectContent { - get { return projectContent; } - set { projectContent = value; } - } - - public ParseInformation ParseInfo { - get { return parseInfo; } - set { parseInfo = value; } - } - - public Encoding FileServiceDefaultEncoding { - get { return fileServiceDefaultEncoding; } - set { fileServiceDefaultEncoding = value; } - } - - public List FilesPassedToGetParseInfo { - get { return filesPassedToGetParseInfo; } - } - - public void AddParseableFileContent(string fileName, string content) - { - parseableFileContent.Add(new ConvertedFile(fileName, content, null)); - } - - public void CallConvertFile(FileProjectItem source, FileProjectItem target) - { - ConvertFile(source, target); - } - - public IProject CallCreateProject(string directory, IProject sourceProject) - { - return base.CreateProject(directory, sourceProject); - } - - public void CallCopyProperties(IProject source, IProject target) - { - base.CopyProperties(source, target); - } - - protected override void LanguageConverterConvertFile(FileProjectItem source, FileProjectItem target) - { - sourceAndTargetFilesPassedToBaseClass.Add(new SourceAndTargetFile(source, target)); - } - - protected override void SaveFile(string fileName, string content, Encoding encoding) - { - savedFiles.Add(new ConvertedFile(fileName, content, encoding)); - } - - protected override string GetParseableFileContent(string fileName) - { - foreach (ConvertedFile file in parseableFileContent) { - if (file.FileName == fileName) { - return file.Text; - } - } - return null; - } - - protected override ParseInformation GetParseInfo(string fileName) - { - filesPassedToGetParseInfo.Add(fileName); - return parseInfo; - } - - protected override IProjectContent GetProjectContent(IProject project) - { - return projectContent; - } - - protected override Encoding GetDefaultFileEncoding() - { - return fileServiceDefaultEncoding; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyAddInOptions.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyAddInOptions.cs deleted file mode 100644 index 65b7351060..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyAddInOptions.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.Core; -using ICSharpCode.RubyBinding; - -namespace RubyBinding.Tests.Utils -{ - /// - /// Overrides the AddInOptions GetAddInPath method to return - /// some dummy data used for testing. - /// - public class DerivedRubyAddInOptions : RubyAddInOptions - { - string addInPath = String.Empty; - string addInPathRequested = String.Empty; - - public DerivedRubyAddInOptions(Properties properties) : base(properties) - { - } - - /// - /// Gets the addin path string passed to the GetAddInPath method. - /// - public string AddInPathRequested { - get { return addInPathRequested; } - } - - /// - /// Gets or sets the addin path that should be returned from the - /// GetAddInPath method. - /// - public string AddInPath { - get { return addInPath; } - set { addInPath = value; } - } - - /// - /// Returns our dummy AddInPath. - /// - protected override string GetAddInPath(string addIn) - { - addInPathRequested = addIn; - return addInPath; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyConsoleHost.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyConsoleHost.cs deleted file mode 100644 index 8f47cf45ad..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyConsoleHost.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; -using ICSharpCode.Scripting.Tests.Utils; -using Microsoft.Scripting; -using Microsoft.Scripting.Hosting; -using Microsoft.Scripting.Hosting.Shell; - -namespace RubyBinding.Tests.Console -{ - public class DerivedRubyConsoleHost : RubyConsoleHost - { - ScriptingConsoleOutputStream outputStream; - - public DerivedRubyConsoleHost(IScriptingConsoleTextEditor textEditor) - : base(textEditor, new FakeControlDispatcher()) - { - } - - public Type GetProvider() - { - return base.Provider; - } - - public CommandLine CallCreateCommandLine() - { - return base.CreateCommandLine(); - } - - public IConsole CallCreateConsole(ScriptEngine engine, CommandLine commandLine, ConsoleOptions options) - { - return base.CreateConsole(engine, commandLine, options); - } - - public OptionsParser CallCreateOptionsParser() - { - return base.CreateOptionsParser(); - } - - public LanguageSetup CallCreateLanguageSetup() - { - return base.CreateLanguageSetup(); - } - - /// - /// Gets the output stream class passed to SetOutput method. - /// - public ScriptingConsoleOutputStream OutputStream { - get { return outputStream; } - } - - protected override void SetOutput(ScriptingConsoleOutputStream stream) - { - outputStream = stream; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyDesignerGenerator.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyDesignerGenerator.cs deleted file mode 100644 index 98fc4a693c..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyDesignerGenerator.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.CodeDom; -using System.CodeDom.Compiler; -using System.Collections; -using System.ComponentModel; -using System.Reflection; - -using ICSharpCode.FormsDesigner; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Dom; -using ICSharpCode.SharpDevelop.Editor; -using ICSharpCode.SharpDevelop.Gui; - -namespace RubyBinding.Tests.Utils -{ - /// - /// Gives access to various protected methods - /// of the RubyDesignerGenerator class for testing. - /// - public class DerivedRubyDesignerGenerator : RubyDesignerGenerator - { - ParseInformation parseInfoToReturnFromParseFile; - - public DerivedRubyDesignerGenerator() : this(new MockTextEditorOptions()) - { - } - - public DerivedRubyDesignerGenerator(ITextEditorOptions textEditorOptions) - : base(textEditorOptions) - { - } - - /// - /// Gets or sets the parse information that will be returned from the - /// ParseFile method. - /// - public ParseInformation ParseInfoToReturnFromParseFileMethod { - get { return parseInfoToReturnFromParseFile; } - set { parseInfoToReturnFromParseFile = value; } - } - - protected override ParseInformation ParseFile(string fileName, string textContent) - { - return parseInfoToReturnFromParseFile; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyFormsDesignerDisplayBinding.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyFormsDesignerDisplayBinding.cs deleted file mode 100644 index e7c2e90e65..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/DerivedRubyFormsDesignerDisplayBinding.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop; -using ICSharpCode.SharpDevelop.Dom; - -namespace RubyBinding.Tests.Utils -{ - public class DerivedRubyFormsDesignerDisplayBinding : RubyFormsDesignerDisplayBinding - { - ParseInformation parseInfo; - ParseInformation parseServiceParseInfo; - bool isParseInfoDesignable; - string fileNamePassedToGetParseInfo; - string textContentNamePassedToGetParseInfo; - - public DerivedRubyFormsDesignerDisplayBinding() - { - } - - /// - /// Gets the parse info passed to the Forms Designer's IsDesignable method. - /// - public ParseInformation ParseInfoTestedForDesignability { - get { return parseInfo; } - } - - /// - /// Gets or sets the parse info that will be returned from the - /// GetParseInfo method. - /// - public ParseInformation ParseServiceParseInfoToReturn { - get { return parseServiceParseInfo; } - set { parseServiceParseInfo = value; } - } - - /// - /// Gets or sets what the IsDesignable method should return. - /// - public bool IsParseInfoDesignable { - get { return isParseInfoDesignable; } - set { isParseInfoDesignable = value; } - } - - /// - /// Gets the filename passed to the GetParseInfo method. - /// - public string FileNamePassedToGetParseInfo { - get { return fileNamePassedToGetParseInfo; } - } - - /// - /// Gets the text content passed to the GetParseInfo method. - /// - public string TextContentPassedToGetParseInfo { - get { return textContentNamePassedToGetParseInfo; } - } - - /// - /// Gets the parse information from the parse service - /// for the specified file. - /// - protected override ParseInformation GetParseInfo(string fileName, ITextBuffer textBuffer) - { - fileNamePassedToGetParseInfo = fileName; - textContentNamePassedToGetParseInfo = textBuffer.Text; - return parseServiceParseInfo; - } - - /// - /// Determines whether the specified parse information contains - /// a class which is designable. - /// - protected override bool IsDesignable(ParseInformation parseInfo) - { - this.parseInfo = parseInfo; - return isParseInfoDesignable; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyBindingAddInFile.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyBindingAddInFile.cs deleted file mode 100644 index 158d420598..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyBindingAddInFile.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using System.Reflection; -using System.Xml; - -namespace RubyBinding.Tests.Utils -{ - /// - /// Utility class that reads the RubyBinding.addin file - /// that has been embedded as a resource into the test assembly. - /// - public sealed class RubyBindingAddInFile - { - RubyBindingAddInFile() - { - } - - /// - /// Returns the RubyBinding.addin file. - /// - public static TextReader ReadAddInFile() - { - Assembly assembly = Assembly.GetAssembly(typeof(RubyBindingAddInFile)); - string resourceName = String.Concat("RubyBinding.Tests.RubyBinding.addin"); - Stream resourceStream = assembly.GetManifestResourceStream(resourceName); - if (resourceStream != null) { - return new StreamReader(resourceStream); - } - return null; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyCodeDomSerializerHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyCodeDomSerializerHelper.cs deleted file mode 100644 index 878d182e60..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyCodeDomSerializerHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; - -namespace RubyBinding.Tests.Utils -{ - public class RubyCodeDomSerializerHelper - { - public static RubyCodeDomSerializer CreateSerializer() - { - return new RubyCodeDomSerializer(); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyComponentWalkerHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyComponentWalkerHelper.cs deleted file mode 100644 index 86eb3d77c5..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyComponentWalkerHelper.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.Scripting; - -namespace RubyBinding.Tests.Utils -{ - public class RubyComponentWalkerHelper - { - public static IComponentWalker CreateComponentWalker(IComponentCreator componentCreator) - { - return new RubyComponentWalker(componentCreator); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs deleted file mode 100644 index 54d7071836..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyMSBuildEngineHelper.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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.IO; -using ICSharpCode.RubyBinding; -using ICSharpCode.Scripting.Tests.Utils; -using ICSharpCode.SharpDevelop.Project; - -namespace RubyBinding.Tests.Utils -{ - public sealed class RubyMSBuildEngineHelper - { - RubyMSBuildEngineHelper() - { - } - - /// - /// The MSBuildEngine sets the RubyBinPath so if - /// the Ruby.Build.Tasks assembly is shadow copied it refers - /// to the shadow copied assembly not the original. This - /// causes problems for Ruby projects that refer to the - /// SharpDevelop.Ruby.Build.targets import via $(RubyBinPath) - /// so here we change it so it points to the real RubyBinPath - /// binary. - /// - public static void InitMSBuildEngine() - { - string relativePath = @"..\..\AddIns\BackendBindings\RubyBinding\"; - MSBuildEngineHelper.InitMSBuildEngine("RubyBinPath", relativePath, typeof(RubyParser)); - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyParserHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyParserHelper.cs deleted file mode 100644 index 52318804a0..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubyParserHelper.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.SharpDevelop; -using ICSharpCode.RubyBinding; -using IronRuby.Compiler.Ast; - -namespace RubyBinding.Tests.Utils -{ - /// - /// Description of RubyParserHelper. - /// - public class RubyParserHelper - { - /// - /// Parses the code and returns the first statement as an assignment express. - /// - public static SimpleAssignmentExpression GetSimpleAssignmentExpression(string code) - { - return GetFirstExpression(code) as SimpleAssignmentExpression; - } - - /// - /// Parses the code and returns the first statement's expression as a method call. - /// - public static MethodCall GetMethodCall(string code) - { - return GetFirstExpression(code) as MethodCall; - } - - public static Expression GetLastExpression(string code) - { - return Parse(code).Last; - } - - static Expression GetFirstExpression(string code) - { - return Parse(code).First; - } - - static Statements Parse(string code) - { - RubyParser parser = new RubyParser(); - SourceUnitTree unit = parser.CreateAst(@"snippet.rb", new StringTextBuffer(code)); - return unit.Statements; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubySelectedTestsHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubySelectedTestsHelper.cs deleted file mode 100644 index f2a5b7333a..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/RubySelectedTestsHelper.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team -// -// 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 ICSharpCode.RubyBinding; -using ICSharpCode.SharpDevelop.Project; -using ICSharpCode.UnitTesting; -using UnitTesting.Tests.Utils; - -namespace RubyBinding.Tests.Utils -{ - public static class RubySelectedTestsHelper - { - public static SelectedTests CreateSelectedTests(IProject project) - { - return new SelectedTests(project, null, null, null); - } - - public static SelectedTests CreateSelectedTests(MockMethod method) - { - return new SelectedTests(method.MockDeclaringType.Project, null, method.MockDeclaringType, method); - } - - public static SelectedTests CreateSelectedTests(MockClass c) - { - return new SelectedTests(c.Project, null, c, null); - } - } -} diff --git a/src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddDirectoryTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddDirectoryTestFixture.cs index 1f009ae3cf..a80adaa451 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddDirectoryTestFixture.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/DirectoryImport/AddDirectoryTestFixture.cs @@ -16,16 +16,11 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using ICSharpCode.SharpDevelop.Project; +using System; +using ICSharpCode.SharpDevelop; using ICSharpCode.WixBinding; using NUnit.Framework; -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Xml; using WixBinding.Tests.PackageFiles; -using WixBinding.Tests.Utils; namespace WixBinding.Tests.DirectoryImport { diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/CodeInsertionTests.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/CodeInsertionTests.cs index 03a15dbee2..604353a77f 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/CodeInsertionTests.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/CodeInsertionTests.cs @@ -21,6 +21,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Editor.CodeCompletion; using NUnit.Framework; diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataGenerator.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataGenerator.cs index 3e2c2dfe8f..90bf20276c 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataGenerator.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataGenerator.cs @@ -214,6 +214,38 @@ namespace ICSharpCode.XamlBinding return result; } + public IEnumerable GetTypesForPropEventNameCompletion(XamlCompletionContext context, bool includeAbstract) + { + ITextEditor editor = context.Editor; + compilation = SD.ParserService.GetCompilationForFile(editor.FileName); + IUnresolvedFile file = context.ParseInformation.UnresolvedFile; + + var utd = file.GetInnermostTypeDefinition(editor.Caret.Location); + ITypeDefinition currentTypeDef = null; + if (utd != null) { + currentTypeDef = utd.Resolve(new SimpleTypeResolveContext(compilation.MainAssembly)).GetDefinition(); + } + + MemberLookup memberLookup = new MemberLookup(currentTypeDef, compilation.MainAssembly); + + var items = GetClassesFromContext(context); + + foreach (var ns in items) { + foreach (ITypeDefinition td in ns.Value) { + if (td.Kind != TypeKind.Class && (!includeAbstract || td.Kind != TypeKind.Interface)) + continue; + if (td.IsStatic || (!includeAbstract && td.IsAbstract) || td.IsDerivedFrom(KnownTypeCode.Attribute)) + continue; + if (td.Kind == TypeKind.Class && !td.GetConstructors().Any(m => memberLookup.IsAccessible(m, false))) + continue; + string fullName = td.Name; + if (!string.IsNullOrEmpty(ns.Key)) + fullName = ns.Key + ":" + fullName; + yield return new XamlCompletionItem(fullName, td); + } + } + } + void AddClosingTagCompletion(XamlContext context, DefaultCompletionItemList list, XamlAstResolver resolver) { if (context.ParentElement != null && !context.InRoot) { diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs index 479dac1373..b8029c4add 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs @@ -166,11 +166,6 @@ namespace ICSharpCode.XamlBinding return false; } - public static IEnumerable Add(this IEnumerable items, params T[] addItems) - { - return items.Concat(addItems); - } - public static string GetWordBeforeCaretExtended(this ITextEditor editor) { IDocumentLine line = editor.Document.GetLine(editor.Caret.Line); diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs index 63ec80ef17..1e6ff5ece0 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/Utils.cs @@ -144,7 +144,8 @@ namespace ICSharpCode.XamlBinding return tmp; } - public static string LookForTargetTypeValue(XamlContext context, out bool isExplicit, params string[] elementName) { + public static string LookForTargetTypeValue(XamlContext context, out bool isExplicit, params string[] elementName) + { var ancestors = context.Ancestors; isExplicit = false; diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs index eee53c0446..29b182a409 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs @@ -221,9 +221,14 @@ namespace ICSharpCode.XamlBinding // DO NOT USE generator.CreateListForContext here!!! results in endless recursion!!!! if (context.Attribute != null) { if (!DoMarkupExtensionCompletion(context)) { - var completionList = new XamlCompletionItemList(context); - completionList.PreselectionLength = editor.GetWordBeforeCaretExtended().Length; - if ((context.ActiveElement.Name == "Setter" || context.ActiveElement.Name == "EventSetter") && (context.Attribute.Name == "Property" || context.Attribute.Name == "Value")) { + XamlCompletionItemList completionList = new XamlCompletionItemList(context); + string starter = editor.GetWordBeforeCaretExtended(); + if (starter.Contains(".")) { + completionList.PreselectionLength = starter.Length - starter.IndexOf('.') - 1; + } else { + completionList.PreselectionLength = starter.Length; + } + if ((new[] { "Setter", "EventSetter" }.Any(item => context.ActiveElement.Name == item)) && (new[] { "Property", "Value", "Event", "Handler" }.Any(item => context.Attribute.Name == item))) { DoSetterAndEventSetterCompletion(context, completionList); editor.ShowCompletionWindow(completionList); } else if ((context.ActiveElement.Name.EndsWith("Trigger", StringComparison.Ordinal) || context.ActiveElement.Name == "Condition") && context.Attribute.Name == "Value") { @@ -239,7 +244,8 @@ namespace ICSharpCode.XamlBinding return false; } - void DoTriggerCompletion(XamlCompletionContext context, XamlCompletionItemList completionList) { + void DoTriggerCompletion(XamlCompletionContext context, XamlCompletionItemList completionList) + { bool isExplicit; AttributeValue value = MarkupExtensionParser.ParseValue(Utils.LookForTargetTypeValue(context, out isExplicit, "Trigger") ?? string.Empty); string typeNameString; @@ -273,13 +279,13 @@ namespace ICSharpCode.XamlBinding } } - void DoSetterAndEventSetterCompletion(XamlCompletionContext context, XamlCompletionItemList completionList) { - bool isExplicit; - string element = context.ParentElement.Name.EndsWith("Trigger", StringComparison.Ordinal) ? "Trigger" : context.ParentElement.Name; - AttributeValue value = MarkupExtensionParser.ParseValue(Utils.LookForTargetTypeValue(context, out isExplicit, element) ?? string.Empty); + void DoSetterAndEventSetterCompletion(XamlCompletionContext context, XamlCompletionItemList completionList) + { string typeNameString; - var rr = resolver.ResolveAttributeValue(context, value, out typeNameString); - IType typeName = rr.Type; + int dotIndex; + IType typeName = ResolveTargetType(context, out typeNameString, out dotIndex, + string.Equals(context.Attribute.Name, "Property") + || string.Equals(context.Attribute.Name, "Event")); MemberResolveResult mrr; switch (context.Attribute.Name) { @@ -311,6 +317,11 @@ namespace ICSharpCode.XamlBinding .Where(p => p.IsPublic && p.CanSet) .Select(prop => new XamlCompletionItem(prop)) ); + if (dotIndex == -1) { + completionList.Items.AddRange( + generator.GetTypesForPropEventNameCompletion(context, true) + ); + } break; case "Event": completionList.Items.AddRange( @@ -318,6 +329,11 @@ namespace ICSharpCode.XamlBinding .Where(e => e.IsPublic) .Select(evt => new XamlCompletionItem(evt)) ); + if (dotIndex == -1) { + completionList.Items.AddRange( + generator.GetTypesForPropEventNameCompletion(context, true) + ); + } break; case "Handler": var loc3 = context.Editor.Document.GetLocation(XmlParser.GetActiveElementStartIndex(context.Editor.Document.Text, context.Editor.Caret.Offset)); @@ -340,6 +356,28 @@ namespace ICSharpCode.XamlBinding } } + IType ResolveTargetType(XamlCompletionContext context, out string typeName, out int dotIndex, bool isPropertyOrEventName = false) + { + string targetTypeValue; + dotIndex = -1; + if (isPropertyOrEventName && context.AttributeValue.IsString) { + dotIndex = context.AttributeValue.StringValue.IndexOf('.'); + } + if (dotIndex > 0) { + targetTypeValue = context.AttributeValue.StringValue.Substring(0, dotIndex); + } else { + string element; + bool isExplicit; + if (context.ParentElement.Name.EndsWith("Trigger", StringComparison.Ordinal)) + element = "Trigger"; + else + element = context.ParentElement.Name; + targetTypeValue = Utils.LookForTargetTypeValue(context, out isExplicit, element); + } + AttributeValue value = MarkupExtensionParser.ParseValue(targetTypeValue ?? string.Empty); + return resolver.ResolveAttributeValue(context, value, out typeName).Type; + } + bool DoAttributeCompletion(XamlCompletionContext context, XamlCompletionItemList completionList) { XamlAstResolver resolver = new XamlAstResolver(compilation, context.ParseInformation); diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlConst.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlConst.cs index 6180233a48..24b083b2f5 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlConst.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlConst.cs @@ -94,14 +94,16 @@ namespace ICSharpCode.XamlBinding switch (context.Description) { case XamlContextDescription.AtTag: - if (context.ParentElement != null && string.Equals(context.ParentElement.Name, xKey + "Members", StringComparison.OrdinalIgnoreCase)) { + if (context.ParentElement == null || context.RootElement == null) + yield break; + if (string.Equals(context.ParentElement.Name, xKey + "Members", StringComparison.OrdinalIgnoreCase)) { yield return xKey + "Member"; yield return xKey + "Property"; } else if (context.ParentElement == context.RootElement && context.RootElement.Attributes.Any(attr => string.Equals(attr.Name, xKey + "Class", StringComparison.OrdinalIgnoreCase))) { yield return xKey + "Code"; yield return xKey + "Members"; } else { - if (context.ParentElement != null && string.Equals(context.ParentElement.Name, xKey + "Code", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(context.ParentElement.Name, xKey + "Code", StringComparison.OrdinalIgnoreCase)) yield break; yield return xKey + "Array"; yield return xKey + "Boolean"; diff --git a/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointBookmark.cs b/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointBookmark.cs index 6ea6bb3a16..893eb203ae 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointBookmark.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointBookmark.cs @@ -152,6 +152,10 @@ namespace Debugger.AddIn.Breakpoints return string.Format("{0} @{1}", this.FileName, this.LineNumber); } + public override bool DisplaysTooltip { + get { return true; } + } + public override object CreateTooltipContent() { return new BreakpointEditorPopup(this) { diff --git a/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointEditorPopup.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointEditorPopup.xaml.cs index d8d95b4b35..f22ae4e3ed 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointEditorPopup.xaml.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Breakpoints/BreakpointEditorPopup.xaml.cs @@ -41,7 +41,8 @@ namespace Debugger.AddIn.Breakpoints { InitializeComponent(); this.DataContext = target; - condition.DebugContext = new DebuggerCompletionContext(target.FileName, target.Location); + condition.ContextFileName = target.FileName; + condition.ContextTextLocation = target.Location; condition.FontFamily = new FontFamily(SD.EditorControlService.GlobalOptions.FontFamily); condition.FontSize = SD.EditorControlService.GlobalOptions.FontSize; if (target.Condition == null) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj index ddaadde216..1815ee4e71 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj +++ b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj @@ -105,6 +105,10 @@ + + ChooseExceptionsDialog.xaml + Code + DebuggingOptionsPanel.xaml Code @@ -319,6 +323,7 @@ + diff --git a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs index 81dc11623e..1e534faede 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/NRefactory/ExpressionEvaluationVisitor.cs @@ -114,8 +114,12 @@ namespace Debugger.AddIn public Value Convert(ResolveResult result) { - if (result.IsCompileTimeConstant && !result.IsError) - return Eval.CreateValue(evalThread, result.ConstantValue); + if (result.IsCompileTimeConstant && !result.IsError) { + var type = Import(result.Type); + if (type == null) + throw new GetValueException("Error: cannot find '{0}'.", result.Type.FullName); + return Eval.CreateValue(evalThread, result.ConstantValue, type); + } return Visit((dynamic)result); } @@ -440,7 +444,7 @@ namespace Debugger.AddIn } else throw new GetValueException("Invoked member must be a method or property"); Value target = null; - if (!usedMethod.IsStatic) + if (!usedMethod.IsStatic && !usedMethod.IsConstructor) target = Convert(result.TargetResult).GetPermanentReference(evalThread); return InvokeMethod(target, usedMethod, result.Arguments.Select(rr => Convert(rr).GetPermanentReference(evalThread)).ToArray()); } @@ -475,26 +479,33 @@ namespace Debugger.AddIn } sb.Append("}"); return sb.ToString(); - } else if (val.Type.GetAllBaseTypeDefinitions().Any(def => def.IsKnownType(KnownTypeCode.ICollection))) { - StringBuilder sb = new StringBuilder(); - sb.Append(new CSharpAmbience().ConvertType(val.Type)); - sb.Append(" {"); - val = val.GetPermanentReference(evalThread); - var countProp = val.Type.GetProperties(p => p.Name == "Count" && !p.IsExplicitInterfaceImplementation).Single(); - int count = (int)val.GetMemberValue(evalThread, countProp).PrimitiveValue; - for(int i = 0; i < count; i++) { - if (i > 0) sb.Append(", "); - var itemProperty = val.Type.GetProperties(p => p.IsIndexer && p.Name == "Item" && !p.IsExplicitInterfaceImplementation).Single(); - Value item = val.GetPropertyValue(evalThread, itemProperty, Eval.CreateValue(evalThread, i)); - sb.Append(FormatValue(evalThread, item)); + } else if (val.Type.GetAllBaseTypeDefinitions().Any(def => def.IsKnownType(KnownTypeCode.ICollection) || def.IsKnownType(KnownTypeCode.ICollectionOfT))) { + var countProp = val.Type.GetProperties(p => p.Name == "Count" && !p.IsExplicitInterfaceImplementation).SingleOrDefault(); + if (countProp != null) { + StringBuilder sb = new StringBuilder(); + sb.Append(new CSharpAmbience().ConvertType(val.Type)); + val = val.GetPermanentReference(evalThread); + int count = (int)val.GetMemberValue(evalThread, countProp).PrimitiveValue; + var itemProperty = val.Type.GetProperties(p => p.IsIndexer && p.Name == "Item" && !p.IsExplicitInterfaceImplementation).SingleOrDefault(); + if (itemProperty != null) { + sb.Append(" {"); + for (int i = 0; i < count; i++) { + if (i > 0) + sb.Append(", "); + Value item = val.GetPropertyValue(evalThread, itemProperty, Eval.CreateValue(evalThread, i)); + sb.Append(FormatValue(evalThread, item)); + } + sb.Append("}"); + } else { + sb.AppendFormat(" ({0} elements)", count); + } + return sb.ToString(); } - sb.Append("}"); - return sb.ToString(); } else if (val.Type.IsKnownType(KnownTypeCode.String) || val.Type.IsPrimitiveType()) { return TextWriterTokenWriter.PrintPrimitiveValue(val.PrimitiveValue); - } else { - return val.InvokeToString(evalThread); } + + return val.InvokeToString(evalThread); } } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml b/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml new file mode 100644 index 0000000000..1522cee9c6 --- /dev/null +++ b/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml.cs new file mode 100644 index 0000000000..e96cc000d0 --- /dev/null +++ b/src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team +// +// 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.Collections.Generic; +using System.Collections.ObjectModel; +using System.Windows; +using ICSharpCode.SharpDevelop.Gui; + +namespace Debugger.AddIn.Options +{ + /// + /// Interaction logic for ChooseExceptionsDialog.xaml + /// + public partial class ChooseExceptionsDialog : Window + { + public ChooseExceptionsDialog(IEnumerable entries) + { + InitializeComponent(); + + FormLocationHelper.ApplyWindow(this, "Debugger.ChooseExceptionsDialog", true); + + ExceptionFilterList = new ObservableCollection(entries); + dataGrid.ItemsSource = ExceptionFilterList; + } + + public IList ExceptionFilterList { get; set; } + + void Button_Click(object sender, RoutedEventArgs e) + { + DialogResult = true; + } + } +} \ No newline at end of file diff --git a/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs b/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs index 6fe518e798..8d67574a36 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs @@ -45,11 +45,6 @@ namespace ICSharpCode.SharpDevelop.Services set { PS.Set("Debugger.EnableJustMyCode", value); } } - public override bool EnableEditAndContinue { - get { return PS.Get("Debugger.EnableEditAndContinue", true); } - set { PS.Set("Debugger.EnableEditAndContinue", value); } - } - public override bool SuppressJITOptimization { get { return PS.Get("Debugger.SuppressJITOptimization", true); } set { PS.Set("Debugger.SuppressJITOptimization", value); } @@ -85,6 +80,11 @@ namespace ICSharpCode.SharpDevelop.Services set { PS.Set("Debugger.PauseOnHandledExceptions", value); } } + public override IEnumerable ExceptionFilterList { + get { return PS.GetList("Debugger.ExceptionFilterList"); } + set { PS.SetList("Debugger.ExceptionFilterList", value); } + } + public bool AskForArguments { get { return PS.Get("Debugger.AskForArguments", false); } set { PS.Set("Debugger.AskForArguments", value); } diff --git a/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml b/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml index 9a6b7c713c..3a971ab04e 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml +++ b/src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml @@ -19,15 +19,16 @@ +