Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with widthratio #74

Open
892768447 opened this issue Sep 26, 2021 · 0 comments
Open

Problem with widthratio #74

892768447 opened this issue Sep 26, 2021 · 0 comments

Comments

@892768447
Copy link

892768447 commented Sep 26, 2021

https://github.com/steveire/grantlee/blob/master/templates/defaulttags/widthratio.cpp#L75

test on
{% widthratio 2 1 0.5 %}

I think it will return 1, but it returns 2

  Grantlee::Context context;
  context.insert("DPI", 0.5);
  Grantlee::Engine engine;
  Grantlee::Template tpl =
      engine.newTemplate("{width: {% widthratio 2 1 DPI %};}", "style");

  qInfo() << 2 * 0.5 << int(2 * 0.5);
  qInfo() << tpl->render(&context);

Output:
1 1
"{width: 2;}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant