Changeset c6f00b40 in mainline for uspace/lib/ui/test/control.c


Ignore:
Timestamp:
2020-11-01T22:49:05Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4ac11ff
Parents:
4df6607
git-author:
Jiri Svoboda <jiri@…> (2020-11-01 22:47:03)
git-committer:
Jiri Svoboda <jiri@…> (2020-11-01 22:49:05)
Message:

Add virtual destructor for UI control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/test/control.c

    r4df6607 rc6f00b40  
    2121 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    2222 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23 * DATA, OR PROFITS; OR BUSINESS INTvvhhzccgggrERRUPTION) HOWEVER CAUSED AND ON ANY
    2424 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2525 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     
    3939PCUT_TEST_SUITE(control);
    4040
     41static void test_ctl_destroy(void *);
    4142static errno_t test_ctl_paint(void *);
    4243static ui_evclaim_t test_ctl_pos_event(void *, pos_event_t *);
    4344
    4445static ui_control_ops_t test_ctl_ops = {
     46        .destroy = test_ctl_destroy,
    4547        .paint = test_ctl_paint,
    4648        .pos_event = test_ctl_pos_event
     
    5355        /** Result code to return */
    5456        errno_t rc;
     57
     58        /** @c true iff destroy was called */
     59        bool destroy;
    5560
    5661        /** @c true iff paint was called */
     
    8085{
    8186        ui_control_delete(NULL);
     87}
     88
     89/** Test sending destroy request to control */
     90PCUT_TEST(destroy)
     91{
     92        ui_control_t *control = NULL;
     93        test_resp_t resp;
     94        errno_t rc;
     95
     96        rc = ui_control_new(&test_ctl_ops, &resp, &control);
     97        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     98        PCUT_ASSERT_NOT_NULL(control);
     99
     100        resp.rc = EOK;
     101        resp.destroy = false;
     102
     103        ui_control_destroy(control);
     104        PCUT_ASSERT_TRUE(resp.destroy);
    82105}
    83106
     
    143166}
    144167
     168static void test_ctl_destroy(void *arg)
     169{
     170        test_resp_t *resp = (test_resp_t *) arg;
     171
     172        resp->destroy = true;
     173}
     174
    145175static errno_t test_ctl_paint(void *arg)
    146176{
Note: See TracChangeset for help on using the changeset viewer.