Make MTLView content mode settable.
We want to allow the application to set it's own content mode. Bug: b/73147161 Change-Id: I60fab454353a4c39731e49b7b6066e51d8e9a94d Reviewed-on: https://webrtc-review.googlesource.com/70501 Commit-Queue: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Anders Carlsson <andersc@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22962}
This commit is contained in:
parent
6847f9b490
commit
4049a25afd
@ -97,6 +97,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setVideoContentMode:(UIViewContentMode)mode {
|
||||
_metalView.contentMode = mode;
|
||||
}
|
||||
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)layoutSubviews {
|
||||
|
||||
@ -32,7 +32,11 @@ NS_CLASS_AVAILABLE_IOS(9)
|
||||
|
||||
RTC_EXPORT
|
||||
@interface RTCMTLVideoView : UIView <RTCVideoRenderer>
|
||||
|
||||
@property(nonatomic, weak) id<RTCVideoViewDelegate> delegate;
|
||||
|
||||
- (void)setVideoContentMode:(UIViewContentMode)mode;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#import <XCTest/XCTest.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <MetalKit/MetalKit.h>
|
||||
#import <OCMock/OCMock.h>
|
||||
|
||||
#include <WebRTC/RTCMTLVideoView.h>
|
||||
@ -258,4 +259,17 @@
|
||||
OCMVerifyAllWithDelay(delegateMock, 1);
|
||||
}
|
||||
|
||||
- (void)testSetContentMode {
|
||||
OCMStub([self.classMock isMetalAvailable]).andReturn(YES);
|
||||
id metalKitView = OCMClassMock([MTKView class]);
|
||||
[[[[self.classMock stub] ignoringNonObjectArgs] andReturn:metalKitView]
|
||||
createMetalView:CGRectZero];
|
||||
OCMExpect([metalKitView setContentMode:UIViewContentModeScaleAspectFill]);
|
||||
|
||||
RTCMTLVideoView *realView = [[RTCMTLVideoView alloc] init];
|
||||
[realView setVideoContentMode:UIViewContentModeScaleAspectFill];
|
||||
|
||||
OCMVerify(metalKitView);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user