Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Runtime.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<Project Path="Runtime/XSharp.Rdd.Tests/XSharp.RDD.Tests.xsproj" Id="d77877a7-f7cf-4dad-be6f-ae7a3bc9b942" />
<Project Path="Runtime/XSharp.RT.Tests/XSharp.RT.Tests.xsproj" Id="16d523f2-b871-4bdc-94ef-33b3db7ae617" />
<Project Path="Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj" Id="1f9d1d4f-4cde-4331-9ef8-d6a1d413cc6d" />
<Project Path="Runtime/XSharp.VFP.UI.Tests/XSharp.VFP.UI.Tests.xsproj" Id="27a3392e-0e6b-40d5-b8fb-fc5db9f0a0ab" />
<Project Path="Runtime/XSharp.VO.Tests/XSharp.VO.Tests.xsproj" Id="16d523f2-b871-4bdc-94ef-33b3db7ae618" />
<Project Path="Runtime/XSharp.XPP.Tests/XSharp.XPP.Tests.xsproj" Id="940ad5b6-6ccf-4bf5-936b-9366a87ba77b" />
</Folder>
Expand Down
64 changes: 64 additions & 0 deletions src/Runtime/XSharp.VFP.UI.Tests/MenuFunctionTests.prg
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// Copyright (c) XSharp B.V. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// See License.txt in the project root for license information.
//

USING System
USING XUnit

BEGIN NAMESPACE XSharp.VFP.UI.Tests
CLASS MenuFunctionTests

STATIC CONSTRUCTOR
XSharp.RuntimeState.Dialect := XSharpDialect.FoxPro
END CONSTRUCTOR

// BAR(), PAD(), POPUP() and MENU() read the last selection from MenuState.
// With no menu activated they must return the empty value, not NIL.

[Fact, Trait("Category", "MenuFunctions")];
METHOD BarReturnsZeroWhenNothingWasSelected AS VOID
Assert.Equal(0, (INT) BAR())
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD PadReturnsEmptyWhenNothingWasSelected AS VOID
Assert.Equal("", PAD())
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD PopupReturnsEmptyWhenNothingWasSelected AS VOID
Assert.Equal("", POPUP())
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD MenuReturnsEmptyWhenNothingWasSelected AS VOID
Assert.Equal("", MENU())
END METHOD

// The four lookup functions take a name. An unknown name is not an error,
// they return the empty value.

[Fact, Trait("Category", "MenuFunctions")];
METHOD MrkBarReturnsFalseForAnUnknownPopup AS VOID
Assert.False(MRKBAR("nosuchpopup", 1))
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD MrkPadReturnsFalseForAnUnknownMenu AS VOID
Assert.False(MRKPAD("nosuchmenu", "nosuchpad"))
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD PrmBarReturnsEmptyForAnUnknownPopup AS VOID
Assert.Equal("", PRMBAR("nosuchpopup", 1))
END METHOD

[Fact, Trait("Category", "MenuFunctions")];
METHOD PrmPadReturnsEmptyForAnUnknownMenu AS VOID
Assert.Equal("", PRMPAD("nosuchmenu", "nosuchpad"))
END METHOD

END CLASS
END NAMESPACE
62 changes: 62 additions & 0 deletions src/Runtime/XSharp.VFP.UI.Tests/XSharp.VFP.UI.Tests.xsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\Runtime.Sdk.props" />
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net47</TargetFrameworks>
<RootNamespace>XSharp.Runtime.VFP.UI.Tests</RootNamespace>
<Name>XSharp.VFP.UI.Tests</Name>
<Dialect>FoxPro</Dialect>
<AZ>false</AZ>
<CS>false</CS>
<LB>true</LB>
<OVF>false</OVF>
<Unsafe>true</Unsafe>
<INS>false</INS>
<NS>false</NS>
<VO13>true</VO13>
<VO14>true</VO14>
<VO15>true</VO15>
<VO16>false</VO16>
<Nostandarddefs>False</Nostandarddefs>
<NamedArgs>false</NamedArgs>
<MemVar>true</MemVar>
<Undeclared>false</Undeclared>
<InitLocals>True</InitLocals>
<NoWin32Manifest>False</NoWin32Manifest>
<Allowdot>True</Allowdot>
<Fox2>True</Fox2>
<AllowOldStyleAssignments>True</AllowOldStyleAssignments>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<PlatformTarget>AnyCPU</PlatformTarget>
<AssemblyName>XSharp.VFP.UI.Tests</AssemblyName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\XSharp.Core\XSharp.Core.xsproj" />
<ProjectReference Include="..\XSharp.RT\XSharp.RT.xsproj" />
<ProjectReference Include="..\XSharp.VFP\XSharp.VFP.xsproj" />
<ProjectReference Include="..\XSharp.VFP.UI\XSharp.VFP.UI.xsproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime">
<Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="xunit">
<Version>2.4.2</Version>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio">
<Version>2.4.3</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE;NOASSERT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DefineConstants>TRACE;NOASSERT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
<DefineConstants>DEBUG;TRACE;NOASSERT</DefineConstants>
</PropertyGroup>
</Project>