mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Add support for animated GIFs
Update ImageBanner to support animated GIFs. Animations rely on ANSI
cursor codes so don't work so well in an IDE. They do, however, work
when running the app from a terminal.
See also commit 47bc5e71ab
Closes gh-11118
This commit is contained in:
parent
3273859fde
commit
ed2460b091
@ -165,6 +165,17 @@ public class ImageBannerTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void printBannerWhenAnimatesShouldPrintAllFrames() throws Exception {
|
||||||
|
AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
|
||||||
|
String banner = printBanner("animated.gif");
|
||||||
|
String[] lines = banner.split(NEW_LINE);
|
||||||
|
int frames = 138;
|
||||||
|
int linesPerFrame = 36;
|
||||||
|
assertThat(banner).contains("\r");
|
||||||
|
assertThat(lines.length).isEqualTo(frames * linesPerFrame - 1);
|
||||||
|
}
|
||||||
|
|
||||||
private int getBannerHeight(String banner) {
|
private int getBannerHeight(String banner) {
|
||||||
return banner.split(NEW_LINE).length - 3;
|
return banner.split(NEW_LINE).length - 3;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 878 KiB |
@ -25,6 +25,7 @@
|
|||||||
<module>spring-boot-sample-actuator-ui</module>
|
<module>spring-boot-sample-actuator-ui</module>
|
||||||
<module>spring-boot-sample-actuator-custom-security</module>
|
<module>spring-boot-sample-actuator-custom-security</module>
|
||||||
<module>spring-boot-sample-amqp</module>
|
<module>spring-boot-sample-amqp</module>
|
||||||
|
<module>spring-boot-sample-animated-banner</module>
|
||||||
<module>spring-boot-sample-aop</module>
|
<module>spring-boot-sample-aop</module>
|
||||||
<module>spring-boot-sample-atmosphere</module>
|
<module>spring-boot-sample-atmosphere</module>
|
||||||
<module>spring-boot-sample-batch</module>
|
<module>spring-boot-sample-batch</module>
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<!-- Your own application should inherit from spring-boot-starter-parent -->
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-samples</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>spring-boot-sample-animated-banner</artifactId>
|
||||||
|
<name>Spring Boot Simple Animated Banner</name>
|
||||||
|
<description>Spring Boot Simple Animated Banner</description>
|
||||||
|
<properties>
|
||||||
|
<main.basedir>${basedir}/../..</main.basedir>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- Compile -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- Test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2017 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package sample.animated;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class SampleAnimatedBannerApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(SampleAnimatedBannerApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 878 KiB |
Loading…
Reference in New Issue
Block a user