@@ -113,4 +113,105 @@ class QuotedMessageView_Tests: StreamChatTestCase {
113113 // Then
114114 assertSnapshot ( matching: view, as: . image( perceptualPrecision: precision) )
115115 }
116+
117+ // MARK: - Custom Size Tests
118+
119+ func test_quotedMessageViewContainer_customAttachmentSize_snapshot( ) {
120+ // Given
121+ let message = ChatMessage . mock (
122+ id: " test " ,
123+ cid: . unique,
124+ text: " Image attachment " ,
125+ author: . mock( id: " test " , name: " martin " ) ,
126+ attachments: [
127+ ChatMessageImageAttachment . mock (
128+ id: . unique,
129+ imageURL: . localYodaImage
130+ ) . asAnyAttachment
131+ ]
132+ )
133+ let customAttachmentSize = CGSize ( width: 60 , height: 60 )
134+ let view = QuotedMessageViewContainer (
135+ factory: DefaultViewFactory . shared,
136+ quotedMessage: message,
137+ fillAvailableSpace: true ,
138+ scrolledId: . constant( nil ) ,
139+ attachmentSize: customAttachmentSize
140+ )
141+ . applyDefaultSize ( )
142+
143+ // Then
144+ assertSnapshot ( matching: view, as: . image( perceptualPrecision: precision) )
145+ }
146+
147+ func test_quotedMessageViewContainer_customAvatarSize_snapshot( ) {
148+ // Given
149+ let customAvatarSize = CGSize ( width: 40 , height: 40 )
150+ let view = QuotedMessageViewContainer (
151+ factory: DefaultViewFactory . shared,
152+ quotedMessage: testMessage,
153+ fillAvailableSpace: true ,
154+ scrolledId: . constant( nil ) ,
155+ quotedAuthorAvatarSize: customAvatarSize
156+ )
157+ . applyDefaultSize ( )
158+
159+ // Then
160+ assertSnapshot ( matching: view, as: . image( perceptualPrecision: precision) )
161+ }
162+
163+ func test_quotedMessageView_customAttachmentSize_snapshot( ) {
164+ // Given
165+ let message = ChatMessage . mock (
166+ id: " test " ,
167+ cid: . unique,
168+ text: " Image attachment " ,
169+ author: . mock( id: " test " , name: " martin " ) ,
170+ attachments: [
171+ ChatMessageImageAttachment . mock (
172+ id: . unique,
173+ imageURL: . localYodaImage
174+ ) . asAnyAttachment
175+ ]
176+ )
177+ let customAttachmentSize = CGSize ( width: 50 , height: 50 )
178+ let view = QuotedMessageView (
179+ factory: DefaultViewFactory . shared,
180+ quotedMessage: message,
181+ fillAvailableSpace: true ,
182+ forceLeftToRight: true ,
183+ attachmentSize: customAttachmentSize
184+ )
185+ . applyDefaultSize ( )
186+
187+ // Then
188+ assertSnapshot ( matching: view, as: . image( perceptualPrecision: precision) )
189+ }
190+
191+ func test_quotedMessageViewContainer_defaultSizes( ) {
192+ // Given
193+ let container = QuotedMessageViewContainer (
194+ factory: DefaultViewFactory . shared,
195+ quotedMessage: testMessage,
196+ fillAvailableSpace: true ,
197+ scrolledId: . constant( nil )
198+ )
199+
200+ // Then - Default sizes should be applied
201+ XCTAssertEqual ( container. attachmentSize, CGSize ( width: 36 , height: 36 ) )
202+ XCTAssertEqual ( container. quotedAuthorAvatarSize, CGSize ( width: 24 , height: 24 ) )
203+ }
204+
205+ func test_quotedMessageView_defaultAttachmentSize( ) {
206+ // Given
207+ let view = QuotedMessageView (
208+ factory: DefaultViewFactory . shared,
209+ quotedMessage: testMessage,
210+ fillAvailableSpace: true ,
211+ forceLeftToRight: true
212+ )
213+
214+ // Then - Default attachment size should be applied
215+ XCTAssertEqual ( view. attachmentSize, CGSize ( width: 36 , height: 36 ) )
216+ }
116217}
0 commit comments