23 lines
1.5 KiB
C#
23 lines
1.5 KiB
C#
using PlotDirector.Companion.Protocol;
|
|
|
|
internal static class SharedFocusTests
|
|
{
|
|
public static void Run(Action<bool,string> check)
|
|
{
|
|
var a=new FocusWindowState();var b=new FocusWindowState();var origin=Guid.NewGuid();
|
|
check(!a.Held&&!b.Held&&a.Id!=b.Id,"new Word windows follow with independent identities");
|
|
check(a.Observe(10,10,false)==0&&a.Observe(20,20,false)==0,"passive Word observations never publish");
|
|
check(a.Observe(30,30,true)==1&&a.Observe(30,30,true)==0,"deliberate changed selection publishes once");
|
|
var mode=a.ModeRequest;a.Hold(true);
|
|
check(a.Held&&!b.Held&&a.ModeRequest!=mode,"holding Word affects only that window");
|
|
check(a.Observe(40,40,true)==0&&a.Sequence==1,"held selection remains local without consuming a publication");
|
|
check(!a.Accept(4,origin)&&a.LastSharedRevision==4,"held window records latest shared revision without navigation");
|
|
a.Hold(false);
|
|
check(a.Sequence==1&&a.Accept(4,origin),"release catches latest focus without publishing held position");
|
|
check(!a.Accept(4,origin)&&!a.Accept(3,origin),"duplicate and delayed Word focus deliveries cannot navigate again");
|
|
check(!a.Accept(5,a.Id)&&a.LastSharedRevision==5,"originating Word window does not echo its own selection");
|
|
a.Hold(true);a.Observe(50,50,true);a.Hold(false);check(a.Accept(5,a.Id),"release returns to shared reference even when this same Word window originally published it");
|
|
check(b.Accept(5,a.Id),"another following Word window can receive that selection");
|
|
}
|
|
}
|