Michele Caini 3 роки тому
батько
коміт
fc7d28c723
1 змінених файлів з 28 додано та 0 видалено
  1. 28 0
      test/entt/entity/view.cpp

+ 28 - 0
test/entt/entity/view.cpp

@@ -70,6 +70,20 @@ TEST(SingleComponentView, Functionalities) {
     ASSERT_FALSE(invalid);
     ASSERT_FALSE(invalid);
 }
 }
 
 
+TEST(SingleComponentView, Constructors) {
+    entt::storage<int> storage{};
+
+    entt::view<entt::get_t<int>> invalid{};
+    entt::basic_view from_storage{storage};
+    entt::basic_view from_tuple{std::forward_as_tuple(storage)};
+
+    ASSERT_FALSE(invalid);
+    ASSERT_TRUE(from_storage);
+    ASSERT_TRUE(from_tuple);
+
+    ASSERT_EQ(&from_storage.handle(), &from_tuple.handle());
+}
+
 TEST(SingleComponentView, Handle) {
 TEST(SingleComponentView, Handle) {
     entt::registry registry;
     entt::registry registry;
     const auto entity = registry.create();
     const auto entity = registry.create();
@@ -518,6 +532,20 @@ TEST(MultiComponentView, Functionalities) {
     ASSERT_FALSE(invalid);
     ASSERT_FALSE(invalid);
 }
 }
 
 
+TEST(MultiComponentView, Constructors) {
+    entt::storage<int> storage{};
+
+    entt::view<entt::get_t<int, int>> invalid{};
+    entt::basic_view from_storage{storage, storage};
+    entt::basic_view from_tuple{std::forward_as_tuple(storage, storage)};
+
+    ASSERT_FALSE(invalid);
+    ASSERT_TRUE(from_storage);
+    ASSERT_TRUE(from_tuple);
+
+    ASSERT_EQ(&from_storage.handle(), &from_tuple.handle());
+}
+
 TEST(MultiComponentView, Handle) {
 TEST(MultiComponentView, Handle) {
     entt::registry registry;
     entt::registry registry;
     const auto entity = registry.create();
     const auto entity = registry.create();