[{"id":2112,"web_url":"https://patchwork.libcamera.org/comment/2112/","msgid":"<20190702002637.GM9228@bigcity.dyn.berto.se>","date":"2019-07-02T00:26:37","subject":"Re: [libcamera-devel] [PATCH v4 11/13] libcamera: test: Add\n\tControlInfo test","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Kieran,\n\nThanks for your work.\n\nOn 2019-07-01 23:15:02 +0300, Laurent Pinchart wrote:\n> From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> Provide an initial test coverage for the ControlInfo class.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n> Changes since v2:\n> \n> - Renamed to control_info.cpp\n> ---\n>  test/controls/control_info.cpp | 62 ++++++++++++++++++++++++++++++++++\n>  test/controls/meson.build      |  1 +\n>  2 files changed, 63 insertions(+)\n>  create mode 100644 test/controls/control_info.cpp\n> \n> diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp\n> new file mode 100644\n> index 000000000000..aa3a65b1e5ef\n> --- /dev/null\n> +++ b/test/controls/control_info.cpp\n> @@ -0,0 +1,62 @@\n> +/* SPDX-License-Identifier: GPL-2.0-or-later */\n> +/*\n> + * Copyright (C) 2019, Google Inc.\n> + *\n> + * control_info.cpp - ControlInfo tests\n> + */\n> +\n> +#include <iostream>\n> +\n> +#include <libcamera/controls.h>\n> +\n> +#include \"test.h\"\n> +\n> +using namespace std;\n> +using namespace libcamera;\n> +\n> +class ControlInfoTest : public Test\n> +{\n> +protected:\n> +\tint run()\n> +\t{\n> +\t\t/*\n> +\t\t * Test information retrieval from a control with no minimum\n> +\t\t * and maximum.\n> +\t\t */\n> +\t\tControlInfo info(Brightness);\n> +\n> +\t\tif (info.id() != Brightness ||\n> +\t\t    info.type() != ControlValueInteger ||\n> +\t\t    info.name() != std::string(\"Brightness\")) {\n> +\t\t\tcout << \"Invalid control identification for Brightness\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.min().getInt() != 0 || info.max().getInt() != 0) {\n> +\t\t\tcout << \"Invalid control range for Brightness\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\t/*\n> +\t\t * Test information retrieval from a control with a minimum and\n> +\t\t * a maximum value.\n> +\t\t */\n> +\t\tinfo = ControlInfo(Contrast, 10, 200);\n> +\n> +\t\tif (info.id() != Contrast ||\n> +\t\t    info.type() != ControlValueInteger ||\n> +\t\t    info.name() != std::string(\"Contrast\")) {\n> +\t\t\tcout << \"Invalid control identification for Contrast\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\tif (info.min().getInt() != 10 || info.max().getInt() != 200) {\n> +\t\t\tcout << \"Invalid control range for Contrast\" << endl;\n> +\t\t\treturn TestFail;\n> +\t\t}\n> +\n> +\t\treturn TestPass;\n> +\t}\n> +};\n> +\n> +TEST_REGISTER(ControlInfoTest)\n> diff --git a/test/controls/meson.build b/test/controls/meson.build\n> index 1161864d9949..f8cda2877e73 100644\n> --- a/test/controls/meson.build\n> +++ b/test/controls/meson.build\n> @@ -1,4 +1,5 @@\n>  control_tests = [\n> +    [ 'control_info',   'control_info.cpp' ],\n>      [ 'control_value',  'control_value.cpp' ],\n>  ]\n>  \n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lf1-x141.google.com (mail-lf1-x141.google.com\n\t[IPv6:2a00:1450:4864:20::141])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4676760C2B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Jul 2019 02:26:39 +0200 (CEST)","by mail-lf1-x141.google.com with SMTP id p24so10016638lfo.6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 01 Jul 2019 17:26:39 -0700 (PDT)","from localhost (customer-145-14-112-32.stosn.net. [145.14.112.32])\n\tby smtp.gmail.com with ESMTPSA id\n\ta17sm2922715lfk.0.2019.07.01.17.26.38\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tMon, 01 Jul 2019 17:26:38 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=CgWNv9m007kAmr7POSN2yFB82MmD1FWkDvFfubYNJ6Q=;\n\tb=RqaA1XlzTwwlPOCGA9MX0+D1NqWqNmN/ChnLeLtpwc9hjQvfgaxHKfg8hdIe0d3kY+\n\tLhUxprVYeh+MF0KLlosnXDqKaM4NgWlO7jy1D6DqUQjW0iwuXX2lQXkQTAngwCA+C90p\n\tB65u8fvTCMLbkeqKdh3pG0hYy1DU6PSHhf+JlJjgOEpEbmgthwTk0UgQllqU4gs5GIJ+\n\tnUwcf+8PSkUTbe9a/s6KZImWWYDFa0GHW6BAyS/Si90e8KgzwPVT/sOBSd9bfxqhPtL7\n\tfs11wDqttOLU+FBswYoJIVcgsO+akMP1mPTjoOQar/8ijBzjZGw7CCF1rm4DQVjPQLEv\n\tyiyg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=CgWNv9m007kAmr7POSN2yFB82MmD1FWkDvFfubYNJ6Q=;\n\tb=Y1C3qKl/ieRIHXpg5g3YFbAjcly92R86sn8XLpL5AcJ7kpPSk8o9PkD38KxVv3CRgQ\n\tcmZXCI/3c48k+s4rEDvYLfu0wT0BXPD9b085/kyaD425TOkq1gOa2NBqXnOaY3lGzDf0\n\tIZ2jnaTNGUV2FDvfQJGp4as4dt9mXf/UN0dVDzV1xxYPGA3m3M+xynnnoNqCyklBIsca\n\t6Wmg399bTqkAQBEfU5SkVqE1KLzmeOouXMo9FU2i/8X/PstlanUGjiNX3jiwJaI5lVTP\n\t6OKazLD+mUc6xna5NmAWDkle/hVwAMa3shRFgBw3rItGuIC3oVajnIvOQjhtr0uzMBPp\n\tyb5w==","X-Gm-Message-State":"APjAAAVm4HMO9ye1dTpI+9diMXBe0K1VwPpCaVfTRODkASDngH0L34HT\n\thY0+/z6pPmA7EjepBtCL/CMIgw==","X-Google-Smtp-Source":"APXvYqzg4qu+vLeuvB/SZUCNNrJS5CkQdE12Qwc/1qEFFDmFlybnE4j8+GioQtxk/G4cYtB6L8Hh4w==","X-Received":"by 2002:a05:6512:51c:: with SMTP id\n\to28mr13574746lfb.67.1562027198819; \n\tMon, 01 Jul 2019 17:26:38 -0700 (PDT)","Date":"Tue, 2 Jul 2019 02:26:37 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190702002637.GM9228@bigcity.dyn.berto.se>","References":"<20190701201504.28487-1-laurent.pinchart@ideasonboard.com>\n\t<20190701201504.28487-12-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190701201504.28487-12-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.1 (2019-06-15)","Subject":"Re: [libcamera-devel] [PATCH v4 11/13] libcamera: test: Add\n\tControlInfo test","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":"Tue, 02 Jul 2019 00:26:39 -0000"}}]