|
1 | 1 | #include <QOpenGLContext> |
2 | 2 | #include <QOffscreenSurface> |
| 3 | +#include <QSignalSpy> |
3 | 4 | #include <textbubbleshape.h> |
4 | 5 |
|
5 | 6 | #include "../common.h" |
@@ -41,56 +42,70 @@ TEST_F(TextBubbleShapeTest, Constructors) |
41 | 42 | TEST_F(TextBubbleShapeTest, Type) |
42 | 43 | { |
43 | 44 | TextBubbleShape bubble; |
| 45 | + QSignalSpy spy(&bubble, &TextBubbleShape::typeChanged); |
44 | 46 | ASSERT_EQ(bubble.type(), TextBubbleShape::Type::Say); |
45 | 47 |
|
46 | 48 | bubble.setType(TextBubbleShape::Type::Think); |
47 | 49 | ASSERT_EQ(bubble.type(), TextBubbleShape::Type::Think); |
| 50 | + ASSERT_EQ(spy.count(), 1); |
48 | 51 |
|
49 | 52 | bubble.setType(TextBubbleShape::Type::Think); |
50 | 53 | ASSERT_EQ(bubble.type(), TextBubbleShape::Type::Think); |
| 54 | + ASSERT_EQ(spy.count(), 1); |
51 | 55 |
|
52 | 56 | bubble.setType(TextBubbleShape::Type::Say); |
53 | 57 | ASSERT_EQ(bubble.type(), TextBubbleShape::Type::Say); |
| 58 | + ASSERT_EQ(spy.count(), 2); |
54 | 59 | } |
55 | 60 |
|
56 | 61 | TEST_F(TextBubbleShapeTest, OnSpriteRight) |
57 | 62 | { |
58 | 63 | TextBubbleShape bubble; |
| 64 | + QSignalSpy spy(&bubble, &TextBubbleShape::onSpriteRightChanged); |
59 | 65 | ASSERT_TRUE(bubble.onSpriteRight()); |
60 | 66 |
|
61 | 67 | bubble.setOnSpriteRight(false); |
62 | 68 | ASSERT_FALSE(bubble.onSpriteRight()); |
| 69 | + ASSERT_EQ(spy.count(), 1); |
63 | 70 |
|
64 | 71 | bubble.setOnSpriteRight(false); |
65 | 72 | ASSERT_FALSE(bubble.onSpriteRight()); |
| 73 | + ASSERT_EQ(spy.count(), 1); |
66 | 74 |
|
67 | 75 | bubble.setOnSpriteRight(true); |
68 | 76 | ASSERT_TRUE(bubble.onSpriteRight()); |
| 77 | + ASSERT_EQ(spy.count(), 2); |
69 | 78 | } |
70 | 79 |
|
71 | 80 | TEST_F(TextBubbleShapeTest, StageScale) |
72 | 81 | { |
73 | 82 | TextBubbleShape bubble; |
| 83 | + QSignalSpy spy(&bubble, &TextBubbleShape::stageScaleChanged); |
74 | 84 | ASSERT_EQ(bubble.stageScale(), 1); |
75 | 85 |
|
76 | 86 | bubble.setStageScale(6.48); |
77 | 87 | ASSERT_EQ(bubble.stageScale(), 6.48); |
| 88 | + ASSERT_EQ(spy.count(), 1); |
78 | 89 | } |
79 | 90 |
|
80 | 91 | TEST_F(TextBubbleShapeTest, NativeWidth) |
81 | 92 | { |
82 | 93 | TextBubbleShape bubble; |
| 94 | + QSignalSpy spy(&bubble, &TextBubbleShape::nativeWidthChanged); |
83 | 95 | ASSERT_EQ(bubble.nativeWidth(), 0); |
84 | 96 |
|
85 | 97 | bubble.setNativeWidth(48.1); |
86 | 98 | ASSERT_EQ(bubble.nativeWidth(), 48.1); |
| 99 | + ASSERT_EQ(spy.count(), 1); |
87 | 100 | } |
88 | 101 |
|
89 | 102 | TEST_F(TextBubbleShapeTest, NativeHeight) |
90 | 103 | { |
91 | 104 | TextBubbleShape bubble; |
| 105 | + QSignalSpy spy(&bubble, &TextBubbleShape::nativeHeightChanged); |
92 | 106 | ASSERT_EQ(bubble.nativeHeight(), 0); |
93 | 107 |
|
94 | 108 | bubble.setNativeHeight(87.5); |
95 | 109 | ASSERT_EQ(bubble.nativeHeight(), 87.5); |
| 110 | + ASSERT_EQ(spy.count(), 1); |
96 | 111 | } |
0 commit comments