Skip to content

test: Add unit tests for basic layer operations in dispatcher#3937

Open
yuvraj-kolkar17 wants to merge 3 commits intoGraphiteEditor:masterfrom
yuvraj-kolkar17:test/new-tests-dispatcher
Open

test: Add unit tests for basic layer operations in dispatcher#3937
yuvraj-kolkar17 wants to merge 3 commits intoGraphiteEditor:masterfrom
yuvraj-kolkar17:test/new-tests-dispatcher

Conversation

@yuvraj-kolkar17
Copy link

@yuvraj-kolkar17 yuvraj-kolkar17 commented Mar 22, 2026

What this pr does

Adds basic unit tests to editor/src/dispatcher.rs for simple layer
operations that had no test coverage before

Part of #3936

image

After 4 new test added
image

  • new_document_starts_empty verifies a new document starts with zero layers
  • draw_rect_adds_one_layer verifies drawing a rectangle creates exactly one layer
  • delete_selected_layer_reduces_count verifies deleting the selected layer reduces the count from 3 to 2
  • paste_twice_gives_five_layers verifies pasting the same clipboard content twice on 3 layers gives 5 total

Signed-off-by: Yuvraj Kolkar <kolkaryuvraj2@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request adds basic unit tests to editor/src/dispatcher.rs to cover simple layer operations that previously lacked test coverage. The new tests ensure that new documents start empty, drawing a rectangle adds a layer, deleting a selected layer reduces the layer count, and pasting content from the clipboard increases the layer count as expected.

Highlights

  • New Tests: This PR introduces four new unit tests to enhance the coverage of layer operations in editor/src/dispatcher.rs.
  • Layer Operations Verification: The tests verify basic functionalities such as creating a new document with zero layers, adding a layer by drawing a rectangle, deleting a selected layer, and pasting layers from the clipboard.
  • Improved Test Coverage: These additions address previously uncovered areas of the dispatcher, increasing the robustness and reliability of the editor.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Confidence score: 4/5

  • This PR appears technically safe to merge, with the only reported concern being PR title format enforcement rather than a code behavior defect.
  • The flagged issue is high-confidence but process-oriented: the title should be updated to the required sentence-case imperative format (for example, starting with “Add”) and avoid a conventional commit prefix.
  • Because the finding does not indicate a runtime regression in editor/src/dispatcher.rs, merge risk is low once repository conventions are satisfied.
  • Pay close attention to editor/src/dispatcher.rs - ensure the PR metadata/title policy is corrected so checks and review workflow are not blocked.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="editor/src/dispatcher.rs">

<violation number="1" location="editor/src/dispatcher.rs:531">
P1: Custom agent: **PR title enforcement**

Update the PR title to follow the required format (no conventional commit prefix, sentence case, imperative verb like "Add").</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@yuvraj-kolkar17 yuvraj-kolkar17 changed the title test: added new test for dispatcher test: Add unit tests for basic layer operations in dispatcher Mar 22, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request adds tests for creating a new document, drawing a rectangle, deleting a selected layer, and pasting layers. The reviewer suggested using DocumentMessage::DeleteSelectedLayers instead of NodeGraphMessage::DeleteSelectedNodes in the delete_selected_layer_reduces_count test for robustness and suggested avoiding the test-only PortfolioMessage::PasteIntoFolder API in the paste_twice_gives_five_layers test.

Signed-off-by: Yuvraj Kolkar <kolkaryuvraj2@gmail.com>
@yuvraj-kolkar17
Copy link
Author

yuvraj-kolkar17 commented Mar 22, 2026

PTAL @TrueDoctor @Keavon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant