{"id":1500,"url":"https://patchwork.libcamera.org/api/1.1/patches/1500/?format=json","web_url":"https://patchwork.libcamera.org/patch/1500/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190621161401.28337-8-kieran.bingham@ideasonboard.com>","date":"2019-06-21T16:13:59","name":"[libcamera-devel,RFC,v2,7/9] libcamera: test: Add ControlList tests","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"a1f1dc3a26f5b6cecdfc46b92d60c37472c8b534","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/1500/mbox/","series":[{"id":370,"url":"https://patchwork.libcamera.org/api/1.1/series/370/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=370","date":"2019-06-21T16:13:52","name":"Libcamera Controls","version":2,"mbox":"https://patchwork.libcamera.org/series/370/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/1500/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/1500/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 57DD3615FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Jun 2019 18:14:08 +0200 (CEST)","from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 03DD633C;\n\tFri, 21 Jun 2019 18:14:07 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1561133648;\n\tbh=FxHWjaUOq2Qab1TBN0eiVHm2pTJE3gPMBx0l/7AYuuk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=RX6r0TGCUZwylRLnTmiINxZU9rI5tO528ep6/Lpl+LjsMoUEuELk4CCz+lkux98Yp\n\tgGf2J3/SsK81cI69x12UMGKv7j03wC/eonn4wI4NYCzwS3kFMXcBiMSH5u1c5d4Tei\n\txnwc0AHwzCGBmxJHJLJlPYyJoZmSk2/WlJO3U51E=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Fri, 21 Jun 2019 17:13:59 +0100","Message-Id":"<20190621161401.28337-8-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190621161401.28337-1-kieran.bingham@ideasonboard.com>","References":"<20190621161401.28337-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [RFC PATCH v2 7/9] libcamera: test: Add\n\tControlList tests","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Fri, 21 Jun 2019 16:14:08 -0000"},"content":"Extend the Controls tests with specific testing of the ControlList\ninfrastructure and public APIs.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/controls.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 99 insertions(+)","diff":"diff --git a/test/controls.cpp b/test/controls.cpp\nindex 94e89f270108..c4145b7a0543 100644\n--- a/test/controls.cpp\n+++ b/test/controls.cpp\n@@ -25,6 +25,101 @@ protected:\n \t\treturn TestPass;\n \t}\n \n+\tint testControlList()\n+\t{\n+\t\tControlList list;\n+\n+\t\tif (list.contains(ManualGain)) {\n+\t\t\tcout << \"Unexpected item in the bagging area\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (list.size() != 0) {\n+\t\t\tcout << \"List should contain zero elements\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!list.empty()) {\n+\t\t\tcout << \"List expected to be empty\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Set a control */\n+\t\tlist[ManualBrightness] = 255;\n+\n+\t\t/* Contains should still not find a non set control */\n+\t\tif (list.contains(ManualGain)) {\n+\t\t\tcout << \"Unexpected item in the bagging area\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (list.size() != 1) {\n+\t\t\tcout << \"List should contain one element\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (list.empty()) {\n+\t\t\tcout << \"List not expected to be empty\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Finally lets find that Gain */\n+\t\tlist[ManualGain] = 128;\n+\t\tif (!list.contains(ManualGain)) {\n+\t\t\tcout << \"Couldn't identify an in-list control\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Validate value retrieval */\n+\t\tif (list[ManualGain].getInt() != 128 ||\n+\t\t    list[ManualBrightness].getInt() != 255) {\n+\t\t\tcout << \"Failed to retrieve control value\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Update using ControlInfo */\n+\t\tControlInfo gainInfo(ManualGain);\n+\t\tlist.update(gainInfo, 200);\n+\t\tif (list[ManualGain].getInt() != 200) {\n+\t\t\tcout << \"Failed to update control value\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\t/* Create a new list from an existing one */\n+\t\tControlList newList;\n+\n+\t\tnewList.update(list);\n+\n+\t\t/*\n+\t\t * Clear down the original list and assert items are still in\n+\t\t * the new list\n+\t\t */\n+\t\tlist.reset();\n+\n+\t\tif (list.size() != 0) {\n+\t\t\tcout << \"Old List should contain zero elements\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!list.empty()) {\n+\t\t\tcout << \"Old List expected to be empty\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (newList.size() != 2) {\n+\t\t\tcout << \"New list with incorrect size\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (!(newList.contains(ManualGain) &&\n+\t\t      newList.contains(ManualBrightness))) {\n+\t\t\tcout << \"New list with incorrect items\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn TestPass;\n+\t}\n+\n \tint run()\n \t{\n \t\tint ret;\n@@ -33,6 +128,10 @@ protected:\n \t\tif (ret)\n \t\t\treturn ret;\n \n+\t\tret = testControlList();\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n \t\treturn TestPass;\n \t}\n };\n","prefixes":["libcamera-devel","RFC","v2","7/9"]}