From: Simon Mikuda <simon.mikuda@streamunlimited.com>
To: linux-bluetooth@vger.kernel.org
Cc: Simon Mikuda <simon.mikuda@streamunlimited.com>
Subject: [PATCH BlueZ v4 09/10] unit/test-media-player: Add test for stale NumberOfItems reply
Date: Tue, 24 Nov 2026 13:19:03 +0100 [thread overview]
Message-ID: <20261124121904.3267700-10-simon.mikuda@streamunlimited.com> (raw)
In-Reply-To: <20261124121904.3267700-1-simon.mikuda@streamunlimited.com>
The number of items of a folder may be reported after the client has
moved to another folder. Check that it does not replace the number of
items of the current folder, while the current folder's own is still
taken.
Assisted-by: Claude:claude-opus-5-5
---
unit/test-media-player.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/unit/test-media-player.c b/unit/test-media-player.c
index ba10e5175..53dc6f69b 100644
--- a/unit/test-media-player.c
+++ b/unit/test-media-player.c
@@ -770,6 +770,33 @@ static void test_total_items_scope_change(const void *data)
g_assert(context->total_items_calls == 1);
}
+/*
+ * The count of a folder that is no longer the scope must not replace the
+ * count of the current one.
+ */
+static void test_total_items_stale(const void *data)
+{
+ context = create_context();
+ if (context == NULL)
+ return;
+
+ g_assert(media_player_create_folder(context->mp, "/Filesystem",
+ PLAYER_FOLDER_TYPE_MIXED, 0) != NULL);
+ g_assert(media_player_create_folder(context->mp, "/Other",
+ PLAYER_FOLDER_TYPE_MIXED, 0) != NULL);
+
+ media_player_set_folder(context->mp, "/Filesystem", 0);
+ media_player_set_folder(context->mp, "/Other", 0);
+ media_player_set_folder(context->mp, "/Filesystem", 0);
+
+ media_player_total_items_complete(context->mp, "/Filesystem",
+ TOTAL_ITEMS);
+ media_player_total_items_complete(context->mp, "/Other",
+ TOTAL_ITEMS + 1);
+
+ call_get_number_of_items(&context->pending, number_of_items_reply);
+}
+
/*
* Search() shares the pending request slot with the other browsing
* requests, so a busy Search() must report EBUSY like they do.
@@ -834,6 +861,10 @@ int main(int argc, char *argv[])
test_total_items_scope_change,
test_teardown);
+ tester_add("/media_player/total_items_stale", NULL, NULL,
+ test_total_items_stale,
+ test_teardown);
+
tester_add("/media_player/search_busy", NULL, NULL,
test_search_busy, test_teardown);
--
2.43.0
next prev parent reply other threads:[~2026-11-24 12:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:18 [PATCH BlueZ v4 00/10] AVRCP browsing fixes Simon Mikuda
2026-11-24 12:18 ` [PATCH BlueZ v4 01/10] avrcp: Fix not checking browsing PDU parameter length Simon Mikuda
2026-11-24 21:03 ` AVRCP browsing fixes bluez.test.bot
2026-11-24 12:18 ` [PATCH BlueZ v4 02/10] avrcp: Fix listing media players up to item 0xffffffff Simon Mikuda
2026-11-24 12:18 ` [PATCH BlueZ v4 03/10] avrcp: Fix byte order of ADDRESSED_PLAYER_CHANGED notification Simon Mikuda
2026-11-24 12:18 ` [PATCH BlueZ v4 04/10] avrcp: Fix byte order of TRACK_CHANGED identifier Simon Mikuda
2026-11-24 12:18 ` [PATCH BlueZ v4 05/10] avrcp: Fix not browsing a player addressed before it was listed Simon Mikuda
2026-11-24 12:19 ` [PATCH BlueZ v4 06/10] player: Fix crash on Search in a folder whose name has a space Simon Mikuda
2026-11-24 12:19 ` [PATCH BlueZ v4 07/10] player: Fix missing Name of listed Now Playing items Simon Mikuda
2026-11-24 12:19 ` [PATCH BlueZ v4 08/10] avrcp: Fix NumberOfItems set from a reply for another folder Simon Mikuda
2026-11-24 12:19 ` Simon Mikuda [this message]
2026-11-24 12:19 ` [PATCH BlueZ v4 10/10] player: Fix Now Playing NumberOfItems when its content changes Simon Mikuda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124121904.3267700-10-simon.mikuda@streamunlimited.com \
--to=simon.mikuda@streamunlimited.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox