From 989d6a3f96b818e5eacc5a2ccb1cc82e6dd8354c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 11 Apr 2020 17:41:56 +0200 Subject: media: use table instead of linked list for media For consistency with equipment, use our table macros for pictures. Generally tables (arrays) are preferred over linked lists, because they allow random access. This is mostly copy & paste of the equipment code. Sadly, our table macros are quite messy and need some revamping. Therefore, the resulting code is likewise somewhat messy. Signed-off-by: Berthold Stoeger --- tests/testpicture.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp index da8fedeec..7bd683523 100644 --- a/tests/testpicture.cpp +++ b/tests/testpicture.cpp @@ -31,17 +31,15 @@ void TestPicture::addPicture() // Pictures will be added to selected dives dive->selected = true; QVERIFY(dive != NULL); - pic1 = dive->picture_list; // So far no picture in dive - QVERIFY(pic1 == NULL); + QVERIFY(dive->pictures.nr == 0); create_picture(SUBSURFACE_TEST_DATA "/dives/images/wreck.jpg", 0, false); create_picture(SUBSURFACE_TEST_DATA "/dives/images/data_after_EOI.jpg", 0, false); - pic1 = dive->picture_list; - pic2 = pic1->next; // Now there are two picture2 - QVERIFY(pic1 != NULL); - QVERIFY(pic2 != NULL); + QVERIFY(dive->pictures.nr == 2); + pic1 = &dive->pictures.pictures[0]; + pic2 = &dive->pictures.pictures[1]; // 1st appearing at time 21:01 // 2nd appearing at time 22:01 QVERIFY(pic1->offset.seconds == 1261); @@ -55,5 +53,4 @@ void TestPicture::addPicture() QCOMPARE(localFilePath(pic2->filename), QString(PIC2_NAME)); } - QTEST_GUILESS_MAIN(TestPicture) -- cgit v1.2.3-70-g09d2