|
8 | 8 |
|
9 | 9 |
|
10 | 10 | /** |
11 | | - * Centralised test data for {@link org.godotengine.plugin.nativecamera.model.FeedRequest}. |
| 11 | + * Factory methods that build {@link Dictionary} instances for use in |
| 12 | + * {@link org.godotengine.plugin.nativecamera.model.FeedRequest} unit tests. |
12 | 13 | */ |
13 | 14 | public final class FeedRequestFixtures { |
14 | 15 |
|
15 | 16 | private FeedRequestFixtures() { |
16 | 17 | } |
17 | 18 |
|
18 | | - // ── canonical complete request ────────────────────────────────────────── |
19 | | - |
| 19 | + /** All fields populated with non-default values. */ |
20 | 20 | public static Dictionary fullDict() { |
21 | 21 | Dictionary d = new Dictionary(); |
22 | 22 | d.put("camera_id", "0"); |
23 | | - d.put("width", (long) 1280); |
24 | | - d.put("height", (long) 720); |
25 | | - d.put("frames_to_skip", (long) 2); |
26 | | - d.put("rotation", (long) 90); |
| 23 | + d.put("width", 1280L); |
| 24 | + d.put("height", 720L); |
| 25 | + d.put("frames_to_skip", 2L); |
| 26 | + d.put("rotation", 90L); |
27 | 27 | d.put("is_grayscale", false); |
| 28 | + d.put("mirror_horizontal", false); |
| 29 | + d.put("mirror_vertical", false); |
28 | 30 | return d; |
29 | 31 | } |
30 | 32 |
|
31 | | - public static Dictionary grayscaleDict() { |
| 33 | + /** No fields at all — every getter should return its safe default. */ |
| 34 | + public static Dictionary emptyDict() { |
| 35 | + return new Dictionary(); |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Only camera_id + width + height; optional fields absent so that |
| 40 | + * their defaults are exercised. |
| 41 | + */ |
| 42 | + public static Dictionary minimalDict() { |
| 43 | + Dictionary d = new Dictionary(); |
| 44 | + d.put("camera_id", "0"); |
| 45 | + d.put("width", 1280L); |
| 46 | + d.put("height", 720L); |
| 47 | + return d; |
| 48 | + } |
| 49 | + |
| 50 | + /** Front-facing camera (id = "1"). */ |
| 51 | + public static Dictionary frontCameraDict() { |
32 | 52 | Dictionary d = fullDict(); |
33 | | - d.put("is_grayscale", true); |
34 | | - d.put("rotation", (long) 0); |
| 53 | + d.put("camera_id", "1"); |
35 | 54 | return d; |
36 | 55 | } |
37 | 56 |
|
| 57 | + /** Rotation set to 180°. */ |
38 | 58 | public static Dictionary rotated180Dict() { |
39 | 59 | Dictionary d = fullDict(); |
40 | | - d.put("rotation", (long) 180); |
| 60 | + d.put("rotation", 180L); |
41 | 61 | return d; |
42 | 62 | } |
43 | 63 |
|
| 64 | + /** Rotation set to 270°. */ |
44 | 65 | public static Dictionary rotated270Dict() { |
45 | 66 | Dictionary d = fullDict(); |
46 | | - d.put("rotation", (long) 270); |
| 67 | + d.put("rotation", 270L); |
47 | 68 | return d; |
48 | 69 | } |
49 | 70 |
|
50 | | - // ── partial / missing-field variants ──────────────────────────────────── |
51 | | - |
52 | | - /** Only camera_id supplied – every other field should fall back to its default. */ |
53 | | - public static Dictionary minimalDict() { |
54 | | - Dictionary d = new Dictionary(); |
55 | | - d.put("camera_id", "1"); |
| 71 | + /** is_grayscale = true, everything else at full-dict values. */ |
| 72 | + public static Dictionary grayscaleDict() { |
| 73 | + Dictionary d = fullDict(); |
| 74 | + d.put("is_grayscale", true); |
56 | 75 | return d; |
57 | 76 | } |
58 | 77 |
|
59 | | - /** Completely empty dictionary. */ |
60 | | - public static Dictionary emptyDict() { |
61 | | - return new Dictionary(); |
| 78 | + /** mirror_horizontal = true, everything else at full-dict values. */ |
| 79 | + public static Dictionary mirrorHorizontalDict() { |
| 80 | + Dictionary d = fullDict(); |
| 81 | + d.put("mirror_horizontal", true); |
| 82 | + return d; |
62 | 83 | } |
63 | 84 |
|
64 | | - // ── front-camera variant ──────────────────────────────────────────────── |
| 85 | + /** mirror_vertical = true, everything else at full-dict values. */ |
| 86 | + public static Dictionary mirrorVerticalDict() { |
| 87 | + Dictionary d = fullDict(); |
| 88 | + d.put("mirror_vertical", true); |
| 89 | + return d; |
| 90 | + } |
65 | 91 |
|
66 | | - public static Dictionary frontCameraDict() { |
| 92 | + /** Both mirror axes enabled. */ |
| 93 | + public static Dictionary mirrorBothDict() { |
67 | 94 | Dictionary d = fullDict(); |
68 | | - d.put("camera_id", "1"); |
| 95 | + d.put("mirror_horizontal", true); |
| 96 | + d.put("mirror_vertical", true); |
69 | 97 | return d; |
70 | 98 | } |
71 | 99 | } |
0 commit comments