pedrovgs/Shot

Allow null heights to make the screenshot to wrap content

开放

#110 创建于 2020年5月11日

 (6 条评论) (2 个反应) (0 位负责人)Kotlin (111 个派生)github user discovery
enhancementhelp wanted

仓库指标

星标
 (1,208 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

This is very useful when taking screenshots of dynamic height views. We don't always force a view to have a height, and the underlying Facebook implementation allows it by simply not setting a height:

/*
     * Measure and layout the view. In this example we give an exact
     * width but all the height to be WRAP_CONTENT.
     */
    ViewHelpers.setupView(view)
      .setExactWidthDp(300)
      .layout();

Expected behaviour

If I send null as height, I want to take a screenshot with WRAP_CONTENT

Actual behaviour

If I send null as height, I have metrics.heightPixels (fullscreen) as a default

Steps to reproduce

compareScreenshot(
                view = view,
                heightInPx = null,
                widthInPx = 600
            )

Version of the library

4.1+, from the moment shot-android wrapper was released.

贡献者指南