VLC_for_iOSTestVideoCodecs.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*****************************************************************************
  2. * VLC_for_iOSTestVideoCodecs.m
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2018 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Author: Carola Nitz <caro # videolan.org>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. #import <XCTest/XCTest.h>
  13. @interface XCUIElement(Test)
  14. - (void)clearAndEnterText:(NSString *)text;
  15. @end
  16. @implementation XCUIElement(Test)
  17. - (void)clearAndEnterText:(NSString *)text {
  18. if( ![[self value] isKindOfClass:[NSString class]]) {
  19. XCTFail("Tried to clear and enter text into a non string value");
  20. return;
  21. }
  22. [self tap];
  23. NSString *deleteString = @"";
  24. for (int i = 0; i < [(NSString *)[self value] length]; i++){
  25. deleteString = [deleteString stringByAppendingString:XCUIKeyboardKeyDelete];
  26. }
  27. [self typeText:deleteString];
  28. [self typeText:text];
  29. }
  30. @end
  31. @interface VLC_for_iOSTestVideoCodecs : XCTestCase
  32. @end
  33. @implementation VLC_for_iOSTestVideoCodecs
  34. - (void)setUp {
  35. [super setUp];
  36. self.continueAfterFailure = YES;
  37. [[[XCUIApplication alloc] init] launch];
  38. [[XCUIDevice sharedDevice] setOrientation:UIDeviceOrientationFaceUp];
  39. }
  40. - (void)tearDown {
  41. // Put teardown code here. This method is called after the invocation of each test method in the class.
  42. [super tearDown];
  43. }
  44. - (void)testMovCodec
  45. {
  46. [self playWithFilename:@"rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov"];
  47. }
  48. - (void)testHEVCCodec10b
  49. {
  50. [self playWithFilename:@"http://jell.yfish.us/media/jellyfish-90-mbps-hd-hevc-10bit.mkv"];
  51. }
  52. - (void)testHEVCCodec
  53. {
  54. [self playWithFilename:@"http://jell.yfish.us/media/jellyfish-25-mbps-hd-hevc.mkv"];
  55. }
  56. - (void)testH264Codec
  57. {
  58. [self playWithFilename:@"http://jell.yfish.us/media/jellyfish-25-mbps-hd-h264.mkv"];
  59. }
  60. - (void)playWithFilename:(NSString *)filename
  61. {
  62. XCUIApplication *app = [[XCUIApplication alloc] init];
  63. [app.navigationBars[@"All Files"].buttons[@"Open VLC sidebar menu"] tap];
  64. [app.cells.staticTexts[@"Network Stream"] tap];
  65. XCUIElement *httpMyserverComFileMkvTextField = app.textFields.allElementsBoundByIndex.firstObject;
  66. [httpMyserverComFileMkvTextField clearAndEnterText:filename];
  67. [[[XCUIApplication alloc] init].buttons[@"Open Network Stream"] tap];
  68. XCUIElement *displayTime = app.buttons[@"--:--"];
  69. __block NSPredicate *predicate = [NSPredicate predicateWithFormat:@"exists == 0"];
  70. [self expectationForPredicate:predicate evaluatedWithObject:displayTime handler:nil];
  71. //we wait for the displaytime to change
  72. [self waitForExpectationsWithTimeout:20.0 handler:^(NSError * _Nullable error) {
  73. //once it changes we tap the videoplayer to bring up the playelements
  74. [app.otherElements[@"Video Player"] doubleTap];
  75. XCUIElement *playpause = app.buttons[@"Play or Pause current playback"];
  76. predicate = [NSPredicate predicateWithFormat:@"exists == 1"];
  77. [self expectationForPredicate:predicate evaluatedWithObject:playpause handler:nil];
  78. [self waitForExpectationsWithTimeout:20.0 handler:nil];
  79. }];
  80. }
  81. @end