-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
ImageScalingService
from the public API of `pillarbox-core-b…
…usiness`
- Loading branch information
Showing
16 changed files
with
131 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 0 additions & 52 deletions
52
...droidTest/java/ch/srgssr/pillarbox/core/business/images/DefaultImageScalingServiceTest.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 0 additions & 35 deletions
35
...ness/src/main/java/ch/srgssr/pillarbox/core/business/images/DefaultImageScalingService.kt
This file was deleted.
Oops, something went wrong.
51 changes: 0 additions & 51 deletions
51
...re-business/src/main/java/ch/srgssr/pillarbox/core/business/images/ImageScalingService.kt
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
...-core-business/src/test/java/ch/srgssr/pillarbox/core/business/ImageScalingServiceTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) SRG SSR. All rights reserved. | ||
* License information is available from the LICENSE file. | ||
*/ | ||
package ch.srgssr.pillarbox.core.business | ||
|
||
import ch.srgssr.pillarbox.core.business.MediaCompositionMediaItemSource.ImageScalingService | ||
import ch.srgssr.pillarbox.core.business.MediaCompositionMediaItemSource.ImageScalingService.ImageWidth | ||
import ch.srgssr.pillarbox.core.business.integrationlayer.service.IlHost | ||
import org.junit.Assert.assertEquals | ||
import org.junit.Test | ||
import java.net.URLEncoder | ||
|
||
class ImageScalingServiceTest { | ||
@Test | ||
fun getScaledImageUrlProd() { | ||
val baseUrl = IlHost.PROD | ||
val imageUrl = "https://www.rts.ch/2020/05/18/14/20/11333286.image/16x9" | ||
val width = ImageWidth.W240 | ||
|
||
val imageScalingService = ImageScalingService(baseUrl) | ||
val scaledImageUrl = imageScalingService.getScaledImageUrl(imageUrl, width) | ||
val encodedImageUrl = URLEncoder.encode(imageUrl, Charsets.UTF_8) | ||
|
||
assertEquals("${baseUrl}images/?imageUrl=$encodedImageUrl&format=webp&width=${width.width}", scaledImageUrl) | ||
} | ||
|
||
@Test | ||
fun getScaledImageUrlTest() { | ||
val baseUrl = IlHost.TEST | ||
val imageUrl = "https://www.rts.ch/2021/08/05/18/12/12396566.image/2x3" | ||
val width = ImageWidth.W320 | ||
|
||
val imageScalingService = ImageScalingService(baseUrl) | ||
val scaledImageUrl = imageScalingService.getScaledImageUrl(imageUrl, width) | ||
val encodedImageUrl = URLEncoder.encode(imageUrl, Charsets.UTF_8) | ||
|
||
assertEquals("${baseUrl}images/?imageUrl=$encodedImageUrl&format=webp&width=${width.width}", scaledImageUrl) | ||
} | ||
|
||
@Test | ||
fun getScaledImageUrlStage() { | ||
val baseUrl = IlHost.STAGE | ||
val imageUrl = "https://www.rts.ch/2022/10/06/17/32/13444418.image/4x5" | ||
val width = ImageWidth.W480 | ||
|
||
val imageScalingService = ImageScalingService(baseUrl) | ||
val scaledImageUrl = imageScalingService.getScaledImageUrl(imageUrl, width) | ||
val encodedImageUrl = URLEncoder.encode(imageUrl, Charsets.UTF_8) | ||
|
||
assertEquals("${baseUrl}images/?imageUrl=$encodedImageUrl&format=webp&width=${width.width}", scaledImageUrl) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.