@@ -132,6 +132,18 @@ void main() {
132
132
]);
133
133
check (listedStreamIds (tester)).deepEquals ([1 , 2 , 3 , 4 , 5 , 6 ]);
134
134
});
135
+
136
+ testWidgets ('muted subscriptions come at last' , (tester) async {
137
+ await setupStreamListPage (tester, subscriptions: [
138
+ eg.subscription (eg.stream (streamId: 1 , name: 'a' ), isMuted: true , pinToTop: true ),
139
+ eg.subscription (eg.stream (streamId: 2 , name: 'b' ), isMuted: false , pinToTop: true ),
140
+ eg.subscription (eg.stream (streamId: 3 , name: 'c' ), isMuted: true , pinToTop: true ),
141
+ eg.subscription (eg.stream (streamId: 4 , name: 'd' ), isMuted: false , pinToTop: false ),
142
+ eg.subscription (eg.stream (streamId: 5 , name: 'e' ), isMuted: true , pinToTop: false ),
143
+ eg.subscription (eg.stream (streamId: 6 , name: 'f' ), isMuted: false , pinToTop: false ),
144
+ ]);
145
+ check (listedStreamIds (tester)).deepEquals ([2 , 1 , 3 , 4 , 6 , 5 ]);
146
+ });
135
147
});
136
148
137
149
testWidgets ('unread badge shows with unreads' , (tester) async {
@@ -190,4 +202,43 @@ void main() {
190
202
check (tester.widget <UnreadCountBadge >(find.byType (UnreadCountBadge )).backgroundColor)
191
203
.equals (swatch);
192
204
});
205
+
206
+ testWidgets ('muted streams are displayed as faded' , (tester) async {
207
+ final stream1 = eg.stream (name: 'Stream 1' );
208
+ final stream2 = eg.stream (streamId: 2 , name: 'Stream 2' );
209
+ final unreadMsgs = eg.unreadMsgs (streams: [
210
+ UnreadStreamSnapshot (streamId: stream1.streamId, topic: 'a' , unreadMessageIds: [1 , 2 ]),
211
+ UnreadStreamSnapshot (streamId: stream2.streamId, topic: 'b' , unreadMessageIds: [3 ]),
212
+ ]);
213
+ await setupStreamListPage (tester,
214
+ subscriptions: [
215
+ eg.subscription (stream1, isMuted: true ),
216
+ eg.subscription (stream2, isMuted: false )
217
+ ],
218
+ userTopics: [
219
+ UserTopicItem (
220
+ streamId: stream1.streamId,
221
+ topicName: 'a' ,
222
+ lastUpdated: 1234567890 ,
223
+ visibilityPolicy: UserTopicVisibilityPolicy .unmuted,
224
+ ),
225
+ UserTopicItem (
226
+ streamId: stream2.streamId,
227
+ topicName: 'b' ,
228
+ lastUpdated: 1234567890 ,
229
+ visibilityPolicy: UserTopicVisibilityPolicy .unmuted,
230
+ ),
231
+ ],
232
+ unreadMsgs: unreadMsgs);
233
+
234
+ final stream1Finder = find.text ('Stream 1' );
235
+ final stream1Opacity = tester.widget <Opacity >(
236
+ find.ancestor (of: stream1Finder, matching: find.byType (Opacity ))).opacity;
237
+ check (stream1Opacity).equals (0.55 );
238
+
239
+ final stream2Finder = find.text ('Stream 2' );
240
+ final stream2Opacity = tester.widget <Opacity >(
241
+ find.ancestor (of: stream2Finder, matching: find.byType (Opacity ))).opacity;
242
+ check (stream2Opacity).equals (1.0 );
243
+ });
193
244
}
0 commit comments