From dfda4ba3fbc0c2d4253a1ff8eadc0749d4c9a7ad Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Thu, 20 Dec 2018 15:14:12 -0500 Subject: [PATCH 1/2] Blank artwork is now created if `null` --- .../smartdevicelink/managers/screen/TextAndGraphicManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java b/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java index 3cad283e99..4a25fc12ba 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java +++ b/sdl_android/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicManager.java @@ -662,7 +662,7 @@ private List findNonNullMetadataFields(){ SdlArtwork getBlankArtwork(){ - if (blankArtwork != null){ + if (blankArtwork == null){ blankArtwork = new SdlArtwork(); blankArtwork.setType(FileType.GRAPHIC_PNG); blankArtwork.setName("blankArtwork"); From 4fc26cb3d29e3f667362fa73247fe62b5583a82b Mon Sep 17 00:00:00 2001 From: NicoleYarroch Date: Thu, 20 Dec 2018 15:16:36 -0500 Subject: [PATCH 2/2] Added test cases for blank artworks --- .../managers/screen/ScreenManagerTests.java | 12 ++++++++++++ .../managers/screen/TextAndGraphicManagerTests.java | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java index e5f5803be2..872e09b815 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/ScreenManagerTests.java @@ -81,11 +81,23 @@ public void testSetPrimaryGraphic() { assertEquals(screenManager.getPrimaryGraphic(), testArtwork); } + public void testSetPrimaryGraphicWithBlankImage() { + screenManager.setPrimaryGraphic(null); + assertNotNull(screenManager.getPrimaryGraphic()); + assertEquals(screenManager.getPrimaryGraphic().getName(), "blankArtwork"); + } + public void testSetSecondaryGraphic() { screenManager.setSecondaryGraphic(testArtwork); assertEquals(screenManager.getSecondaryGraphic(), testArtwork); } + public void testSetSecondaryGraphicWithBlankImage() { + screenManager.setSecondaryGraphic(null); + assertNotNull(screenManager.getSecondaryGraphic()); + assertEquals(screenManager.getSecondaryGraphic().getName(), "blankArtwork"); + } + public void testAlignment() { screenManager.setTextAlignment(TextAlignment.LEFT_ALIGNED); assertEquals(screenManager.getTextAlignment(), TextAlignment.LEFT_ALIGNED); diff --git a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java index aaad2df24f..d063f52e30 100644 --- a/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java +++ b/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicManagerTests.java @@ -113,6 +113,7 @@ public void testInstantiation(){ assertEquals(textAndGraphicManager.currentHMILevel, HMILevel.HMI_NONE); assertFalse(textAndGraphicManager.isDirty); assertEquals(textAndGraphicManager.getState(), BaseSubManager.SETTING_UP); + assertNotNull(textAndGraphicManager.getBlankArtwork()); } public void testGetMainLines(){ @@ -533,7 +534,7 @@ public void testDispose() { assertNull(textAndGraphicManager.getTextField2Type()); assertNull(textAndGraphicManager.getTextField3Type()); assertNull(textAndGraphicManager.getTextField4Type()); - assertNull(textAndGraphicManager.getBlankArtwork()); + assertNotNull(textAndGraphicManager.getBlankArtwork()); assertNull(textAndGraphicManager.currentScreenData); assertNull(textAndGraphicManager.inProgressUpdate); assertNull(textAndGraphicManager.queuedImageUpdate);