Skip to content

Commit

Permalink
Merge pull request o3de#3049 from aws-lumberyard-dev/cgalvan/gitflow_…
Browse files Browse the repository at this point in the history
…210811

Merged stabilization/2106 to main
  • Loading branch information
cgalvan authored Aug 11, 2021
2 parents 43603ca + 575faa4 commit f8d39e2
Show file tree
Hide file tree
Showing 78 changed files with 1,333 additions and 733 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_LandscapeCanvas_GraphClosed_OnLevelChange(self, request, editor, level,

@pytest.mark.test_case_id("C17488412")
@pytest.mark.SUITE_periodic
@pytest.mark.xfail(reason="https://github.com/o3de/o3de/issues/2201")
def test_LandscapeCanvas_GraphClosed_OnEntityDelete(self, request, editor, level, launcher_platform):
cfg_args = [level]

Expand Down
2 changes: 2 additions & 0 deletions Code/Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ ly_add_target(
editor_files.cmake
PLATFORM_INCLUDE_FILES
Platform/${PAL_PLATFORM_NAME}/editor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
TARGET_PROPERTIES
LY_INSTALL_GENERATE_RUN_TARGET TRUE
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Core
Expand Down
4 changes: 2 additions & 2 deletions Code/Framework/AzCore/AzCore/IO/Path/Path.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ namespace AZ::IO
//! then their hash values are also equal
//! For example : path "a//b" equals "a/b", the
//! hash value of "a//b" would also equal the hash value of "a/b"
constexpr size_t hash_value(const PathView& pathToHash) noexcept;
size_t hash_value(const PathView& pathToHash) noexcept;

// path.comparison
constexpr bool operator==(const PathView& lhs, const PathView& rhs) noexcept;
Expand Down Expand Up @@ -622,7 +622,7 @@ namespace AZ::IO
//! For example : path "a//b" equals "a/b", the
//! hash value of "a//b" would also equal the hash value of "a/b"
template <typename StringType>
constexpr size_t hash_value(const BasicPath<StringType>& pathToHash);
size_t hash_value(const BasicPath<StringType>& pathToHash);

// path.append
template <typename StringType>
Expand Down
27 changes: 21 additions & 6 deletions Code/Framework/AzCore/AzCore/IO/Path/Path.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ namespace AZ::IO
}

template <typename StringType>
constexpr size_t hash_value(const BasicPath<StringType>& pathToHash)
inline size_t hash_value(const BasicPath<StringType>& pathToHash)
{
return AZStd::hash<BasicPath<StringType>>{}(pathToHash);
}
Expand Down Expand Up @@ -2082,13 +2082,28 @@ namespace AZStd
template <>
struct hash<AZ::IO::PathView>
{
constexpr size_t operator()(const AZ::IO::PathView& pathToHash) noexcept
/// Path is using FNV-1a algorithm 64 bit version.
static size_t hash_path(AZStd::string_view pathSegment, const char pathSeparator)
{
size_t hash = 14695981039346656037ULL;
constexpr size_t fnvPrime = 1099511628211ULL;

for (const char first : pathSegment)
{
hash ^= static_cast<size_t>((pathSeparator == AZ::IO::PosixPathSeparator)
? first : tolower(first));
hash *= fnvPrime;
}
return hash;
}

size_t operator()(const AZ::IO::PathView& pathToHash) noexcept
{
auto pathParser = AZ::IO::parser::PathParser::CreateBegin(pathToHash.Native(), pathToHash.m_preferred_separator);
size_t hash_value = 0;
while (pathParser)
{
AZStd::hash_combine(hash_value, AZStd::hash<AZStd::string_view>{}(*pathParser));
AZStd::hash_combine(hash_value, hash_path(*pathParser, pathToHash.m_preferred_separator));
++pathParser;
}
return hash_value;
Expand All @@ -2097,7 +2112,7 @@ namespace AZStd
template <typename StringType>
struct hash<AZ::IO::BasicPath<StringType>>
{
constexpr size_t operator()(const AZ::IO::BasicPath<StringType>& pathToHash) noexcept
const size_t operator()(const AZ::IO::BasicPath<StringType>& pathToHash) noexcept
{
return AZStd::hash<AZ::IO::PathView>{}(pathToHash);
}
Expand All @@ -2108,11 +2123,11 @@ namespace AZStd
template struct hash<AZ::IO::FixedMaxPath>;
}

// Explicit instantations of our support Path classes
// Explicit instantiations of our support Path classes
namespace AZ::IO
{
// PathView hash
constexpr size_t hash_value(const PathView& pathToHash) noexcept
inline size_t hash_value(const PathView& pathToHash) noexcept
{
return AZStd::hash<PathView>{}(pathToHash);
}
Expand Down
30 changes: 30 additions & 0 deletions Code/Framework/AzCore/Tests/IO/Path/PathTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,36 @@ namespace UnitTest
AZStd::tuple<AZStd::string_view, AZStd::string_view>(R"(foO/Bar)", "foo/bar")
));

using PathHashParamFixture = PathParamFixture;
TEST_P(PathHashParamFixture, HashOperator_HashesCaseInsensitiveForWindowsPaths)
{
AZ::IO::Path path1{ AZStd::get<0>(GetParam()), AZ::IO::WindowsPathSeparator };
AZ::IO::Path path2{ AZStd::get<1>(GetParam()), AZ::IO::WindowsPathSeparator };
size_t path1Hash = AZStd::hash<AZ::IO::PathView>{}(path1);
size_t path2Hash = AZStd::hash<AZ::IO::PathView>{}(path2);
EXPECT_EQ(path1Hash, path2Hash) << AZStd::string::format(R"(path1 "%s" should hash to path2 "%s"\n)",
path1.c_str(), path2.c_str()).c_str();
}

TEST_P(PathHashParamFixture, HashOperator_HashesCaseSensitiveForPosixPaths)
{
AZ::IO::Path path1{ AZStd::get<0>(GetParam()), AZ::IO::PosixPathSeparator };
AZ::IO::Path path2{ AZStd::get<1>(GetParam()), AZ::IO::PosixPathSeparator };
size_t path1Hash = AZStd::hash<AZ::IO::PathView>{}(path1);
size_t path2Hash = AZStd::hash<AZ::IO::PathView>{}(path2);
EXPECT_NE(path1Hash, path2Hash) << AZStd::string::format(R"(path1 "%s" should NOT hash to path2 "%s"\n)",
path1.c_str(), path2.c_str()).c_str();
}

INSTANTIATE_TEST_CASE_P(
HashPaths,
PathHashParamFixture,
::testing::Values(
AZStd::tuple<AZStd::string_view, AZStd::string_view>("C:/test/foo", R"(c:\test/foo)"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>(R"(D:\test/bar/baz//foo)", "d:/test/bar/baz\\\\\\foo"),
AZStd::tuple<AZStd::string_view, AZStd::string_view>(R"(foO/Bar)", "foo/bar")
));

class PathSingleParamFixture
: public ScopedAllocatorSetupFixture
, public ::testing::WithParamInterface<AZStd::tuple<AZStd::string_view>>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ namespace AzToolsFramework

const AZStd::string& AssetBrowserEntry::GetRelativePath() const
{
return m_relativePath;
return m_relativePath.Native();
}

const AZStd::string& AssetBrowserEntry::GetFullPath() const
{
return m_fullPath;
return m_fullPath.Native();
}

const AssetBrowserEntry* AssetBrowserEntry::GetChild(int index) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#if !defined(Q_MOC_RUN)
#include <AzCore/std/string/string.h>
#include <AzCore/Asset/AssetCommon.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Math/Uuid.h>

#include <AzToolsFramework/Thumbnails/Thumbnail.h>
Expand Down Expand Up @@ -130,8 +131,8 @@ namespace AzToolsFramework
protected:
AZStd::string m_name;
QString m_displayName;
AZStd::string m_relativePath;
AZStd::string m_fullPath;
AZ::IO::Path m_relativePath;
AZ::IO::Path m_fullPath;
AZStd::vector<AssetBrowserEntry*> m_children;
AssetBrowserEntry* m_parentAssetEntry = nullptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ namespace AzToolsFramework

void FolderAssetBrowserEntry::UpdateChildPaths(AssetBrowserEntry* child) const
{
child->m_relativePath = m_relativePath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
child->m_fullPath = m_fullPath + AZ_CORRECT_DATABASE_SEPARATOR + child->m_name;
child->m_relativePath = m_relativePath / child->m_name;
child->m_fullPath = m_fullPath / child->m_name;
AssetBrowserEntry::UpdateChildPaths(child);
}

Expand Down
Loading

0 comments on commit f8d39e2

Please sign in to comment.