Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 60ceb2ce authored by Johan Ouwerkerk's avatar Johan Ouwerkerk Committed by Bhushan Shah

Fixup bitrot in account name validator autotests

parent 3f100d45
Pipeline #23230 passed with stages
in 9 minutes and 9 seconds
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2019 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
* SPDX-FileCopyrightText: 2019-2020 Johan Ouwerkerk <jm.ouwerkerk@gmail.com>
*/
#include "test-util.h"
......@@ -12,8 +12,14 @@ using namespace validators::test;
static void define_valid_table(void)
{
define_test_case(QLatin1String("Outis"), QLatin1String("Outis"), QValidator::Acceptable);
define_test_case(QLatin1String("test account"), QLatin1String("test account"), QValidator::Acceptable);
}
static void define_invalid_data(void)
{
define_test_case(QLatin1String("test\taccount"), QLatin1String("test account"), QValidator::Invalid);
define_test_case(QLatin1String("\r \n\ttest\r\t \naccount \r\t\n"), QLatin1String("test account"), QValidator::Invalid);
define_test_case(QLatin1String("test "), QLatin1String("test "), QValidator::Invalid);
}
static void define_empty_table(void)
......@@ -24,21 +30,11 @@ static void define_empty_table(void)
define_test_case(QLatin1String("\r\n"), QLatin1String(""), QValidator::Invalid);
}
/*
* Due to how the NameValidator works fixup() is always called and fixup()
* never yields outright invalid output (it strips spaces, the only way
* to get invalid output is due to misplaced spaces)
*
* As a result it is not needed to maintain separate input samples for
* both fixup() and validate().
*/
static void define_data(void)
{
define_empty_table();
define_valid_table();
define_test_case(QLatin1String("test "), QLatin1String("test "), QValidator::Invalid);
define_invalid_data();
}
DEFINE_VALIDATOR_TEST(NameValidatorTest, validators::NameValidator, define_data);
......
Markdown is supported
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