Summary: I'm trying to fix some bugs I introduced in my latest PR, but while writing the Unit Tests for them, I saw a really weird behaviour. The following exact piece of code WORKS inside a Yoga C++ unit test, but fails from a Objective-C unit test. I had me completely confused and blocked me in my progression. Any ideas? ``` TEST(YogaTest, stupid_test) { const YGNodeRef node = YGNodeNew(); YGNodeStyleSetPosition(node, YGEdgeLeft, 1); ASSERT_FLOAT_EQ(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value); ASSERT_EQ(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit); YGNodeFree(node); } ``` ``` - (void)testPositionalPropertiesWork { YGNodeRef node = YGNodeNew(); YGNodeStyleSetPosition(node, YGEdgeLeft, 1); XCTAssertEqual(1, YGNodeStyleGetPosition(node, YGEdgeLeft).value); XCTAssertEqual(YGUnitPixel, YGNodeStyleGetPosition(node, YGEdgeLeft).unit); YGNodeFree(node); } ``` Closes https://github.com/facebook/yoga/pull/328 Reviewed By: dshahidehpour Differential Revision: D4421504 Pulled By: emilsjolander fbshipit-source-id: f59379edf70aee87a77cd1ad2986313cdfe71b94
20 lines
486 B
Objective-C
20 lines
486 B
Objective-C
/**
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import "YGLayout.h"
|
|
#import <yoga/Yoga.h>
|
|
|
|
@interface YGLayout ()
|
|
|
|
@property (nonatomic, assign, readonly) YGNodeRef node;
|
|
|
|
- (instancetype)initWithView:(UIView *)view;
|
|
|
|
@end
|