forked from bramp/ffmpeg-cli-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFFmpegStreamSideDataAdapterTest.java
More file actions
36 lines (30 loc) · 1.9 KB
/
FFmpegStreamSideDataAdapterTest.java
File metadata and controls
36 lines (30 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package net.bramp.ffmpeg.adapter;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.bramp.ffmpeg.probe.FFmpegStream;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class FFmpegStreamSideDataAdapterTest {
static Gson gson;
@BeforeClass
public static void setGson() {
GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(FFmpegStream.SideData.class, new FFmpegStreamSideDataAdapter());
gson = builder.create();
}
@Test
public void testNumberFormatException() {
FFmpegStream.SideData sideData = gson.fromJson("{\"side_data_type\": \"Display Matrix\", \"displaymatrix\": \"\n00000000: 0 0 0\n00000001: 0 0 0\n00000002: 0 0 1073741824\n\", \"rotation\": -9223372036854775808}", FFmpegStream.SideData.class);
assertEquals(sideData.side_data_type, "Display Matrix");
assertEquals(sideData.displaymatrix, "\n00000000: 0 0 0\n00000001: 0 0 0\n00000002: 0 0 1073741824\n");
assertEquals(sideData.rotation, 0);
}
@Test
public void testNormalVideo() {
FFmpegStream.SideData sideData = gson.fromJson("{\"side_data_type\": \"Display Matrix\", \"displaymatrix\": \"\n00000000: 0 -65536 0\n00000001: 65536 0 0\n00000002: 0 0 1073741824\n\", \"rotation\": 90}", FFmpegStream.SideData.class);
assertEquals(sideData.side_data_type, "Display Matrix");
assertEquals(sideData.displaymatrix, "\n00000000: 0 -65536 0\n00000001: 65536 0 0\n00000002: 0 0 1073741824\n");
assertEquals(sideData.rotation, 90);
}
}