diff options
author | Julian Kast <julian.kast@live.com> | 2022-09-21 16:45:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 16:45:33 -0400 |
commit | 2a0b6552d79e8f2de4904dc32f6cbb4e0824e605 (patch) | |
tree | f211c22766a0df9eb6dc791caea6a2cb9eb641db | |
parent | 44b38cb3766f2685aee586db0ede1d00dffd19e4 (diff) | |
download | sdl_android-2a0b6552d79e8f2de4904dc32f6cbb4e0824e605.tar.gz |
Update current screen data in T&G manager with template config (#1834)
* update current screen data in T&G manager with template config
* Fix unit test to cover template config change
* Remove line form unit test that didn't make sense
* Fix unitTest from mergConflicts
2 files changed, 11 insertions, 7 deletions
diff --git a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java index 464dbb11f..d2a821e23 100644 --- a/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java +++ b/android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java @@ -69,7 +69,7 @@ public class TextAndGraphicUpdateOperationTest { private CompletionListener listener; private TextAndGraphicManager.CurrentScreenDataUpdatedListener currentScreenDataUpdatedListener; private SdlArtwork blankArtwork; - private TemplateConfiguration configuration, configurationFail; + private TemplateConfiguration configuration, configurationFail, configurationOld; ISdl internalInterface; FileManager fileManager; @@ -246,6 +246,8 @@ public class TextAndGraphicUpdateOperationTest { configuration = new TemplateConfiguration(); configuration.setTemplate(PredefinedLayout.GRAPHIC_WITH_TEXT.toString()); + configurationOld = new TemplateConfiguration(); + configurationOld.setTemplate(PredefinedLayout.TEXT_WITH_GRAPHIC.toString()); configurationFail = new TemplateConfiguration(); configurationFail.setTemplate("failConfiguration"); @@ -276,7 +278,7 @@ public class TextAndGraphicUpdateOperationTest { currentScreenData.setPrimaryGraphic(testArtwork1); currentScreenData.setSecondaryGraphic(testArtwork2); - currentScreenData.setTemplateConfiguration(configuration); + currentScreenData.setTemplateConfiguration(configurationOld); currentScreenDataUpdatedListener = new TextAndGraphicManager.CurrentScreenDataUpdatedListener() { @Override @@ -1047,7 +1049,6 @@ public class TextAndGraphicUpdateOperationTest { mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type, configuration); textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener); textAndGraphicUpdateOperation.onExecute(); - assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration().getStore(), configuration.getStore()); // Verifies that uploadArtworks does not get called because a sendShow failed with text and layout change verify(fileManager, times(0)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class)); @@ -1080,7 +1081,7 @@ public class TextAndGraphicUpdateOperationTest { TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type()); - assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); + assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); } @Test @@ -1120,7 +1121,7 @@ public class TextAndGraphicUpdateOperationTest { TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type()); - assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); + assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); } @Test @@ -1160,7 +1161,7 @@ public class TextAndGraphicUpdateOperationTest { TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type()); - assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); + assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); } @Test @@ -1200,6 +1201,6 @@ public class TextAndGraphicUpdateOperationTest { TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type()); TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type()); - assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); + assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration()); } } diff --git a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java index 729b81e1c..be6d6115f 100644 --- a/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java +++ b/base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java @@ -633,6 +633,9 @@ class TextAndGraphicUpdateOperation extends Task { if (show.getSecondaryGraphic() != null) { currentScreenData.setSecondaryGraphic(updatedState.getSecondaryGraphic()); } + if (show.getTemplateConfiguration() != null) { + currentScreenData.setTemplateConfiguration(updatedState.getTemplateConfiguration()); + } if (currentScreenDataUpdateListener != null) { currentScreenDataUpdateListener.onUpdate(currentScreenData); } |