diff --git a/CRCarplayWindow.mm b/CRCarplayWindow.mm index 97ca956..21bf9da 100644 --- a/CRCarplayWindow.mm +++ b/CRCarplayWindow.mm @@ -20,6 +20,7 @@ id getCarplayCADisplay(void) return display; } } + return nil; } diff --git a/Makefile b/Makefile index 8877824..d4c32a6 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,5 @@ after-install:: install.exec "killall -9 SpringBoard CarPlay" test:: - install.exec "cycript -p SpringBoard" < tests.cy \ No newline at end of file + install.exec "cycript -p SpringBoard" < tests/springboard_tests.cy + install.exec "cycript -p CarPlay" < tests/carplay_tests.cy \ No newline at end of file diff --git a/tests/carplay_tests.cy b/tests/carplay_tests.cy new file mode 100644 index 0000000..96723a8 --- /dev/null +++ b/tests/carplay_tests.cy @@ -0,0 +1,18 @@ +function assert_not_null(cond, desc) { + if (typeof cond === "undefined" || cond === null) { + [NSException raise:@"Carplay Test Failed" format:desc]; + } +} + +function test_app_library_includes_all_apps() +{ + // When an application library is created + appLibrary = [CARApplication _newApplicationLibrary]; + assert_not_null(appLibrary, @"_newApplicationLibrary is NULL"); + + // It includes apps that are normally excluded/unsupported + appInfo = [appLibrary applicationInfoForBundleIdentifier: @"com.netflix.Netflix"]; + assert_not_null(appInfo, @"app library did not include unsupported apps"); +} + +test_app_library_includes_all_apps(); \ No newline at end of file diff --git a/tests.cy b/tests/springboard_tests.cy similarity index 57% rename from tests.cy rename to tests/springboard_tests.cy index 464f4f8..14754ec 100644 --- a/tests.cy +++ b/tests/springboard_tests.cy @@ -1,43 +1,44 @@ - -function assert_not_null(a) { - if (typeof a === "undefined" || a === null) { - NSLog("FAIL: " + a + " === nil"); +function assert_not_null(cond, desc) +{ + if (typeof cond === "undefined" || cond === null) { + [NSException raise:@"Carplay Test Failed" format:desc]; } } -function assert_equal(a, b) { +function assert_equal(a, b, desc) +{ if (![a isEqual:b]) { - NSLog("FAIL: " + a + " !== " + b); + [NSException raise:@"Carplay Test Failed" format:desc]; } } function validate_live_window(window) { - assert_not_null(window); + assert_not_null(window, @"carplay window does not exist"); // The root window was created and visible rootWindow = [window rootWindow]; - assert_not_null(rootWindow); - assert_equal([rootWindow isHidden], @(NO)); + assert_not_null(rootWindow, @"rootWindow is null"); + assert_equal([rootWindow isHidden], @(NO), @"rootWindow is not visible"); // The splash imageview was created splash_image_view = [window launchImageView]; - assert_not_null(splash_image_view); + assert_not_null(splash_image_view, @"failed to create splash image view"); // And it has an image splash_image = [splash_image_view image]; - assert_not_null(splash_image); + assert_not_null(splash_image, @"failed to create splash image"); - assert_not_null([window application]); - assert_not_null([window appViewController]); - assert_not_null([window dockView]); - assert_not_null([window sceneMonitor]); + assert_not_null([window application], @"failed to create sbapplication"); + assert_not_null([window appViewController], @"failed to create app controller"); + assert_not_null([window dockView], @"failed to create dock view"); + assert_not_null([window sceneMonitor], @"failed to create scenemonitor"); // It is not in fullscreen mode - assert_equal([window isFullscreen], @(NO)); + assert_equal([window isFullscreen], @(NO), @"rootWindow started in fullscreen"); // It starts in landscape - assert_equal([window orientation], @(3)); + assert_equal([window orientation], @(3), @"window started in unexpected orientation"); } function launch_window_device_locked() @@ -74,7 +75,6 @@ function launch_window_device_unlocked() [live_window dismiss]; } - launch_window_device_locked(); sleep(1);