From patchwork Mon Sep 25 19:45:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 818345 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ZaAJK9Qt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3y1F2K4Ptcz9s76 for ; Tue, 26 Sep 2017 05:46:17 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 47A78C21E2C; Mon, 25 Sep 2017 19:45:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B0F80C21F51; Mon, 25 Sep 2017 19:45:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 59308C21EA9; Mon, 25 Sep 2017 19:45:24 +0000 (UTC) Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by lists.denx.de (Postfix) with ESMTPS id 9112BC21E33 for ; Mon, 25 Sep 2017 19:45:20 +0000 (UTC) Received: by mail-pf0-f196.google.com with SMTP id h4so4020643pfk.0 for ; Mon, 25 Sep 2017 12:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dcWIGPXIp7dpOTAUog3myQC7lIeU5olZ9bpaykv5qCo=; b=ZaAJK9Qtg6MHhwGKnEowgvFMncXoAGq8ucRvJbd9ITVBxhlUwUTt3TvdImPv74+K1H TtHs/nCpX5cZjvWzpwCHF9bHt9F+hflMwOiMmTOjca20ERNruyHxgzW7RY7/F3i4onwH inKFYMlUS0JGbaLmg/q/A3jnY0ZkTwGxEOi+9W0r//1t01Xv/fx6VOvMVPKZ0mlwJlEB 2ZbFWtY4i6ifKKeNg8VwMKpeqpm17Y6AGG2jchjQeWJ0hq/E0yoREAuhtUMEnu4fN1u+ FBSgehLaiWfYMcJ39rmh0dTa6lrvl/fi17wu9Js3xtvEs1dQR0Pruq2Sxrsg8OWFXMx6 HWpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dcWIGPXIp7dpOTAUog3myQC7lIeU5olZ9bpaykv5qCo=; b=VcXef3184+oY3+06FuOUO0KQOgjbtZOWELZ0wGYN8Va8IA/4iv2M377I7BhnVIu1De 7JRi7UmE8eDTIabMLTW9TXI6Izl8vM3AruCTmfGvLtChQyfHaXrKZutIE3QtZmK4+3Gk VRoBHhwf5Nr7Ay4IOYeAhUl5WsPENOwEp7H6GoOVsZ0H5CAQ1ort4rp/Dt6p6Rn2o1JT 7+3UdBgDBiM+AB6IXwAhItYt9FvTKrHjZnMnVe4XpdlL+KJz3iGnUztIEcyO20XLZpxb ZI6EWb5S+WRZJEAO4bRv1Yi898btXDnVvSz+yO1ws84mF38IaDxEiAv98G/EwTQisGFb tXVw== X-Gm-Message-State: AHPjjUhtKMyii08P6fYRsZCZSG8SygznAFbqEc4owZ/DfKP0BXdResv0 Gmq7L4W0qC+uAvP7Vcw3OJ6yHmED X-Google-Smtp-Source: AOwi7QCxqLHwzmkJD9dQZvGdP9SF6qyLkfUiKue0NL5//IyEMSO2B8s8/c96HScQkVu9/FKiiZSzNw== X-Received: by 10.99.130.198 with SMTP id w189mr8530253pgd.175.1506368718880; Mon, 25 Sep 2017 12:45:18 -0700 (PDT) Received: from localhost (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id m13sm13065957pgc.58.2017.09.25.12.45.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 12:45:17 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Mon, 25 Sep 2017 15:45:09 -0400 Message-Id: <20170925194511.15872-2-robdclark@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170925194511.15872-1-robdclark@gmail.com> References: <20170925194511.15872-1-robdclark@gmail.com> Subject: [U-Boot] [PATCH 2/2] video: test: Add ANSI escape sequence tests X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Rob Clark --- Not sure if there is a way to inject a -l arg when test.py runs sanbox somehow, to visually confirm the results? It is not really possible to do manually since 'echo' command doesn't handle escape sequences properly. At any rate, efi_console uses all the same escape sequences, and at least with a 32bpp display they look correct. test/dm/video.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c index 6a5626c5e3..29917d0c2d 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -159,6 +159,40 @@ static int dm_test_video_chars(struct unit_test_state *uts) } DM_TEST(dm_test_video_chars, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +#ifdef CONFIG_VIDEO_ANSI +#define ANSI_ESC "\x1b" +/* Test handling of ANSI escape sequences */ +static int dm_test_video_ansi(struct unit_test_state *uts) +{ + struct udevice *dev, *con; + + ut_assertok(select_vidconsole(uts, "vidconsole0")); + ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + + /* reference clear: */ + video_clear(con->parent); + video_sync(con->parent); + ut_asserteq(46, compress_frame_buffer(dev)); + + /* test clear escape sequence: [2J */ + vidconsole_put_string(con, "A\tB\tC"ANSI_ESC"[2J"); + ut_asserteq(46, compress_frame_buffer(dev)); + + /* test set-cursor: [%d;%df */ + vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd"); + ut_asserteq(142, compress_frame_buffer(dev)); + + /* test colors (30-37 fg color, 40-47 bg color) */ + vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */ + vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */ + ut_asserteq(268, compress_frame_buffer(dev)); + + return 0; +} +DM_TEST(dm_test_video_ansi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); +#endif + /** * check_vidconsole_output() - Run a text console test *