Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #import "Preprocessor.h"
  2. #import <XCTest/XCTest.h>
  3. #import <UnityFramework/UnityFramework.h>
  4. @interface UnityAppController (RenderingForTest)
  5. - (void)repaintDisplayLink;
  6. @end
  7. @interface UnityTest : XCTestCase
  8. @end
  9. @implementation UnityTest
  10. - (void)testRunUnity
  11. {
  12. XCTestExpectation *expectation = [self expectationWithDescription: @"testRunUnity"];
  13. __block bool running = true;
  14. id<UIApplicationDelegate> delegate = [(UIApplication*)[UIApplication sharedApplication] delegate];
  15. [delegate performSelector: @selector(setQuitHandler:) withObject:^{
  16. [expectation fulfill];
  17. running = false;
  18. }];
  19. // When Apple TV device doesn't have attached monitor or TV it doesn't run display link. So we force
  20. // player loop here.
  21. #if PLATFORM_TVOS
  22. UnityAppController* unityApp = [(UIApplication*)[UIApplication sharedApplication] delegate];
  23. while (running)
  24. {
  25. // we need to call repaintDisplayLink instead of simple repaint to trigger UnityDisplayLinkCallback which will advance frame time internally
  26. [unityApp repaintDisplayLink];
  27. [[NSRunLoop mainRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 0.001f]];
  28. }
  29. #endif
  30. [self waitForExpectationsWithTimeout: 1000000 handler: nil];
  31. }
  32. @end