tests: updated TTestMenuIntf.TestPopupMenuVisible

git-svn-id: trunk@55258 -
This commit is contained in:
mattias 2017-06-06 10:19:45 +00:00
parent 7c8ca9d30a
commit b3dd2c09cb
2 changed files with 42 additions and 42 deletions

View File

@ -225,87 +225,87 @@ begin
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
Item1:=RegisterIDEMenuCommand(LogSection1,'Item1','Item1'); Item1:=RegisterIDEMenuCommand(LogSection1,'Item1','Item1');
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection1.VisibleActive',true,LogSection1.VisibleActive); AssertEquals('A LogSection1.VisibleActive',true,LogSection1.VisibleActive);
AssertEquals('LogSection1.VisibleCommandCount',1,LogSection1.VisibleCommandCount); AssertEquals('A LogSection1.VisibleCommandCount',1,LogSection1.VisibleCommandCount);
SubMenu2:=RegisterIDESubMenu(PopupMenuRoot,'SubMenu2','SubMenu2'); SubMenu2:=RegisterIDESubMenu(PopupMenuRoot,'SubMenu2','SubMenu2');
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
Item2:=RegisterIDEMenuCommand(SubMenu2,'Item2','Item2'); Item2:=RegisterIDEMenuCommand(SubMenu2,'Item2','Item2');
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('SubMenu2.VisibleActive',true,SubMenu2.VisibleActive); AssertEquals('B SubMenu2.VisibleActive',true,SubMenu2.VisibleActive);
AssertEquals('SubMenu2.VisibleCommandCount',1,SubMenu2.VisibleCommandCount); AssertEquals('B SubMenu2.VisibleCommandCount',1,SubMenu2.VisibleCommandCount);
LogSection2:=RegisterIDEMenuSection(PopupMenuRoot,'LogSection2'); LogSection2:=RegisterIDEMenuSection(PopupMenuRoot,'LogSection2');
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
Item3:=RegisterIDEMenuCommand(LogSection2,'Item3','Item3'); Item3:=RegisterIDEMenuCommand(LogSection2,'Item3','Item3');
Item4:=RegisterIDEMenuCommand(LogSection2,'Item4','Item4'); Item4:=RegisterIDEMenuCommand(LogSection2,'Item4','Item4');
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection2.VisibleActive',true,LogSection2.VisibleActive); AssertEquals('C LogSection2.VisibleActive',true,LogSection2.VisibleActive);
AssertEquals('LogSection2.VisibleCommandCount',2,LogSection2.VisibleCommandCount); AssertEquals('C LogSection2.VisibleCommandCount',2,LogSection2.VisibleCommandCount);
AssertEquals('LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil); AssertEquals('D LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil);
AssertEquals('LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil); AssertEquals('D LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil);
AssertEquals('LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil); AssertEquals('D LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil);
AssertEquals('LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil); AssertEquals('D LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil);
// hide Item1 -> auto hides LogSection1 // hide Item1 -> auto hides LogSection1
Item1.Visible:=false; Item1.Visible:=false;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection1.VisibleActive',false,LogSection1.VisibleActive); AssertEquals('E LogSection1.VisibleActive',false,LogSection1.VisibleActive);
AssertEquals('LogSection1.VisibleCommandCount',0,LogSection1.VisibleCommandCount); AssertEquals('E LogSection1.VisibleCommandCount',0,LogSection1.VisibleCommandCount);
AssertEquals('LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil); AssertEquals('E LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil);
AssertEquals('LogSection1.BottomSeparator',false,LogSection1.BottomSeparator<>nil); AssertEquals('E LogSection1.BottomSeparator',false,LogSection1.BottomSeparator<>nil);
// show Item1 -> auto shows LogSection1 // show Item1 -> auto shows LogSection1
Item1.Visible:=true; Item1.Visible:=true;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection1.VisibleActive',true,LogSection1.VisibleActive); AssertEquals('F LogSection1.VisibleActive',true,LogSection1.VisibleActive);
AssertEquals('LogSection1.VisibleCommandCount',1,LogSection1.VisibleCommandCount); AssertEquals('F LogSection1.VisibleCommandCount',1,LogSection1.VisibleCommandCount);
AssertEquals('LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil); AssertEquals('F LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil);
AssertEquals('LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil); AssertEquals('F LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil);
// hide Item2 -> auto hides SubMenu2 // hide Item2 -> auto hides SubMenu2
Item2.Visible:=false; Item2.Visible:=false;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('SubMenu2.VisibleActive',false,SubMenu2.VisibleActive); AssertEquals('G SubMenu2.VisibleActive',false,SubMenu2.VisibleActive);
AssertEquals('SubMenu2.VisibleCommandCount',0,SubMenu2.VisibleCommandCount); AssertEquals('G SubMenu2.VisibleCommandCount',0,SubMenu2.VisibleCommandCount);
AssertEquals('LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil); AssertEquals('G LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil);
AssertEquals('LogSection1.BottomSeparator',false,LogSection1.BottomSeparator<>nil); AssertEquals('G LogSection1.BottomSeparator',false,LogSection1.BottomSeparator<>nil);
AssertEquals('LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil); AssertEquals('G LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil);
AssertEquals('LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil); AssertEquals('G LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil);
// show Item2 -> auto shows SubMenu2 // show Item2 -> auto shows SubMenu2
Item2.Visible:=true; Item2.Visible:=true;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('SubMenu2.VisibleActive',true,SubMenu2.VisibleActive); AssertEquals('H SubMenu2.VisibleActive',true,SubMenu2.VisibleActive);
AssertEquals('SubMenu2.VisibleCommandCount',1,SubMenu2.VisibleCommandCount); AssertEquals('H SubMenu2.VisibleCommandCount',1,SubMenu2.VisibleCommandCount);
AssertEquals('LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil); AssertEquals('H LogSection1.TopSeparator',false,LogSection1.TopSeparator<>nil);
AssertEquals('LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil); AssertEquals('H LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil);
AssertEquals('LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil); AssertEquals('H LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil);
AssertEquals('LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil); AssertEquals('H LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil);
// hide Item3, Item4 still visible // hide Item3, Item4 still visible
Item3.Visible:=false; Item3.Visible:=false;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection2.VisibleActive',true,LogSection2.VisibleActive); AssertEquals('I LogSection2.VisibleActive',true,LogSection2.VisibleActive);
AssertEquals('LogSection2.VisibleCommandCount',1,LogSection2.VisibleCommandCount); AssertEquals('I LogSection2.VisibleCommandCount',1,LogSection2.VisibleCommandCount);
// hide Item4 -> auto hide LogSection2 // hide Item4 -> auto hide LogSection2
Item4.Visible:=false; Item4.Visible:=false;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection2.VisibleActive',false,LogSection2.VisibleActive); AssertEquals('J LogSection2.VisibleActive',false,LogSection2.VisibleActive);
AssertEquals('LogSection2.VisibleCommandCount',0,LogSection2.VisibleCommandCount); AssertEquals('J LogSection2.VisibleCommandCount',0,LogSection2.VisibleCommandCount);
AssertEquals('LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil); AssertEquals('J LogSection1.BottomSeparator',true,LogSection1.BottomSeparator<>nil);
AssertEquals('LogSection2.TopSeparator',false,LogSection2.TopSeparator<>nil); AssertEquals('J LogSection2.TopSeparator',false,LogSection2.TopSeparator<>nil);
AssertEquals('LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil); AssertEquals('J LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil);
// show Item3 -> auto shows LogSection2 // show Item3 -> auto shows LogSection2
Item3.Visible:=true; Item3.Visible:=true;
PopupMenuRoot.ConsistencyCheck; PopupMenuRoot.ConsistencyCheck;
AssertEquals('LogSection2.VisibleActive',true,LogSection2.VisibleActive); AssertEquals('K LogSection2.VisibleActive',true,LogSection2.VisibleActive);
AssertEquals('LogSection2.VisibleCommandCount',1,LogSection2.VisibleCommandCount); AssertEquals('K LogSection2.VisibleCommandCount',1,LogSection2.VisibleCommandCount);
AssertEquals('LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil); AssertEquals('K LogSection2.TopSeparator',true,LogSection2.TopSeparator<>nil);
AssertEquals('LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil); AssertEquals('K LogSection2.BottomSeparator',false,LogSection2.BottomSeparator<>nil);
end; end;
procedure TTestMenuIntf.TestPopupMenuClearHiddenSection; procedure TTestMenuIntf.TestPopupMenuClearHiddenSection;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags> <Flags>