Giter VIP home page Giter VIP logo

Comments (3)

drewhannay avatar drewhannay commented on August 13, 2024

Sorry for the delay in responding. At a glance, that sounds like a reasonable idea. It would be useful to see what changes are required to change the font size and if that's something we'd need to do at the system level or if we could get away with just modifying the base Context or using a ContextThemeWrapper.

I don't currently have the bandwidth to look into this myself, but anyone who's interested is welcome to do some investigation and share their findings!

from test-butler.

Kisty avatar Kisty commented on August 13, 2024

No problem, Drew. Yeah, perhaps doing it in a ContextThemeWrapper would be a good idea however I wouldn't know how to inject ContextThemeWrapper in to the app. I think you could apply different scaling by overriding the getResources().getConfiguration() call to override fontScale or something?

from test-butler.

sergio-sastre avatar sergio-sastre commented on August 13, 2024

Hi there!
I created a TestRule by using getResources().getConfiguration() which actually serves the purpose of "simulating" the fontsize change, so I can confirm that approach works.
I guess this option might not be optimal for book-reader apps and the like that have in-app options to configure the font size, since they likely use this approach as well, and might interfere with it.

Keep in mind that such an approach is just a simulation, since the font scale in the device settings stays the same.
In order to actually change the font size in the device settings, I found out that novoda has already implemented a TestRule that does it. For more info:
https://proandroiddev.com/testing-views-in-isolation-at-romobos-d288e76fe10e
https://github.com/novoda/espresso-support

However, while using Novoda's FontScaleTestRule I experienced some problems on some old Samsung devices, on which the font size change fails randomly... that's why I decided to create my own based on modifying getResources().getConfiguration() what serves for most of the apps and works reliably... so far.

Just my two cents ;)

from test-butler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.