The goal is to solve confusion of the "All rights reserved" for licensing
code under an open-source license.
The phrase "All rights reserved" comes from a historical convention that
required this phrase for the copyright protection to apply. This convention
is no longer relevant.
However, even though the phrase has no meaning in establishing the copyright
it has not lost meaning in terms of licensing.
This change makes it so code under the Blender Foundation copyright does
not use "all rights reserved". This is also how the GPL license itself
states how to apply it to the source code:
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software ...
This change does not change copyright notice in cases when the copyright
is dual (BF and an author), or just an author of the code. It also does
mot change copyright which is inherited from NaN Holding BV as it needs
some further investigation about what is the proper way to handle it.
55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
* Copyright 2020 Blender Foundation */
|
|
|
|
#include "BKE_asset.h"
|
|
|
|
#include "BLI_uuid.h"
|
|
|
|
#include "DNA_asset_types.h"
|
|
|
|
#include "testing/testing.h"
|
|
|
|
namespace blender::bke::tests {
|
|
|
|
TEST(AssetMetadataTest, set_catalog_id)
|
|
{
|
|
AssetMetaData meta{};
|
|
const bUUID uuid = BLI_uuid_generate_random();
|
|
|
|
/* Test trivial values. */
|
|
BKE_asset_metadata_catalog_id_clear(&meta);
|
|
EXPECT_TRUE(BLI_uuid_is_nil(meta.catalog_id));
|
|
EXPECT_STREQ("", meta.catalog_simple_name);
|
|
|
|
/* Test simple situation where the given short name is used as-is. */
|
|
BKE_asset_metadata_catalog_id_set(&meta, uuid, "simple");
|
|
EXPECT_TRUE(BLI_uuid_equal(uuid, meta.catalog_id));
|
|
EXPECT_STREQ("simple", meta.catalog_simple_name);
|
|
|
|
/* Test white-space trimming. */
|
|
BKE_asset_metadata_catalog_id_set(&meta, uuid, " Govoriš angleško? ");
|
|
EXPECT_STREQ("Govoriš angleško?", meta.catalog_simple_name);
|
|
|
|
/* Test length trimming to 63 chars + terminating zero. */
|
|
constexpr char len66[] = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20";
|
|
constexpr char len63[] = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1";
|
|
BKE_asset_metadata_catalog_id_set(&meta, uuid, len66);
|
|
EXPECT_STREQ(len63, meta.catalog_simple_name);
|
|
|
|
/* Test length trimming happens after white-space trimming. */
|
|
constexpr char len68[] =
|
|
" \
|
|
000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20 ";
|
|
BKE_asset_metadata_catalog_id_set(&meta, uuid, len68);
|
|
EXPECT_STREQ(len63, meta.catalog_simple_name);
|
|
|
|
/* Test length trimming to 63 bytes, and not 63 characters. ✓ in UTF-8 is three bytes long. */
|
|
constexpr char with_utf8[] =
|
|
"00010203040506✓0708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20";
|
|
BKE_asset_metadata_catalog_id_set(&meta, uuid, with_utf8);
|
|
EXPECT_STREQ("00010203040506✓0708090a0b0c0d0e0f101112131415161718191a1b1c1d",
|
|
meta.catalog_simple_name);
|
|
}
|
|
|
|
} // namespace blender::bke::tests
|