]> sigrok.org Git - pulseview.git/blobdiff - test/view/ruler.cpp
Fix #1292/1294 by snapping to any edge when not hovering over a signal
[pulseview.git] / test / view / ruler.cpp
index a6dd1c9aad19d92d7148101580f0a8c7f890a304..3984e973aa026af34fc8a3cfa1b66ce85eea3b50 100644 (file)
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <boost/test/unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
+#include <boost/test/unit_test.hpp>
 
-#include "pv/view/ruler.hpp"
+#include "pv/views/trace/ruler.hpp"
 #include "test/test.hpp"
 
-using namespace pv::view;
+using namespace pv::views::trace;
 
 namespace {
        QString format(const pv::util::Timestamp& t)
@@ -43,9 +42,10 @@ BOOST_AUTO_TEST_CASE(tick_position_test_0)
        const pv::util::Timestamp offset("0");
        const double scale(0.001);
        const int width(500);
+       const unsigned int minor_tick_count(4);
 
        const Ruler::TickPositions ts = Ruler::calculate_tick_positions(
-               major_period, offset, scale, width, format);
+               major_period, offset, scale, width, minor_tick_count, format);
 
        BOOST_REQUIRE_EQUAL(ts.major.size(), 6);
 
@@ -89,9 +89,10 @@ BOOST_AUTO_TEST_CASE(tick_position_test_1)
        const pv::util::Timestamp offset("-0.463");
        const double scale(0.001);
        const int width(500);
+       const unsigned int minor_tick_count(4);
 
        const Ruler::TickPositions ts = Ruler::calculate_tick_positions(
-               major_period, offset, scale, width, format);
+               major_period, offset, scale, width, minor_tick_count, format);
 
        BOOST_REQUIRE_EQUAL(ts.major.size(), 5);
 
@@ -133,9 +134,10 @@ BOOST_AUTO_TEST_CASE(tick_position_test_2)
        const pv::util::Timestamp offset("8");
        const double scale(0.129746);
        const int width(580);
+       const unsigned int minor_tick_count(4);
 
        const Ruler::TickPositions ts = Ruler::calculate_tick_positions(
-               major_period, offset, scale, width, format);
+               major_period, offset, scale, width, minor_tick_count, format);
 
        const double mp = 5;
        const int off = 8;