Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 15, 2025

The Sheet class (model/sheet.h) had minimal test coverage - only a single instantiation in testTensorOps.cc. This PR adds comprehensive unit tests covering the class's public API.

Changes

  • New test file: test/testSheet.cc with 15 test cases covering:

    • Geometric calculations (corners)
    • Hit testing (onResizeHandle, onRavelButton, inItem, clickType, contains)
    • Scrolling and keyboard input (scrollUp, scrollDown, onKeyPress)
    • Data operations (exportAsCSV error handling, setSliceIndicator)
    • Properties and flags (showRavel, showRowSlice, showColSlice, dimensions, positioning)
    • Copy semantics (validates no-op behavior)
  • Updated: test/Makefile to include testSheet.o in GTESTOBJS

Not covered

  • Private methods (ravelSize, ravelX, ravelY) - should not be tested directly
  • Rendering methods (draw, drawResizeHandles) - require Cairo context
  • computeValue - requires complex port/tensor setup, appropriate for integration tests

Example test coverage

TEST_F(SheetTest, clickType)
{
  moveTo(100, 100);
  iWidth(200);
  iHeight(150);
  double z = zoomFactor();
  double w = 0.5 * 200 * z;
  double h = 0.5 * 150 * z;
  
  EXPECT_EQ(ClickType::onResize, clickType(100 + w, 100 + h));
  EXPECT_EQ(ClickType::inItem, clickType(100, 100));
  EXPECT_EQ(ClickType::onItem, clickType(100 + w * 0.9, 100 + h * 0.9));
  EXPECT_EQ(ClickType::outside, clickType(0, 0));
}
Original prompt

Improve code coverage on Sheet class, found in model/sheet.h


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


This change is Reviewable

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 15, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve code coverage for Sheet class in model/sheet.h Add comprehensive unit tests for Sheet class Nov 15, 2025
Copilot finished work on behalf of highperformancecoder November 15, 2025 03:57
Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com>
Copilot finished work on behalf of highperformancecoder November 18, 2025 23:12
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.

2 participants