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
12 changes: 12 additions & 0 deletions src/Common/FoxProCmd.xh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@
#xcommand WAIT <msg> TO <v> [<win:WINDOW> [AT <nRow>, <nCol>]] [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> <v> := __VfpWait(<msg>, <.win.>, <!nRow!>, <!nCol!>, <.now.>, <.nclr.>, <!secs!>)

#xcommand WAIT WINDOW <msg> [AT <nRow>, <nCol>] [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> __VfpWait(<msg>, TRUE, <!nRow!>, <!nCol!>, <.now.>, <.nclr.>, <!secs!>)

#xcommand WAIT WINDOW <msg> TO <v> [AT <nRow>, <nCol>] [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> <v> := __VfpWait(<msg>, TRUE, <!nRow!>, <!nCol!>, <.now.>, <.nclr.>, <!secs!>)

#xcommand WAIT WINDOW <msg> AT <nRow>, <nCol> TO <v> [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> <v> := __VfpWait(<msg>, TRUE, <nRow>, <nCol>, <.now.>, <.nclr.>, <!secs!>)

#xcommand WAIT WINDOW TO <v> [AT <nRow>, <nCol>] [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> <v> := __VfpWait(NIL, TRUE, <!nRow!>, <!nCol!>, <.now.>, <.nclr.>, <!secs!>)

#xcommand WAIT [<win:WINDOW> [AT <nRow>, <nCol>]] [<now:NOWAIT>] [<nclr:NOCLEAR>] [TIMEOUT <secs>] ;
=> __VfpWait(NIL, <.win.>, <!nRow!>, <!nCol!>, <.now.>, <.nclr.>, <!secs!>)

Expand Down
73 changes: 73 additions & 0 deletions src/Runtime/XSharp.VFP.Tests/WaitCommandTests.prg
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
//
// 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.Tests
CLASS WaitCommandTests

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

[Fact, Trait("Category", "Wait")];
METHOD WaitWindowAcceptsTheMessageAfterTheWindowKeyword AS VOID
WAIT WINDOW "x" NOWAIT
WAIT WINDOW "x" AT 10, 20 NOWAIT
WAIT WINDOW "x" NOWAIT NOCLEAR
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitWindowWithMessageStoresTheResult AS VOID
LOCAL cKey AS STRING
cKey := "unset"
WAIT WINDOW "x" TO cKey NOWAIT
Assert.Equal("", cKey)
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitWindowAcceptsAtBeforeTo AS VOID
LOCAL cKey AS STRING
cKey := "unset"
WAIT WINDOW "x" AT 10, 20 TO cKey NOWAIT
Assert.Equal("", cKey)
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitWindowAcceptsToBeforeAt AS VOID
LOCAL cKey AS STRING
cKey := "unset"
WAIT WINDOW "x" TO cKey AT 10, 20 NOWAIT
Assert.Equal("", cKey)
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitWindowWithoutMessageStoresTheResult AS VOID
LOCAL cKey AS STRING
cKey := "unset"
WAIT WINDOW TO cKey NOWAIT
Assert.Equal("", cKey)
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitStillAcceptsTheMessageBeforeTheWindowKeyword AS VOID
LOCAL cKey AS STRING
cKey := "unset"
WAIT "x" WINDOW NOWAIT
WAIT "x" TO cKey WINDOW AT 3, 3 NOWAIT
Assert.Equal("", cKey)
END METHOD

[Fact, Trait("Category", "Wait")];
METHOD WaitWithoutMessageStillWorks AS VOID
WAIT WINDOW NOWAIT
WAIT WINDOW AT 5, 5 NOWAIT
WAIT CLEAR
END METHOD

END CLASS
END NAMESPACE
1 change: 1 addition & 0 deletions src/Runtime/XSharp.VFP.Tests/XSharp.VFP.Tests.xsproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<Compile Include="StringTests.prg" />
<Compile Include="UdcCommandFixTests.prg" />
<Compile Include="VfpStringFunctionsTests.prg" />
<Compile Include="WaitCommandTests.prg" />
<Compile Include="WrappedStubsTests.prg" />
</ItemGroup>
<ItemGroup>
Expand Down