Giter Club home page Giter Club logo

Comments (7)

gaaclarke avatar gaaclarke commented on May 21, 2024 1

I mean we can also add helpers to the DlBuilder that look more like Impeller.

That's what the facade is, they just so happen to match the API of aiks::Canvas. When making a large refactor, the least amount of change to the test code will give you the highest confidence that you didn't break anything. Actually we could probably implement this without changing AiksTests at all as a first step and might be worth considering. The changes I proposed are pretty straightforward though. We don't want a huge PR that completely resurfaces all the tests that are supposed to be verifying that it's correct.

from flutter.

gaaclarke avatar gaaclarke commented on May 21, 2024

For the existing aiks tests this is going to be a bit tricky. We have a significant investment in testing against the aiks api.
ZLJRRi8m37tlL_XjXT5z09gcNT0k4X9es_jaMWyYqZHAKX3Q-FUvwOMcy32LIiGzFiS-Tdjl7HfNvZAADAPRN1Dyoz8vCl0JfHAjXPbSw7TAIUnyyCXNXnMv9Ybz7A25puJLwD9D4pxo7N3S_YP90EipdjHnPPt1r7MyJwXsQ2lEQ_Z07StnG2PU5QNAx0Gq2kKci6AUp1HwLA5c1lVBWkCspekC9f0oc47QnvgSKINVQ719

We should try to create a testing shim that will wrap up DlCanvas. That way tests written like this:

TEST_P(AiksTest, CanRenderColoredRect) {
  Canvas canvas;
  Paint paint;
  paint.color = Color::Blue();
  canvas.DrawPath(PathBuilder{}
                      .AddRect(Rect::MakeXYWH(100.0, 100.0, 100.0, 100.0))
                      .TakePath(),
                  paint);
  ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

would become something like

TEST_P(AiksTest, CanRenderColoredRect) {
  DisplayListBuilder builder;
  AiksFacade canvas(builder);
  Paint paint;
  paint.color = Color::Blue();
  canvas.DrawPath(PathBuilder{}
                      .AddRect(Rect::MakeXYWH(100.0, 100.0, 100.0, 100.0))
                      .TakePath(),
                  paint);
  ASSERT_TRUE(OpenPlaygroundHere(builder.build()));
}

Then we could little by little delete the facade. That will potentially require creating some new helper functions in the testing namespace or pushing new functionality to the flutter namespace.

For the existing dl_unittests.cc they would almost be exactly the same, since the facade is just an adapter around DisplayListBuilder. The missing gap is just to get from a DisplayList to be rendered in a Playground. Since Playground can already render impeller::Picture, we could use impeller::DlDispatcher to create a picture and conform to the existing Playground code.

from flutter.

jonahwilliams avatar jonahwilliams commented on May 21, 2024

What is the AiksFacade providing here? The canvas API is almost identical? Or is it more about the playground implementation itself?

from flutter.

gaaclarke avatar gaaclarke commented on May 21, 2024

AiksFacade just allows us to migrate all our existing tests over when we delete aiks::Canvas. That way we can separately delete it. It may require a lot of effort to remove, in which case we can spread out its removal as we have time instead of having a huge upfront cost to migrating to display lists. It's probably the only sane way to keep our existing tests.

from flutter.

jonahwilliams avatar jonahwilliams commented on May 21, 2024

I mean we can also add helpers to the DlBuilder that look more like Impeller. I think before we commit to the facade I'd try migrating a few tests to see how difficult it will be. Some of the tests that use entity pass internals will need to be enitrely rewritten or deleted and the facade wont help there

from flutter.

gaaclarke avatar gaaclarke commented on May 21, 2024

Here is a design doc that talks about implementing this (and a tool to help propagate tests from framework usage): https://docs.google.com/document/d/17LiGKlt57R5CZMxcWt9wj9Z7eDihhUaUEg3oeGQAKTc/edit

from flutter.

jonahwilliams avatar jonahwilliams commented on May 21, 2024

Done in flutter/engine#52690

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.