Commit 666bb956 authored by Matthias Klumpp's avatar Matthias Klumpp
Browse files

validator: The default screenshot must not contain a video

parent 8fd8790a
......@@ -238,6 +238,11 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = {
"video does not belong to either of these formats.")
},
{ "screenshot-default-contains-video",
AS_ISSUE_SEVERITY_ERROR,
N_("The default screenshot of a software component must not be a video. Use a static image as default screenshot and set the video as a secondary screenshot.")
},
{ "relation-invalid-tag",
AS_ISSUE_SEVERITY_WARNING,
N_("Found an unknown tag in a requires/recommends group. This is likely an error, because a component relation of this type is unknown.")
......
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
* Copyright (C) 2014-2017 Matthias Klumpp <matthias@tenstral.net>
* Copyright (C) 2014-2019 Matthias Klumpp <matthias@tenstral.net>
*
* Licensed under the GNU Lesser General Public License Version 2.1
*
......@@ -872,10 +872,16 @@ as_validator_check_screenshots (AsValidator *validator, xmlNode *node, AsCompone
gboolean image_found = FALSE;
gboolean video_found = FALSE;
gboolean caption_found = FALSE;
gboolean default_screenshot = FALSE;
g_autofree gchar *scr_kind_str = NULL;
if (iter->type != XML_ELEMENT_NODE)
continue;
scr_kind_str = (gchar*) xmlGetProp (iter, (xmlChar*) "type");
if (g_strcmp0 (scr_kind_str, "default") == 0)
default_screenshot = TRUE;
if (g_strcmp0 ((const gchar*) iter->name, "screenshot") != 0) {
as_validator_add_issue (validator, iter,
"invalid-child-tag-name",
......@@ -887,7 +893,6 @@ as_validator_check_screenshots (AsValidator *validator, xmlNode *node, AsCompone
for (iter2 = iter->children; iter2 != NULL; iter2 = iter2->next) {
const gchar *node_name = (const gchar*) iter2->name;
if (iter2->type != XML_ELEMENT_NODE)
continue;
......@@ -917,6 +922,10 @@ as_validator_check_screenshots (AsValidator *validator, xmlNode *node, AsCompone
video_found = TRUE;
/* the default screenshot must not be a video */
if (default_screenshot)
as_validator_add_issue (validator, iter, "screenshot-default-contains-video", NULL);
if (!as_validator_web_url_exists (validator, video_url)) {
as_validator_add_issue (validator, iter2,
"screenshot-video-not-found",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment