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

fix: moved test out of lib folder #2

Merged
merged 2 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/at_viz/lib/at_gauges/linear_gauges/gauge.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

class LinearGauge extends StatefulWidget {
LinearGauge({
const LinearGauge({
required this.maxValue,
required this.minValue,
required this.actualValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'package:flutter/material.dart';
import '../painters/linear/simple_linear_gauge_painter.dart';

class SimpleLinearGauge extends LinearCustomGauge {
SimpleLinearGauge({
const SimpleLinearGauge({
super.key,
required double maxValue,
required double actualValue,
double minValue = 0,
Expand Down Expand Up @@ -94,7 +95,6 @@ class _SimpleLinearGaugeState extends State<SimpleLinearGauge>
animationController.animateTo(widget.actualValue);
}
return CustomPaint(
child: SizedBox.expand(),
painter: SimpleLinearGaugePainter(
maxValue: widget.maxValue,
minValue: widget.minValue,
Expand All @@ -113,6 +113,7 @@ class _SimpleLinearGaugeState extends State<SimpleLinearGauge>
majorTicksValueTextStyle: widget.majorTicksValueTextStyle,
gaugeOrientation: widget.gaugeOrientation,
),
child: const SizedBox.expand(),
);
}
}
7 changes: 3 additions & 4 deletions packages/at_viz/lib/at_gauges/utils/abstract_classes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,7 @@ abstract class LinearCustomPainter extends CustomPainter {
textAlign: TextAlign.center,
text: TextSpan(
text: title.data,
style: title.style == null
? TextStyle(color: Colors.black)
: title.style),
style: title.style ?? const TextStyle(color: Colors.black)),
textDirection: TextDirection.ltr,
)..layout();

Expand Down Expand Up @@ -412,7 +410,8 @@ abstract class LinearCustomPainter extends CustomPainter {
}

abstract class LinearCustomGauge extends StatefulWidget {
LinearCustomGauge({
const LinearCustomGauge({
super.key,
required this.minValue,
required this.maxValue,
required this.actualValue,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:at_time_series_chart/at_time_series_chart.dart';
import 'package:at_viz/at_charts/at_time_series_chart/lib/at_time_series_chart.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:math';

import 'package:at_time_series_chart/at_time_series_chart.dart';
import 'package:at_viz/at_charts/at_time_series_chart/lib/at_time_series_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

Expand Down
38 changes: 38 additions & 0 deletions packages/at_viz/test/at_gauges/utils_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:at_viz/at_gauges/utils/radial_helper.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
group('utils functions', () {
test('radians should be 6.28319', (() {
expect(RadialHelper.degreesToRadians(360), 6.283185307179586);
}));

test('degrees should be 360', (() {
expect(RadialHelper.radiansToDegrees(6.283185307179586), 360);
}));

test('sweepAngle should be 180', (() {
expect(
RadialHelper.actualValueToSweepAngle(
actualValue: 10, maxValue: 20, maxDegrees: 360),
180);
}));

test('actual value should be 50', () {
expect(
RadialHelper.sweepAngleToActualValue(
sweepAngle: RadialHelper.degreesToRadians(180),
maxValue: 100,
maxDegrees: 360,
minValue: 0),
50);
});
});
}
1 change: 0 additions & 1 deletion packages/at_viz/test/at_viz_test.dart

This file was deleted.