From 7a6bf468bc78797d7e3bdc0513b895ea7327cd67 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Thu, 16 Mar 2023 22:04:25 +0100 Subject: [PATCH] test(xep): Add a test for parsing sticker packs --- packages/moxxmpp/test/xeps/xep_0449_test.dart | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 packages/moxxmpp/test/xeps/xep_0449_test.dart diff --git a/packages/moxxmpp/test/xeps/xep_0449_test.dart b/packages/moxxmpp/test/xeps/xep_0449_test.dart new file mode 100644 index 0000000..e384539 --- /dev/null +++ b/packages/moxxmpp/test/xeps/xep_0449_test.dart @@ -0,0 +1,228 @@ +import 'package:test/test.dart'; +import 'package:moxxmpp/moxxmpp.dart'; + +void main() { + test('Test parsing a large sticker pack', () { + // Example sticker pack based on the "miho" sticker pack by Movim + final rawPack = XMLNode.fromString(''' + + Miho + XMPP-chan. + + + image/png + :miho no: + no.png + 32088 + 400x400 + LmIVPPPfOfmf8JLCCi0UFbjzILuRhJlkgzeN/nKIrm8= + + + + + + + + image/png + :miho good: + good.png + 35529 + 400x400 + Yu8qycCh5e3ZjZGTL5jadHAzni8ufvI+9Y7sKXjFLfE= + + + + + + + + image/png + :miho think: + think.png + 36045 + 400x400 + imQS2JiFO6S0e49p090ZVMDUhMK00LNWvRIpZJCF3wE= + + + + + + + + image/png + :miho sorry: + sorry.png + 29542 + 400x400 + ypwf+tCDjfHYRWNccIM0mh48IwP9YO/xieCZ5EwIUoY= + + + + + + + + image/png + :miho confused: + confused.png + 35965 + 400x400 + Za809qdsDuCrDsPxpPAlTrEY4c10Wiap4IXtb+F+dEo= + + + + + + + + image/png + :miho sparkle: + sparkle.png + 35965 + 400x400 + PaNrKyVZtSrqf/qLcf3K6h5u9l90h+P803hDU/yrh9M= + + + + + + + + image/png + :miho glad: + glad.png + 55894 + 400x400 + EeNaIsEp026KJL/OGCluO0lMuFBcqN/FACUBF52lDDc= + + + + + + + + image/png + :miho shock: + shock.png + 34478 + 400x400 + nvoMdblXUoJonvGeMJUgmCOAww17mwNgaQInT1vmi2s= + + + + + + + + image/png + :miho stare: + stare.png + 34574 + 400x400 + VDhOMXWPeLL64rhJ/SBTz/Remt7AWhxb0HzdPYc48tY= + + + + + + + + image/png + :miho happy: + happy.png + 32984 + 400x400 + P5AvAPByh8n0hOCamrN4YCc9oA7XwdGvSbBHMJf8RBg= + + + + + + + + image/png + :miho angry: + angry.png + 37862 + 400x400 + m/NrSawqkK0qdO6fi6HPiagsizqBJMZWoIhS0g2O3m0= + + + + + + + + image/png + :miho speechless: + speechless.png + 30721 + 400x400 + tIxqUrkiXWHRWUC4/Pk/rO/B0EuwyQq8GkawxE/NsF8= + + + + + + + + image/png + :miho laugh: + laugh.png + 36209 + 400x400 + MqH3vXkXJn1k3nZ6YBAT2di6ZhXVxk/StVbgX/nI9/0= + + + + + + + + image/png + :miho surprise: + surprise.png + 34655 + 400x400 + 3CsvFu1vZNpLVLgHDPPQJ8w9Dm4Hd3VPpuKZn7+wcXc= + + + + + + + + image/png + :miho sad: + sad.png + 32655 + 400x400 + 12pOZSdygnaaaXeDDAN6995LXdLfalKXTRrVbnBxjE0= + + + + + + + + image/png + :miho blush: + blush.png + 30476 + 400x400 + Q8wdGYxHvO5EmMEEqWbwESr99hiKfLlK/LPp4yL8UgY= + + + + + + Epasa8DHHzFrE4zd+xaNpVb4jbu4s74XtioExNjQzZ0= +'''); + final pack = StickerPack.fromXML( + 'Epasa8DHHzFrE4zd+xaNpVb4jbu4s74XtioExNjQzZ0=', + rawPack, + ); + + expect(pack.stickers.length, 16); + }); +}