Skip to content

Commit

Permalink
8167: Fix TabTests - use tab 0 rather than value 0 (#8168)
Browse files Browse the repository at this point in the history
A fix for UTs crashing due to bad memory access (accessing page 0).
Regression from #8153
Closes #8167
  • Loading branch information
Don-Vito authored Nov 5, 2020
1 parent 6639df9 commit 5de4f98
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/cascadia/LocalTests_TerminalApp/TabTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ namespace TerminalAppLocalTests
ActionEventArgs eventArgs{ args };
// eventArgs.Args(args);
page->_HandleSplitPane(nullptr, eventArgs);
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));

VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
Expand All @@ -612,7 +612,7 @@ namespace TerminalAppLocalTests
result = RunOnUIThread([&page]() {
ActionEventArgs eventArgs{};
page->_HandleTogglePaneZoom(nullptr, eventArgs);
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_TRUE(firstTab->IsZoomed());
});
Expand All @@ -622,7 +622,7 @@ namespace TerminalAppLocalTests
result = RunOnUIThread([&page]() {
ActionEventArgs eventArgs{};
page->_HandleTogglePaneZoom(nullptr, eventArgs);
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
});
Expand All @@ -639,7 +639,7 @@ namespace TerminalAppLocalTests
SplitPaneArgs args{ SplitType::Duplicate };
ActionEventArgs eventArgs{ args };
page->_HandleSplitPane(nullptr, eventArgs);
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));

VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
Expand All @@ -653,7 +653,7 @@ namespace TerminalAppLocalTests

page->_HandleTogglePaneZoom(nullptr, eventArgs);

auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_TRUE(firstTab->IsZoomed());
});
Expand All @@ -667,7 +667,7 @@ namespace TerminalAppLocalTests

page->_HandleMoveFocus(nullptr, eventArgs);

auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
});
Expand All @@ -684,7 +684,7 @@ namespace TerminalAppLocalTests
SplitPaneArgs args{ SplitType::Duplicate };
ActionEventArgs eventArgs{ args };
page->_HandleSplitPane(nullptr, eventArgs);
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));

VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
Expand All @@ -698,7 +698,7 @@ namespace TerminalAppLocalTests

page->_HandleTogglePaneZoom(nullptr, eventArgs);

auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(2, firstTab->GetLeafPaneCount());
VERIFY_IS_TRUE(firstTab->IsZoomed());
});
Expand All @@ -711,7 +711,7 @@ namespace TerminalAppLocalTests

page->_HandleClosePane(nullptr, eventArgs);

auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_IS_FALSE(firstTab->IsZoomed());
});
VERIFY_SUCCEEDED(result);
Expand All @@ -722,7 +722,7 @@ namespace TerminalAppLocalTests
Log::Comment(L"Check to ensure there's only one pane left.");

result = RunOnUIThread([&page]() {
auto firstTab = page->_GetTerminalTabImpl(0);
auto firstTab = page->_GetTerminalTabImpl(page->_tabs.GetAt(0));
VERIFY_ARE_EQUAL(1, firstTab->GetLeafPaneCount());
VERIFY_IS_FALSE(firstTab->IsZoomed());
});
Expand Down

0 comments on commit 5de4f98

Please sign in to comment.