1 module nodes.onion_frame;
2 
3 import fluid;
4 
5 @safe:
6 
7 @("OnionFrame draws background")
8 unittest {
9 
10     auto frame = sizeLock!onionFrame(
11         .sizeLimit(400, 400),
12         nullTheme.derive(
13             rule!OnionFrame(
14                 Rule.backgroundColor = color("#f00"),
15             ),
16         ),
17     );
18     auto root = testSpace(frame);
19 
20     root.drawAndAssert(
21         frame.drawsRectangle(0, 0, 400, 400).ofColor("#f00"),
22     );
23 }
24 
25 @("OnionFrame will display nodes on top of each other")
26 unittest {
27 
28     ImageView view;
29     Label[2] labels;
30 
31     auto frame = onionFrame(
32 
33         view = imageView("logo.png"),
34 
35         labels[0] = label(
36             "Hello, Fluid!"
37         ),
38 
39         labels[1] = label(
40             layout!(1, "center"),
41             "Hello, Fluid! This text should fit the image."
42         ),
43 
44     );
45     auto root = testSpace(
46         chain(fileChain(), arsdImageChain(), frame)
47     );
48 
49     with (Rule)
50     root.theme = nullTheme.derive(
51         rule!Label(textColor = color!"000"),
52     );
53 
54     root.draw();
55     root.drawAndAssert(
56         view.drawsImage(view.image),
57         labels[0].drawsHintedImage(labels[0].text.texture.chunks[0].image).at(0, 0),
58         labels[1].drawsHintedImage(labels[1].text.texture.chunks[0].image),
59     );
60 
61 }