Skip to content

Commit

Permalink
Update current screen data in T&G manager with template config (#1834)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
JulianKast authored Sep 21, 2022
1 parent 44b38cb commit 2a0b655
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -246,6 +246,8 @@ public void setUp() throws Exception {
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");

Expand Down Expand Up @@ -276,7 +278,7 @@ public void setUp() throws Exception {

currentScreenData.setPrimaryGraphic(testArtwork1);
currentScreenData.setSecondaryGraphic(testArtwork2);
currentScreenData.setTemplateConfiguration(configuration);
currentScreenData.setTemplateConfiguration(configurationOld);

currentScreenDataUpdatedListener = new TextAndGraphicManager.CurrentScreenDataUpdatedListener() {
@Override
Expand Down Expand Up @@ -1047,7 +1049,6 @@ public void testOnShowFail() {
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));
Expand Down Expand Up @@ -1080,7 +1081,7 @@ public void testOnShowFailBadDataDoesNotUpdateScreen(){
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
Expand Down Expand Up @@ -1120,7 +1121,7 @@ public void testUpdateTargetStateWithErrorStateNullDoesNotUpdateCurrentScreen()
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
Expand Down Expand Up @@ -1160,7 +1161,7 @@ public void testUpdateTargetStateWithErrorBadDataDoesNotUpdateCurrentScreen() {
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
Expand Down Expand Up @@ -1200,6 +1201,6 @@ public void testUpdateTargetStateWithErrorBadDataAndGoodData() {
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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ private void updateCurrentScreenDataFromShow(Show show) {
if (show.getSecondaryGraphic() != null) {
currentScreenData.setSecondaryGraphic(updatedState.getSecondaryGraphic());
}
if (show.getTemplateConfiguration() != null) {
currentScreenData.setTemplateConfiguration(updatedState.getTemplateConfiguration());
}
if (currentScreenDataUpdateListener != null) {
currentScreenDataUpdateListener.onUpdate(currentScreenData);
}
Expand Down

0 comments on commit 2a0b655

Please sign in to comment.