Skip to content

Getting Test Failure due to UITableViewWrapperView overlapping UIImageView  #40

Open

Description

@SaketGupte

I am getting the following test failure while layout testing my View Controller:

failed - Bottom right corner of <UITableViewWrapperView: 0x7f8b9f1aca00; frame = (0 0; 375 559); gestureRecognizers = <NSArray: 0x608000251d90>; layer = <CALayer: 0x6080002311c0>; contentOffset: {0, 0}; contentSize: {375, 559}> overlaps upper left corner of <UIImageView: 0x7f8b9d75c260; frame = (3 553.5; 369 2.5); alpha = 0; opaque = NO; autoresize = TM; userInteractionEnabled = NO; layer = <CALayer: 0x608000230ee0>>. If this is intentional, you should add one of the views to viewsAllowingOverlap.

However, my ViewController does not have any UIImageView elements. Do I need to add table view to viewClassesAllowingSubviewErrors?

Activity

  1. drumnkyle commented on Sep 13, 2017

    @drumnkyle
    Contributor

    You shouldn't need to do that. I would recommend using the view debugger to inspect your view controller and find where the UIImageView is in your hierarchy. It could be in a UINavigationBar or something. I haven't seen any issues with regular UITableView.

  2. SaketGupte commented on Sep 15, 2017

    @SaketGupte
    Author

    View Debugging revealed that UIImageView in the failure log posted above is vertical scroll indicator of UITableView. As soon as I disabled horizontal and vertical scroll indicator that failure stopped occuring. Apart from that I have these two test failures as well:

    failed - Bottom right corner of <UITableViewWrapperView: 0x7fc0fd00c800; frame = (0 0; 375 577); gestureRecognizers = <NSArray: 0x600000244740>; layer = <CALayer: 0x600000222c20>; contentOffset: {0, 0}; contentSize: {375, 577}> overlaps upper left corner of <UIView: 0x7fc0fc518010; frame = (0 152; 375 0); layer = <CALayer: 0x608000427200>>. If this is intentional, you should add one of the views to viewsAllowingOverlap.

    The view in above log is the footer view for tableView .(In my view Controller I have the following piece of code:
    tableView.tableFooterView = UIView()
    )

    failed - Right side extends past superview for <_UITableViewCellSeparatorView: 0x7fc0fc604ce0; frame = (15 169.5; 487 0.5); layer = <CALayer: 0x6000002226c0>> (superview: <MovieWebService.CastDetailTableViewCell: 0x7fc0fd038600; baseClass = UITableViewCell; frame = (0 0; 375 152); clipsToBounds = YES; autoresize = W; layer = <CALayer: 0x6000002230c0>>) If this is intentional, you should add the subview to viewsAllowingOverlap.

    This is even though I have set separator to none is UITableView.

    Also I tried adding [UITableView class] to viewClassesAllowingSubviewErrors in resetDefaults method in LYTConfig.m. After that all these failures stopped occuring.

    Do you think this is a valid approach? Should UITableView be added to that list of default classes allowing subviewErrors?

  3. drumnkyle commented on Sep 26, 2017

    @drumnkyle
    Contributor

    I will have to investigate to see what's going on and if maybe we just hadn't tested UITableView with these kinds of cases. The workaround you mentioned seems like a valid approach. I would just ensure you are testing each of your cells individually. It may be that we never tested the UITableView itself because usually you should be testing the individual cells themselves. Testing an entire UITableView is less useful. LayoutTests are supposed to be closer to unit tests.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions