Skip to content

Commit

Permalink
adding more logging and delay 2 second between present testVC and tes…
Browse files Browse the repository at this point in the history
…t start up (#2767)
  • Loading branch information
yiyang-msft authored Jun 9, 2017
1 parent a8293ba commit 2d430f1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/functionaltests/Tests/UIKitTests/UIButtonTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,8 @@ - (void)dealloc {
TEST_METHOD(UIButton_ImageEdgeInsets) {
StrongId<UIButtonWithControlsViewController> buttonVC;
buttonVC.attach([[UIButtonWithControlsViewController alloc] init]);
UXTestAPI::ViewControllerPresenter testHelper(buttonVC);
UXTestAPI::ViewControllerPresenter testHelper(buttonVC, 2);
LOG_INFO("UIButton_ImageEdgeInsets - present VC");

UIButton* buttonToTest = [buttonVC defaultButton];

Expand All @@ -1299,6 +1300,7 @@ - (void)dealloc {
// Extract UIButton.imageView control to verify its visual state
FrameworkElement xamlElement = [buttonToTest.imageView _winrtXamlElement];
ASSERT_TRUE(xamlElement);
LOG_INFO("UIButton_ImageEdgeInsets - retrieve backing xaml element");

dispatch_sync(dispatch_get_main_queue(), ^{
[buttonVC textImageStateField].text = @"N;";
Expand All @@ -1307,27 +1309,31 @@ - (void)dealloc {
// Register RAII event subscription handler
xamlWidthSubscriber->Set(xamlElement, FrameworkElement::WidthProperty(), ^(const DependencyObject& sender, const DependencyProperty& dp) {
double width = DoubleFromPropertyValue(sender.GetValue(dp));
LOG_INFO("UIButton_ImageEdgeInsets - width changed");

// Validation
EXPECT_EQ(width, 40.0f);
uxEvent->Set();
});
xamlHeightSubscriber->Set(xamlElement, FrameworkElement::HeightProperty(), ^(const DependencyObject& sender, const DependencyProperty& dp) {
double height = DoubleFromPropertyValue(sender.GetValue(dp));
LOG_INFO("UIButton_ImageEdgeInsets - height changed");

// Validation
EXPECT_EQ(height, 40.0f);
uxEvent->Set();
});
xamlCanvasLeftSubscriber->Set(xamlElement, Controls::Canvas::LeftProperty(), ^(const DependencyObject& sender, const DependencyProperty& dp) {
double left = DoubleFromPropertyValue(sender.GetValue(dp));
LOG_INFO("UIButton_ImageEdgeInsets - left changed");

// Validation
EXPECT_EQ(left, 80.0f);
uxEvent->Set();
});
xamlCanvasTopSubscriber->Set(xamlElement, Controls::Canvas::TopProperty(), ^(const DependencyObject& sender, const DependencyProperty& dp) {
double top = DoubleFromPropertyValue(sender.GetValue(dp));
LOG_INFO("UIButton_ImageEdgeInsets - top changed");

// Validation
EXPECT_EQ(top, 80.0f);
Expand All @@ -1336,9 +1342,10 @@ - (void)dealloc {

// Action
[buttonVC textImageEdgeInsets].text = @"{80.0f, 80.0f, 80.0f, 80.0f}";
LOG_INFO("UIButton_ImageEdgeInsets - trigger imedgeEdgeInsets properties to change");
});

ASSERT_TRUE_MSG(uxEvent->Wait(c_testTimeoutInSec, 4 /* signal count */), "FAILED: Waiting for property changed events timed out!");
ASSERT_TRUE_MSG(uxEvent->Wait(c_testTimeoutInSec, 4 /* signal count */), "FAILED: Waiting for property changed events timed out after 4 seconds!");
}

TEST_METHOD(UIButton_CurrentTitle) {
Expand Down

0 comments on commit 2d430f1

Please sign in to comment.