<commit_before>USING: ui.gadgets ui.gadgets.scrollers namespaces tools.test
kernel models models.product models.range ui.gadgets.viewports
ui.gadgets.labels ui.gadgets.grids ui.gadgets.sliders math
math.vectors arrays sequences ui.gadgets.debug math.rectangles
accessors ui.gadgets.buttons ui.gadgets.packs
ui.gadgets.scrollers.private ;
IN: ui.gadgets.scrollers.tests

[ ] [
    <gadget> "g" set
    "g" get <scroller> "s" set
] unit-test

[ { 100 200 } ] [
    { 100 200 } point>rect "g" get scroll>rect
    "s" get follows>> loc>>
] unit-test

[ ] [ "s" get scroll>bottom ] unit-test
[ t ] [ "s" get follows>> ] unit-test

[ ] [
    <gadget> dup "g" set
    10 1 0 100 <range> 20 1 0 100 <range> 2array <product>
    <viewport> "v" set
] unit-test

"v" get [
    [ { 10 20 } ] [ "v" get model>> range-value ] unit-test

    [ { 10 20 } ] [ "g" get loc>> vneg ] unit-test
] with-grafted-gadget

[ ] [
    <gadget> { 100 100 } >>dim
    dup "g" set <scroller> "s" set
] unit-test

[ ] [ "s" get { 50 50 } >>dim drop ] unit-test

[ ] [ "s" get layout ] unit-test

"s" get [
    [ { 31 31 } ] [ "s" get viewport>> dim>> ] unit-test

    [ { 100 100 } ] [ "s" get viewport>> gadget-child pref-dim ] unit-test

    [ ] [ { 0 0 } "s" get scroll ] unit-test

    [ { 0 0 } ] [ "s" get model>> range-min-value ] unit-test

    [ { 100 100 } ] [ "s" get model>> range-max-value ] unit-test

    [ ] [ { 10 20 } "s" get scroll ] unit-test

    [ { 10 20 } ] [ "s" get model>> range-value ] unit-test
<commit_msg>Fix  ui.gadgets.scrollers unit tests<commit_after>USING: ui.gadgets ui.gadgets.scrollers namespaces tools.test
kernel models models.product models.range ui.gadgets.viewports
ui.gadgets.labels ui.gadgets.grids ui.gadgets.sliders math
math.vectors arrays sequences ui.gadgets.debug math.rectangles
accessors ui.gadgets.buttons ui.gadgets.packs
ui.gadgets.scrollers.private ;
IN: ui.gadgets.scrollers.tests

[ ] [
    <gadget> "g" set
    "g" get <scroller> "s" set
] unit-test

[ { 100 200 } ] [
    { 100 200 } point>rect "g" get scroll>rect
    "s" get follows>> loc>>
] unit-test

[ ] [ "s" get scroll>bottom ] unit-test
[ t ] [ "s" get follows>> ] unit-test

[ ] [
    <gadget> dup "g" set
    10 1 0 100 <range> 20 1 0 100 <range> 2array <product>
    <viewport> "v" set
] unit-test

"v" get [
    [ { 10 20 } ] [ "v" get model>> range-value ] unit-test

    [ { 10 20 } ] [ "g" get loc>> vneg ] unit-test
] with-grafted-gadget

[ ] [
    <gadget> { 100 100 } >>dim
    dup "g" set <scroller> "s" set
] unit-test

[ ] [ "s" get { 50 50 } >>dim drop ] unit-test

[ ] [ "s" get layout ] unit-test

"s" get [
    [ { 31 31 } ] [ "s" get viewport>> dim>> ] unit-test

    [ { 100 100 } ] [ "s" get viewport>> gadget-child pref-dim ] unit-test

    [ ] [ { 0 0 } "s" get set-scroll-position ] unit-test

    [ { 0 0 } ] [ "s" get model>> range-min-value ] unit-test

    [ { 100 100 } ] [ "s" get model>> range-max-value ] unit-test

    [ ] [ { 10 20 } "s" get set-scroll-position ] unit-test

    [ { 10 20 } ] [ "s" get model>> range-value ] unit-test

{'fraction_non_alphanumeric': 0.16748446189074256, 'fraction_numerical': 0.04775924108603206, 'mean_word_length': 2.715674362089915, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 79, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5210285', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1193, 'n_words': 333}