This repository has been archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Impeller] add example of testing entity with "real" HAL instead of m…
- Loading branch information
1 parent
b0d8663
commit d5ccb5b
Showing
7 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
impeller/entity/contents/checkerboard_contents_unittests.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include <memory> | ||
#include <optional> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
#include "impeller/entity/contents/checkerboard_contents.h" | ||
#include "impeller/entity/contents/contents.h" | ||
#include "impeller/entity/entity.h" | ||
#include "impeller/entity/entity_playground.h" | ||
#include "impeller/renderer/render_target.h" | ||
|
||
namespace impeller { | ||
namespace testing { | ||
|
||
using EntityTest = EntityPlayground; | ||
INSTANTIATE_PLAYGROUND_SUITE(EntityTest); | ||
|
||
#ifdef IMPELLER_DEBUG | ||
TEST(EntityTest, HasNulloptCoverage) { | ||
auto contents = std::make_shared<CheckerboardContents>(); | ||
|
||
Entity entity; | ||
ASSERT_EQ(contents->GetCoverage(entity), std::nullopt); | ||
} | ||
|
||
TEST_P(EntityTest, RendersWithoutError) { | ||
auto contents = std::make_shared<CheckerboardContents>(); | ||
contents->SetColor(Color::Aqua()); | ||
contents->SetSquareSize(10); | ||
|
||
auto content_context = GetContentContext(); | ||
auto buffer = content_context->GetContext()->CreateCommandBuffer(); | ||
auto render_target = RenderTarget::CreateOffscreenMSAA( | ||
*content_context->GetContext(), | ||
*GetContentContext()->GetRenderTargetCache(), {100, 100}); | ||
auto render_pass = buffer->CreateRenderPass(render_target); | ||
Entity entity; | ||
|
||
ASSERT_TRUE(render_pass->GetCommands().empty()); | ||
ASSERT_TRUE(contents->Render(*content_context, entity, *render_pass)); | ||
ASSERT_FALSE(render_pass->GetCommands().empty()); | ||
} | ||
#endif // IMPELLER_DEBUG | ||
|
||
} // namespace testing | ||
} // namespace impeller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters