Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
-BUG asserting `r = fmap (\(i, sall) -> (internal_getSAutoLineLabelPosition (larlist `debugBangBang` _sAutoLineLabel_index sall) sal sall, i, sall)) sortedlls`
  • Loading branch information
minimapletinytools committed Dec 24, 2023
1 parent b47e25e commit 0b1d90a
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 13 deletions.
16 changes: 9 additions & 7 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -277,17 +277,15 @@ DONE-handlers should return preview action
-probably do [x] start | [x] end
-default line can be one sided maybe?
-make flip button more clear

-upgrade xcode or something to get brew working??
-clean unused dependencies
-figure out how to run dependency detector
DONE-add upper bounds to all packages
- --tutorial to open tutorial otherwise empty by default


::HIGH PRIORITY::
DONE-BUG `invalid = error "toggling of LHS_XXX_InheritTrue elements disallowed"`
-repro is make a chain of folders, select one in the middle and lock
-the issue is we prevent locking/hiding if parent is locked/hidden but not if parents parent etc is
DONE-BUG textarea handler crashes
DONE-BUG asserting `r = fmap (\(i, sall) -> (internal_getSAutoLineLabelPosition (larlist `debugBangBang` _sAutoLineLabel_index sall) sal sall, i, sall)) sortedlls`
-repro is to make a line label with midpoint, add text between midpoint and thene delete the midpoint in either direction
-line labels still cropping on right side
-allow new lines in line labels :O
-LHRESS_ChildSelected graphic broken during drag and just in general
Expand Down Expand Up @@ -409,7 +407,11 @@ DONE-BUG textarea handler crashes




DONE-add upper bounds to all packages
DONE-BUG `invalid = error "toggling of LHS_XXX_InheritTrue elements disallowed"`
-repro is make a chain of folders, select one in the middle and lock
-the issue is we prevent locking/hiding if parent is locked/hidden but not if parents parent etc is
DONE-BUG textarea handler crashes
DONE/IGNORE-add box border toggle
IGONRE-TESTING check for leaks again
DONE-BUG after renaming folder, clicking on canvas pane does not finalize the folder rename action until you click back on the layers pane
Expand Down
8 changes: 3 additions & 5 deletions src/Potato/Flow/Controller/Manipulator/Line.hs
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,7 @@ sAutoLine_addMidpoint mpindex pos sline = r where
newmidpoints = L.insertAt mpindex (SAutoLineConstraintFixed pos) (_sAutoLine_midpoints sline)


-- TODO update line label position


-- TODO update line label position (whether you adjust index will depend on the position relative to where midpoint is added, right now we always assume label is to the left)
fmapfn ll = if _sAutoLineLabel_index ll > mpindex
then ll { _sAutoLineLabel_index = _sAutoLineLabel_index ll + 1}
else ll
Expand Down Expand Up @@ -523,8 +521,8 @@ sAutoLine_modifyMidpoint mpindex pos sline = r where
sAutoLine_deleteMidpoint :: Int -> SAutoLine -> SAutoLine
sAutoLine_deleteMidpoint mpindex sline = r where
newmidpoints = L.deleteAt mpindex (_sAutoLine_midpoints sline)
-- TODO update line label position
fmapfn ll = if _sAutoLineLabel_index ll >= mpindex
-- TODO update line label position (whether you adjust index will depend on the position relative to where midpoint is added, right now we always assume label is to the left)
fmapfn ll = if _sAutoLineLabel_index ll > mpindex
then ll { _sAutoLineLabel_index = _sAutoLineLabel_index ll - 1}
else ll
newlabels = fmap fmapfn (_sAutoLine_labels sline)
Expand Down
4 changes: 3 additions & 1 deletion src/Potato/Flow/DebugHelpers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ instance MonadPotatoLogger PotatoLogger where


debugBangBang :: (HasCallStack) => [a] -> Int -> a
debugBangBang l i = assert (i >=0 && i < length l) (l L.!! i)
debugBangBang l i = if (i >=0 && i < length l)
then (l L.!! i)
else error $ "debugBangBang: index " <> show i <> " out of bounds in list of length " <> show (length l)
38 changes: 38 additions & 0 deletions test/Potato/Flow/Controller/Manipulator/LineSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,43 @@ midpoint_double_adjacent_delete_test = hSpecGoatTesterWithOwlPFState blankOwlPFS
canvasMouseDown (50, 2)
expectMidpointCount 3

midpoint_delete_with_label_test :: Spec
midpoint_delete_with_label_test = hSpecGoatTesterWithOwlPFState blankOwlPFState $ do

initSimpleLine

setMarker "add a midpoint"
canvasMouseDown (50, 0)
canvasMouseDown (55, 0)
canvasMouseUp (55, 0)
expectMidpointCount 1

setMarker "add a label"
canvasMouseDownUp (25,0)
pressKeys "meow"
verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow"

setMarker "delete the midpoint by going left"
canvasMouseDown (55, 0)
canvasMouseDownUp (0, 0)
expectMidpointCount 0
verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow"

setMarker "add a midpoint"
canvasMouseDown (50, 0)
canvasMouseDown (55, 0)
canvasMouseUp (55, 0)
expectMidpointCount 1
verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow"

setMarker "delete the midpoint by going right"
canvasMouseDown (55, 0)
canvasMouseDownUp (100, 0)
expectMidpointCount 0
verifyMostRecentlyCreatedLinesLatestLineLabelHasText "meow"




initUnitBox :: (Int, Int) -> GoatTester ()
initUnitBox (x, y) = do
Expand Down Expand Up @@ -564,6 +601,7 @@ spec = do
describe "basic_cancel" $ basic_cancel_test
describe "midpoint_modify_basic" $ midpoint_modify_basic_test
describe "midpoint_double_adjacent_delete" $ midpoint_double_adjacent_delete_test
describe "midpoint_delete_with_label_test" $ midpoint_delete_with_label_test
describe "attaching_delete_test" $ attaching_delete_test
-- TODO reenable once you fix the issue in Box.hs -- THE REASON YOU DID THIS IS TO PREVENT FULLY ATTACHED LINES FROM BEING MOVED
--describe "attaching_fully_attached_wont_move_test" $ attaching_fully_attached_wont_move_test
Expand Down

0 comments on commit 0b1d90a

Please sign in to comment.